Merge branch 'master' of github.com:/tazz4843/whisper-rs

This commit is contained in:
Niko 2024-03-18 18:57:50 -06:00
commit 41736c1f0f
No known key found for this signature in database
GPG key ID: 3861E636EA1E0E2B
6 changed files with 205 additions and 22 deletions

View file

@ -44,6 +44,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 {
@ -112,6 +116,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
)
}
}
}
}