Update audio utilities
This commit is contained in:
parent
9861dfdb93
commit
f3b155c44f
4 changed files with 110 additions and 21 deletions
22
src/error.rs
22
src/error.rs
|
|
@ -41,6 +41,10 @@ pub enum WhisperError {
|
|||
FailedToCreateState,
|
||||
/// No samples were provided.
|
||||
NoSamples,
|
||||
/// Input and output slices were not the same length.
|
||||
InputOutputLengthMismatch { input_len: usize, output_len: usize },
|
||||
/// Input slice was not an even number of samples.
|
||||
HalfSampleMissing(usize),
|
||||
}
|
||||
|
||||
impl From<Utf8Error> for WhisperError {
|
||||
|
|
@ -109,6 +113,24 @@ impl std::fmt::Display for WhisperError {
|
|||
c_int
|
||||
),
|
||||
NoSamples => write!(f, "Input sample buffer was empty."),
|
||||
InputOutputLengthMismatch {
|
||||
output_len,
|
||||
input_len,
|
||||
} => {
|
||||
write!(
|
||||
f,
|
||||
"Input and output slices were not the same length. Input: {}, Output: {}",
|
||||
input_len, output_len
|
||||
)
|
||||
}
|
||||
HalfSampleMissing(size) => {
|
||||
write!(
|
||||
f,
|
||||
"Input slice was not an even number of samples, got {}, expected {}",
|
||||
size,
|
||||
size + 1
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue