//! Realtime-safe audio processors for platform and software voice paths.

pub mod dsp;
pub mod noop;
pub mod platform;
pub mod sonora;
pub mod webrtc_apm;

pub use noop::NoopProcessor;
pub use platform::PlatformVoiceProcessor;
pub use sonora::SonoraProcessor;
pub use webrtc_apm::WebRtcApmProcessor;

/// 10 ms mono f32 processing frame at 48 kHz (480 samples).
pub const FRAME_SAMPLES: usize = 480;

/// Realtime-safe audio processor backend.
///
/// Implementations MUST be `Send` and MUST NOT allocate, block, or
/// perform I/O inside `process_capture` or `process_render`.
pub trait AudioProcessor: Send {
    /// Process one 10 ms capture frame in-place.
    fn process_capture(&mut self, frame: &mut [f32; FRAME_SAMPLES]);

    /// Feed one 10 ms render-reference frame (decoded remote PCM
    /// before playout). Required by software AEC backends; no-op
    /// for platform and noop backends.
    fn process_render(&mut self, frame: &[f32; FRAME_SAMPLES]);

    /// Return true if this backend performs acoustic echo cancellation
    /// so the engine can enforce INV_009 / INV_010.
    fn has_aec(&self) -> bool;
}
