From 806a422a2eb6022ddaf9f9c507b9319554f3d42b Mon Sep 17 00:00:00 2001 From: Kyle Simpson Date: Mon, 14 Feb 2022 15:00:57 +0000 Subject: [PATCH] Events: Document format of `VoiceData`. (#114) Closes #100. --- src/events/context/data/voice.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/events/context/data/voice.rs b/src/events/context/data/voice.rs index 46aa071..b9929b9 100644 --- a/src/events/context/data/voice.rs +++ b/src/events/context/data/voice.rs @@ -5,7 +5,15 @@ use super::*; /// Opus audio packet, received from another stream (detailed in `packet`). /// `payload_offset` contains the true payload location within the raw packet's `payload()`, /// 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> { /// Decoded audio from this packet. pub audio: &'a Option>,