Skip to main content

embedded_audio/
error.rs

1/// Errors from bank parsing and playback control.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum AudioError {
4    InvalidBankMagic,
5    UnsupportedBankVersion,
6    EffectNotFound,
7    InvalidEffectKind,
8    TruncatedBank,
9    NoBank,
10    BankFull,
11    VoiceBusy,
12    PreviewIo,
13    InvalidPayload,
14}
15
16impl AudioError {
17    pub const fn as_str(self) -> &'static str {
18        match self {
19            Self::InvalidBankMagic => "invalid bank magic",
20            Self::UnsupportedBankVersion => "unsupported bank version",
21            Self::EffectNotFound => "effect not found",
22            Self::InvalidEffectKind => "invalid effect kind",
23            Self::TruncatedBank => "truncated bank blob",
24            Self::NoBank => "no sound bank loaded",
25            Self::BankFull => "bank builder capacity exceeded",
26            Self::VoiceBusy => "no free voice",
27            Self::PreviewIo => "preview file I/O failed",
28            Self::InvalidPayload => "invalid effect payload",
29        }
30    }
31}