#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WhisperCode {
InvalidParameter,
InvalidProbability,
InvalidPcm,
Overflow,
SessionFinished,
Inference,
ModelLoad,
FailedSession,
InvalidStereoLength,
CaptureSampleOverflow,
PtsOutOfRange,
UnsupportedConversionClock,
Conversion,
Stopped,
}
impl WhisperCode {
pub fn as_str(self) -> &'static str {
match self {
Self::InvalidParameter => "InvalidParameter",
Self::InvalidProbability => "InvalidProbability",
Self::InvalidPcm => "InvalidPcm",
Self::Overflow => "Overflow",
Self::SessionFinished => "SessionFinished",
Self::Inference => "Inference",
Self::ModelLoad => "ModelLoad",
Self::FailedSession => "FailedSession",
Self::InvalidStereoLength => "InvalidStereoLength",
Self::CaptureSampleOverflow => "CaptureSampleOverflow",
Self::PtsOutOfRange => "PtsOutOfRange",
Self::UnsupportedConversionClock => "UnsupportedConversionClock",
Self::Conversion => "Conversion",
Self::Stopped => "Stopped",
}
}
pub fn explanation(self) -> &'static str {
match self {
Self::InvalidParameter => "a segmentation parameter is outside the supported domain",
Self::InvalidProbability => "an inference probability is not finite or normalized",
Self::InvalidPcm => "PCM contains a nonfinite or out-of-range sample",
Self::Overflow => "checked arithmetic or storage exceeds the supported domain",
Self::SessionFinished => {
"the completed session requires a successful reset before processing"
}
Self::Inference => "model inference or reset could not complete",
Self::ModelLoad => "the embedded model could not be constructed",
Self::FailedSession => "a previous processor failure requires a successful reset",
Self::InvalidStereoLength => "capture input does not contain complete stereo frames",
Self::CaptureSampleOverflow => "the capture sample count exceeds the supported domain",
Self::PtsOutOfRange => "the capture timestamp exceeds the supported domain",
Self::UnsupportedConversionClock => {
"conversion cannot establish an exact sample-aligned clock"
}
Self::Conversion => "capture conversion could not preserve the valid sample timeline",
Self::Stopped => "capture intake has already stopped",
}
}
}