Skip to main content

lavende_core/audio/
frame.rs

1use crate::audio::buffer::PooledBuffer;
2#[derive(Debug)]
3pub enum AudioFrame {
4    Pcm(PooledBuffer),
5    Opus(Vec<u8>),
6}
7#[cfg(test)]
8mod tests {
9    use super::*;
10    #[test]
11    fn test_audio_frame_variants() {
12        let pcm = AudioFrame::Pcm(vec![0, 1, 2]);
13        let opus = AudioFrame::Opus(vec![3, 4, 5]);
14        match pcm {
15            AudioFrame::Pcm(data) => assert_eq!(data, vec![0, 1, 2]),
16            _ => panic!("Expected Pcm variant"),
17        }
18        match opus {
19            AudioFrame::Opus(data) => assert_eq!(data, vec![3, 4, 5]),
20            _ => panic!("Expected Opus variant"),
21        }
22    }
23}