#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum Error {
#[error("input and output sample rates must both be greater than zero, got {input} and {output}")]
InvalidSampleRate { input: usize, output: usize },
#[error("channel count must be greater than zero, got {0}")]
InvalidChannels(usize),
#[error("quality must be greater than zero, got {0}")]
InvalidQuality(usize),
#[error("quality greater than 8192 is not supported for f32. Use f64 instead.")]
QualityTooHighForF32,
#[error("bandwidth must be in the range 0.0..=1.0, got {0}")]
InvalidBandwidth(f32),
#[error("alpha must be finite and greater than zero, got {0}")]
InvalidAlpha(f32),
#[error("expected {expected} channels, got {actual}")]
WrongChannelCount { expected: usize, actual: usize },
#[error("expected {expected} frames, got {actual}")]
WrongFrameCount { expected: usize, actual: usize },
#[error("interleaved input length {samples} is not divisible by channel count {channels}")]
MalformedInputLength { channels: usize, samples: usize },
#[error("cannot finalize with dangling partial frame: {samples} buffered samples for {channels} channels")]
DanglingPartialFrame { channels: usize, samples: usize },
#[error("expected {expected} samples in this chunk, got {actual}")]
WrongChunkLength { expected: usize, actual: usize },
#[error("output buffer can hold {actual} samples, but {expected} samples are required")]
InsufficientOutputBuffer { expected: usize, actual: usize },
#[error("stream has already been finalized")]
StreamAlreadyFinalized,
#[error("stream has already been flushed")]
AlreadyFlushed,
#[error("FFT backend error: {0}")]
Fft(String),
#[error(
"preset config must be configured before creating a stream. Use with_input_rate(), with_output_rate(), and with_channels() to configure the preset."
)]
PresetNotConfigured,
#[error("streaming worker thread panicked: {0}")]
WorkerThreadPanic(String),
#[error("failed to launch realtime worker thread: {0}")]
FailedToLaunchWorkerThread(String),
}