Events: Document format of VoiceData. (#114)

Closes #100.
This commit is contained in:
Kyle Simpson
2022-02-14 15:00:57 +00:00
committed by GitHub
parent 16acfd4ee1
commit 806a422a2e

View File

@@ -5,7 +5,15 @@ use super::*;
/// Opus audio packet, received from another stream (detailed in `packet`). /// Opus audio packet, received from another stream (detailed in `packet`).
/// `payload_offset` contains the true payload location within the raw packet's `payload()`, /// `payload_offset` contains the true payload location within the raw packet's `payload()`,
/// if extensions or raw packet data are required. /// if extensions or raw packet data are required.
/// If `audio.len() == 0`, then this packet arrived out-of-order. ///
/// Valid audio data (`Some(audio)` where `audio.len >= 0`) contains up to 20ms of 16-bit mono PCM audio
/// at 48kHz, using native endianness. Songbird will not send audio for silent regions, these should
/// be inferred using [`SpeakingUpdate`]s (and filled in by the user if required using arrays of zeroes).
///
/// If `audio.len() == 0`, then this packet arrived out-of-order. If `None`, songbird was not configured
/// to decode received packets.
///
/// [`SpeakingUpdate`]: crate::events::CoreEvent::SpeakingUpdate
pub struct VoiceData<'a> { pub struct VoiceData<'a> {
/// Decoded audio from this packet. /// Decoded audio from this packet.
pub audio: &'a Option<Vec<i16>>, pub audio: &'a Option<Vec<i16>>,