bpm_analyzer/
error.rs

1//! Error types for the BPM analyzer.
2
3use cpal::SampleFormat;
4
5/// Errors that can occur during BPM analysis
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    #[error("CPAL error: {0}")]
9    DevicesError(#[from] cpal::DevicesError),
10    #[error("Unsupported sample format: {0}")]
11    UnsupportedSampleFormat(SampleFormat),
12    #[error("Failed to get device name: {0}")]
13    DeviceNameError(#[from] cpal::DeviceNameError),
14    #[error("No input device found")]
15    NoDeviceFound,
16    #[error("Device not found: {0}")]
17    DeviceNotFound(String),
18    #[error("Failed to get stream configuration: {0}")]
19    StreamConfigError(#[from] cpal::DefaultStreamConfigError),
20    #[error("Resampling error: {0}")]
21    ResampleError(resampler::ResampleError),
22    #[error("Osclet error: {0}")]
23    Osclet(#[from] osclet::OscletError),
24    #[error("Unsupported sample rate: {0} Hz")]
25    UnsupportedSampleRate(u32),
26    #[error("Invalid configuration: {0}")]
27    InvalidConfig(String),
28}
29
30/// Result type alias for BPM analyzer operations
31pub type Result<T, E = Error> = std::result::Result<T, E>;