shizen_components/
gain.rs

1use shizen_buffers::audio::{AudioProcessor, Sample};
2
3#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
4pub struct GainComponent {
5    pub gain: f32,
6}
7
8impl GainComponent {
9    pub const fn new(gain: f32) -> Self {
10        Self { gain }
11    }
12}
13
14impl<const CH: usize> AudioProcessor<CH> for GainComponent {
15    fn process_samples(&self, samples: &[Sample; CH]) -> [f32; CH] {
16        samples.map(|s| s * self.gain)
17    }
18}