use mediaway_common::SampleFormat;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ApmError {
#[error("unsupported sample format {0:?} — this crate requires SampleFormat::F32")]
UnsupportedSampleFormat(SampleFormat),
#[error(
"frame format ({actual_sample_rate} Hz, {actual_channels} ch) does not match the \
stream this instance was opened with ({expected_sample_rate} Hz, {expected_channels} ch)"
)]
StreamFormatMismatch {
expected_sample_rate: u32,
expected_channels: u16,
actual_sample_rate: u32,
actual_channels: u16,
},
#[error(
"frame carries {actual} samples per channel, expected exactly {expected} (one 10ms block)"
)]
FrameLengthMismatch {
expected: usize,
actual: usize,
},
#[error("sonora backend panicked and has been disabled for this instance")]
BackendPanicked,
#[cfg(feature = "apm")]
#[error("sonora audio processing rejected the stream: {0}")]
Backend(#[source] sonora::Error),
}