use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("channel index {index} out of range (layout has {layout} channels)")]
ChannelOutOfRange {
index: usize,
layout: usize,
},
#[error("meter has been finished, no more samples accepted")]
Finished,
#[error("expected {expected} channels, got {got}")]
ChannelMismatch {
expected: usize,
got: usize,
},
#[error(
"K-weighting coefficients are only defined for 48 kHz, got {got} Hz (ITU-R BS.1770-5 Annex 1). Resample to 48 kHz."
)]
UnsupportedSampleRate {
got: u32,
},
#[error("non-finite sample at index {index} (channel {channel}): {value}")]
NonFiniteSample {
index: usize,
channel: usize,
value: f64,
},
#[error("{what} is not yet implemented")]
NotImplemented {
what: &'static str,
},
}
pub type Result<T> = core::result::Result<T, Error>;