#![allow(unused_imports)]
#![warn(missing_docs)]
#![no_std]
extern crate alloc;
#[cfg(not(feature = "no_std"))]
extern crate std;
mod adapt;
mod constant;
mod cycle;
mod downmix;
mod fader;
mod frame;
mod frames;
mod gain;
mod math;
mod mixer;
mod reinhard;
mod ring;
mod set;
mod signal;
mod sine;
mod smooth;
mod spatial;
mod speed;
mod spsc;
mod stream;
mod swap;
mod tanh;
pub use adapt::{Adapt, AdaptOptions};
pub use constant::Constant;
pub use cycle::Cycle;
pub use downmix::Downmix;
pub use fader::{Fader, FaderControl};
pub use frame::Frame;
pub use frames::*;
pub use gain::{FixedGain, Gain, GainControl};
pub use mixer::*;
pub use reinhard::Reinhard;
use set::*;
pub use signal::*;
pub use sine::*;
pub use smooth::{Interpolate, Smoothed};
pub use spatial::*;
pub use speed::{Speed, SpeedControl};
pub use stream::{Stream, StreamControl};
pub use tanh::Tanh;
pub type Sample = f32;
pub fn run<S: Signal + ?Sized>(signal: &mut S, sample_rate: u32, out: &mut [S::Frame]) {
let interval = 1.0 / sample_rate as f32;
signal.sample(interval, out);
}
pub fn frame_stereo(xs: &mut [Sample]) -> &mut [[Sample; 2]] {
unsafe { core::slice::from_raw_parts_mut(xs.as_mut_ptr() as _, xs.len() / 2) }
}
fn flatten_stereo(xs: &mut [[Sample; 2]]) -> &mut [Sample] {
unsafe { core::slice::from_raw_parts_mut(xs.as_mut_ptr() as _, xs.len() * 2) }
}