servo_media_audio/
destination_node.rs

1use crate::block::Chunk;
2use crate::node::{AudioNodeEngine, AudioNodeType, BlockInfo, ChannelCountMode, ChannelInfo};
3
4#[derive(AudioNodeCommon)]
5pub(crate) struct DestinationNode {
6    channel_info: ChannelInfo,
7    chunk: Option<Chunk>,
8}
9
10impl DestinationNode {
11    pub fn new(channel_count: u8) -> Self {
12        DestinationNode {
13            channel_info: ChannelInfo {
14                mode: ChannelCountMode::Explicit,
15                count: channel_count,
16                ..Default::default()
17            },
18            chunk: None,
19        }
20    }
21}
22
23impl AudioNodeEngine for DestinationNode {
24    fn node_type(&self) -> AudioNodeType {
25        AudioNodeType::DestinationNode
26    }
27
28    fn process(&mut self, inputs: Chunk, _: &BlockInfo) -> Chunk {
29        self.chunk = Some(inputs);
30        Chunk::default()
31    }
32
33    fn destination_data(&mut self) -> Option<Chunk> {
34        self.chunk.take()
35    }
36
37    fn output_count(&self) -> u32 {
38        0
39    }
40}