use crate::phoneme::PhonemeFeature;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("compile error in voice/dictionary data")]
CompileError,
#[error("data version mismatch: got 0x{got:06x}, expected 0x{expected:06x}")]
VersionMismatch {
got: u32,
expected: u32,
},
#[error("audio FIFO buffer is full")]
FifoBufferFull,
#[error("espeak-ng has not been initialised")]
NotInitialized,
#[error("audio system error")]
AudioError,
#[error("voice not found: {0}")]
VoiceNotFound(String),
#[error("MBROLA binary not found")]
MbrolaNotFound,
#[error("MBROLA voice not found")]
MbrolaVoiceNotFound,
#[error("event buffer full")]
EventBufferFull,
#[error("operation not supported")]
NotSupported,
#[error("unsupported phoneme format")]
UnsupportedPhonFormat,
#[error("no spectral frames available")]
NoSpectFrames,
#[error("phoneme manifest is empty")]
EmptyPhonemeManifest,
#[error("speech was stopped")]
SpeechStopped,
#[error("unknown phoneme feature: {0}")]
UnknownPhonemeFeature(PhonemeFeature),
#[error("unknown or unsupported text encoding: {0}")]
UnknownTextEncoding(String),
#[error("data path error: {0}")]
DataPath(String),
#[error("invalid data: {0}")]
InvalidData(String),
#[error("not yet implemented: {0}")]
NotImplemented(&'static str),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("decoding error at byte offset {offset}: {detail}")]
DecodingError {
offset: usize,
detail: String,
},
}
pub type Result<T> = std::result::Result<T, Error>;