flexaudio_core/
vad_error.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum VadErrorCode {
6 InvalidParameter,
8 InvalidProbability,
10 InvalidPcm,
12 Overflow,
14 SessionFinished,
16 Inference,
18 ModelLoad,
20 FailedSession,
22 InvalidStereoLength,
24 CaptureSampleOverflow,
26 PtsOutOfRange,
28 UnsupportedTap,
30 UnsupportedConversionClock,
32 Conversion,
34 Stopped,
36}
37
38impl VadErrorCode {
39 pub fn as_str(self) -> &'static str {
41 match self {
42 Self::InvalidParameter => "InvalidParameter",
43 Self::InvalidProbability => "InvalidProbability",
44 Self::InvalidPcm => "InvalidPcm",
45 Self::Overflow => "Overflow",
46 Self::SessionFinished => "SessionFinished",
47 Self::Inference => "Inference",
48 Self::ModelLoad => "ModelLoad",
49 Self::FailedSession => "FailedSession",
50 Self::InvalidStereoLength => "InvalidStereoLength",
51 Self::CaptureSampleOverflow => "CaptureSampleOverflow",
52 Self::PtsOutOfRange => "PtsOutOfRange",
53 Self::UnsupportedTap => "UnsupportedTap",
54 Self::UnsupportedConversionClock => "UnsupportedConversionClock",
55 Self::Conversion => "Conversion",
56 Self::Stopped => "Stopped",
57 }
58 }
59
60 pub fn explanation(self) -> &'static str {
62 match self {
63 Self::InvalidParameter => "a segmentation parameter is outside the supported domain",
64 Self::InvalidProbability => "an inference probability is not finite or normalized",
65 Self::InvalidPcm => "PCM contains a nonfinite or out-of-range sample",
66 Self::Overflow => "checked arithmetic or storage exceeds the supported domain",
67 Self::SessionFinished => {
68 "the completed session requires a successful reset before processing"
69 }
70 Self::Inference => "model inference or reset could not complete",
71 Self::ModelLoad => "the embedded model could not be constructed",
72 Self::FailedSession => "a previous processor failure requires a successful reset",
73 Self::InvalidStereoLength => "capture input does not contain complete stereo frames",
74 Self::CaptureSampleOverflow => "the capture sample count exceeds the supported domain",
75 Self::PtsOutOfRange => "the capture timestamp exceeds the supported domain",
76 Self::UnsupportedTap => "the requested capture tap is unavailable",
77 Self::UnsupportedConversionClock => {
78 "conversion cannot establish an exact sample-aligned clock"
79 }
80 Self::Conversion => "capture conversion could not preserve the valid sample timeline",
81 Self::Stopped => "capture intake has already stopped",
82 }
83 }
84}