basic_reverb/
mono_basic_reverb.rs

1use crate::{basic_reverb::BasicReverb, mean::mean};
2
3pub struct MonoBasicReverb<const CHANNELS: usize, const SAMPLE_RATE: u32> {
4    basic_reverb: BasicReverb<CHANNELS, SAMPLE_RATE>,
5}
6
7impl<const CHANNELS: usize, const SAMPLE_RATE: u32> MonoBasicReverb<CHANNELS, SAMPLE_RATE> {
8    pub fn new(room_size_ms: f64, rt60: f64, dry: f64, wet: f64) -> Self {
9        Self {
10            basic_reverb: BasicReverb::new(room_size_ms, rt60, dry, wet),
11        }
12    }
13
14    pub fn process_sample(&mut self, sample: f64) -> f64 {
15        let resized_input = [sample; CHANNELS];
16        let output = self.basic_reverb.process(resized_input);
17        mean(&output)
18    }
19}