Skip to main content

sim_lib_sound_render/
error.rs

1use thiserror::Error;
2
3/// Error raised by sound rendering and WAV encoding.
4#[derive(Debug, Error, Clone, PartialEq, Eq)]
5pub enum SoundRenderError {
6    /// The sample rate was zero.
7    #[error("sample rate must be positive")]
8    InvalidSampleRate,
9    /// The channel count was neither mono (1) nor stereo (2).
10    #[error("renderer only supports mono or stereo output")]
11    InvalidChannelCount,
12    /// The sample buffer length was not divisible by the renderer channel count.
13    #[error("audio buffer length is not aligned to the renderer channel count")]
14    ChannelMisalignedSamples,
15    /// The audio buffer exceeded the size encodable in a WAV header.
16    #[error("audio buffer too large to encode")]
17    BufferTooLarge,
18    /// The timbre policy rejected the requested preview pitch.
19    #[error("timbre policy rejected preview pitch")]
20    TimbrePreviewRejected,
21    /// The timbre did not yield any renderable partials.
22    #[error("timbre preview has no renderable partials")]
23    EmptyTimbrePreview,
24}