Fix warnings in asio_sys (#779)
* Fixed warnings using deprecated Error::description * Allowed dead_code
This commit is contained in:
parent
19991d3607
commit
d0ff4fe91f
2 changed files with 18 additions and 32 deletions
|
|
@ -39,7 +39,21 @@ pub enum AsioErrorWrapper {
|
||||||
|
|
||||||
impl fmt::Display for LoadDriverError {
|
impl fmt::Display for LoadDriverError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{}", self.description())
|
match *self {
|
||||||
|
LoadDriverError::LoadDriverFailed => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{}",
|
||||||
|
"ASIO `loadDriver` function returned `false` indicating failure"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
LoadDriverError::InitializationFailed(ref err) => {
|
||||||
|
write!(f, "{}", err)
|
||||||
|
}
|
||||||
|
LoadDriverError::DriverAlreadyExists => {
|
||||||
|
write!(f, "{}", "ASIO only supports loading one driver at a time")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,37 +84,8 @@ impl fmt::Display for AsioError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error for LoadDriverError {
|
impl Error for LoadDriverError {}
|
||||||
fn description(&self) -> &str {
|
impl Error for AsioError {}
|
||||||
match *self {
|
|
||||||
LoadDriverError::LoadDriverFailed => {
|
|
||||||
"ASIO `loadDriver` function returned `false` indicating failure"
|
|
||||||
}
|
|
||||||
LoadDriverError::InitializationFailed(ref err) => err.description(),
|
|
||||||
LoadDriverError::DriverAlreadyExists => {
|
|
||||||
"ASIO only supports loading one driver at a time"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Error for AsioError {
|
|
||||||
fn description(&self) -> &str {
|
|
||||||
match *self {
|
|
||||||
AsioError::NoDrivers => "hardware input or output is not present or available",
|
|
||||||
AsioError::HardwareMalfunction => {
|
|
||||||
"hardware is malfunctioning (can be returned by any ASIO function)"
|
|
||||||
}
|
|
||||||
AsioError::InvalidInput => "input parameter invalid",
|
|
||||||
AsioError::BadMode => "hardware is in a bad mode or used in a bad mode",
|
|
||||||
AsioError::HardwareStuck => "hardware is not running when sample position is inquired",
|
|
||||||
AsioError::NoRate => "sample clock or rate cannot be determined or is not present",
|
|
||||||
AsioError::ASE_NoMemory => "not enough memory for completing the request",
|
|
||||||
AsioError::InvalidBufferSize => "buffersize out of range for device",
|
|
||||||
AsioError::UnknownError => "Error not in SDK",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<AsioError> for LoadDriverError {
|
impl From<AsioError> for LoadDriverError {
|
||||||
fn from(err: AsioError) -> Self {
|
fn from(err: AsioError) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ pub struct Stream {
|
||||||
playing: Arc<AtomicBool>,
|
playing: Arc<AtomicBool>,
|
||||||
// Ensure the `Driver` does not terminate until the last stream is dropped.
|
// Ensure the `Driver` does not terminate until the last stream is dropped.
|
||||||
driver: Arc<sys::Driver>,
|
driver: Arc<sys::Driver>,
|
||||||
|
#[allow(dead_code)]
|
||||||
asio_streams: Arc<Mutex<sys::AsioStreams>>,
|
asio_streams: Arc<Mutex<sys::AsioStreams>>,
|
||||||
callback_id: sys::CallbackId,
|
callback_id: sys::CallbackId,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue