nooise 1.0.1

Fluid focus music for the terminal
1
2
3
4
5
6
7
8
9
pub(crate) struct StereoPanner;

impl StereoPanner {
    pub(crate) fn equal_power(mono: f32, pan: f32) -> (f32, f32) {
        let normalized = ((pan.clamp(-1.0, 1.0) + 1.0) * 0.5).clamp(0.0, 1.0);
        let angle = normalized * std::f32::consts::FRAC_PI_2;
        (mono * angle.cos(), mono * angle.sin())
    }
}