#[non_exhaustive]pub enum Error {
Busy,
PlatformUnsupported,
Claim(String),
Unsupported {
reason: String,
offered: Vec<AltSetting>,
},
ImplicitFeedbackUnsupported,
ClockUnverified {
requested_hz: u32,
reported_hz: Option<u32>,
},
DeviceLost,
Transfer(String),
Control(String),
InvalidState(String),
InvalidArgument(String),
VolumeUnavailable,
}Expand description
Everything the public API can fail with.
Error::code returns a stable machine-readable identifier for each
variant (the JNI layer puts it in the exception message).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Busy
Another Dac is already open in this process (v0.1
supports one DAC at a time), or a previous one is still shutting down.
PlatformUnsupported
Opening a DAC needs the Linux usbfs interface (Android or Linux).
Claim(String)
The file descriptor could not be used, or the interfaces the host claimed do not match what the library needs to drive the device.
Unsupported
The DAC offers no alternate setting that can carry the request.
offered lists what it does offer.
ImplicitFeedbackUnsupported
The only way to stream the request is an asynchronous endpoint that has
no explicit feedback endpoint, which would need implicit feedback (an
associated IN data endpoint). That is not supported: without feedback the
DAC’s clock and the host’s packet timing drift apart. Set
DacConfig::allow_unsynchronized_async
to stream it at the nominal rate anyway (never bit-perfect).
ClockUnverified
The DAC would not confirm the sampling frequency, and the
configuration requires a verified rate
(DacConfig::require_verified_rate).
DeviceLost
The device was unplugged or stopped answering on the bus.
Transfer(String)
An isochronous transfer, or the stream machinery around it, failed.
Control(String)
A class control request (clock, volume, mute) failed.
InvalidState(String)
The call is not valid in the current state (closed handle, writing
after drain(), a second stream while one is open, …).
InvalidArgument(String)
An argument was out of range or malformed.
The DAC has no usable hardware volume control (none, or its start-up
attenuation could not be verified) and
DacConfig::require_hardware_volume
is on: a stream would play at the DAC’s own level with no way for the
host to bring it down. Ask the user to allow fixed-level output and open
the DAC again with require_hardware_volume off. negotiate and
capabilities still work, so the host can show what the DAC offers.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()