Skip to main content

zk_audio/
types.rs

1use crate::core::{AudioFrame, AudioSpec};
2
3#[allow(dead_code)]
4#[derive(Debug, Clone)]
5pub struct AudioBlock {
6    pub samples: Vec<f32>,
7    pub spec: AudioSpec,
8}
9
10#[allow(dead_code)]
11impl AudioBlock {
12    pub fn new(samples: Vec<f32>, spec: AudioSpec) -> Self {
13        Self { samples, spec }
14    }
15}
16
17impl From<AudioFrame> for AudioBlock {
18    fn from(frame: AudioFrame) -> Self {
19        Self {
20            samples: frame.samples,
21            spec: frame.spec,
22        }
23    }
24}
25
26impl From<AudioBlock> for AudioFrame {
27    fn from(block: AudioBlock) -> Self {
28        Self {
29            samples: block.samples,
30            spec: block.spec,
31        }
32    }
33}
34
35#[allow(dead_code)]
36#[derive(Debug, Clone, Copy)]
37pub struct ProcessContext {
38    pub spec: AudioSpec,
39    pub frame_size: usize,
40    pub frame_index: u64,
41}
42
43#[allow(dead_code)]
44#[derive(Debug, Clone, Copy, Default)]
45pub struct ProcessorInfo {
46    pub latency_samples: usize,
47}
48
49#[allow(dead_code)]
50#[derive(Debug, Clone, Copy, Default)]
51pub struct SinkReport {
52    pub frames_written: u64,
53}