pub enum Error {
Show 22 variants
FeatureNotCompiled(&'static str),
WrongTimeOffset(usize, usize),
WrongNumChannels(u16, u16),
WrongNumChannelsAndMono,
CannotZeroPadWithoutSpecifiedLength,
CannotRepeatPadWithoutSpecifiedLength,
CannotSetZeroPadEndingAndRepeatPadEnding,
NoSuitableAudioStreams(usize),
UnknownDecodingBackend(u32),
UnknownInputEncoding,
UnknownDecodeError,
UnknownDecodeErrorWithMessage(&'static str),
UnknownEncodeError,
ResamplingError,
ResamplingErrorWithMessage(&'static str),
WrongFrameRate(u32, u32),
WrongFrameRateRatio(u32, u32),
FilenameIsADirectory(&'static str),
FileNotFound(&'static str),
UnknownIOError,
CannotAppendSourcesWithDifferentNumChannels(u16, u16),
CannotAppendSourcesWithDifferentFrameRates(u32, u32),
}
Variants§
FeatureNotCompiled(&'static str)
Raised when you are trying to use a feature at runtime that was not included at compile-time.
For example, you may receive this error if you are trying to resample audio using a method that was not compiled for your target or binding.
WrongTimeOffset(usize, usize)
Raised when WaveformArgs.start_time_milliseconds
or WaveformArgs.end_time_milliseconds
is invalid.
For example, this error is raised if you set the end timestamp to be before the start timestamp.
WrongNumChannels(u16, u16)
Raised when you wanted to decode more channels than the audio actually had.
WrongNumChannelsAndMono
Raised if you specified WaveformArgs.convert_to_mono
as true
and WaveformArgs.num_channels
as 1.
Setting both parameters is redundant and contradictory. You should either use
WaveformArgs.convert_to_mono
to flatten all channels or WaveformArgs.num_channels
= 1 to select the first channel and discard the rest.
You can set WaveformArgs.num_channels
n > 1
and use WaveformArgs.convert_to_mono
to only flatten those n
channels.
If you need to select channels in some other way, then do not provide either
WaveformArgs.convert_to_mono
or WaveformArgs.num_channels
.
All channels will be decoded and you can decide what to do with them.
CannotZeroPadWithoutSpecifiedLength
Raised if you set WaveformArgs.zero_pad_ending
as true
without also specifying WaveformArgs.end_time_milliseconds
.
CannotRepeatPadWithoutSpecifiedLength
Raised if you set WaveformArgs.repeat_pad_ending
as true
without also specifying WaveformArgs.end_time_milliseconds
.
CannotSetZeroPadEndingAndRepeatPadEnding
Raised if you set both
WaveformArgs.zero_pad_ending
and
WaveformArgs.repeat_pad_ending
as true
.
NoSuitableAudioStreams(usize)
Raised when we could not decode any of the audio streams.
UnknownDecodingBackend(u32)
Raised when we do not recognize the decoding backend.
UnknownInputEncoding
Raised when we were not able to detect the encoded input as decodable audio.
UnknownDecodeError
Raised when we were not able to decode the given (encoded) audio.
UnknownDecodeErrorWithMessage(&'static str)
Raised when we were not able to decode the given (encoded) audio.
UnknownEncodeError
Raised when we encountered an unknown error when encoding a waveform into a particular format.
ResamplingError
Raised when we were not able to resample the audio.
ResamplingErrorWithMessage(&'static str)
WrongFrameRate(u32, u32)
Raised when we cannot resample from the input frame rate to the output frame rate.
WrongFrameRateRatio(u32, u32)
Raised if you are trying upsample or downsample audio by a factor greater than 256.
FilenameIsADirectory(&'static str)
Raised if you asked Babycat to read a file but gave it a path to a directory.
FileNotFound(&'static str)
Raised if you asked Babycat to read a file that does not exist.
UnknownIOError
Raised when something else went wrong while doing I/O.