mod agc;
mod biquad;
mod channels;
mod convert;
mod dc_block;
mod gain;
mod resample;
mod vad;
pub use agc::{Agc, AgcConfig};
pub use biquad::{Biquad, BiquadKind, Coefficients};
pub use channels::{MonoToStereo, StereoToMono, mix_i16};
pub use convert::Convert;
pub use dc_block::DcBlock;
pub use gain::Gain;
pub use resample::LinearResampler;
pub use vad::{EnergyVad, VadConfig};
use rusty_esp_core::error::{Error, Result};
use rusty_esp_core::pcm::{PcmFormat, SampleFormat};
pub const MAX_CHANNELS: usize = 2;
fn require_i16(input: PcmFormat) -> Result<()> {
if input.sample != SampleFormat::I16 || input.channels as usize > MAX_CHANNELS {
return Err(Error::Unsupported);
}
Ok(())
}
fn require_i16_any(input: PcmFormat) -> Result<()> {
if input.sample != SampleFormat::I16 {
return Err(Error::Unsupported);
}
Ok(())
}
fn require_room(out: &[u8], needed: usize) -> Result<()> {
if out.len() < needed {
return Err(Error::BufferTooSmall { needed });
}
Ok(())
}