Update dependencies, switch to once_cell (#673)
This commit is contained in:
parent
b1457e5945
commit
223f28262a
6 changed files with 38 additions and 43 deletions
10
Cargo.toml
10
Cargo.toml
|
|
@ -25,11 +25,11 @@ clap = { version = "3.1", default-features = false, features = ["std"] }
|
|||
ndk-glue = "0.6"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3", features = ["audiosessiontypes", "audioclient", "coml2api", "combaseapi", "debug", "devpkey", "handleapi", "ksmedia", "mmdeviceapi", "objbase", "profileapi", "std", "synchapi", "winbase", "winuser"] }
|
||||
winapi = { version = "0.3", features = ["audiosessiontypes", "audioclient", "coml2api", "combaseapi", "debug", "devpkey", "errhandlingapi", "handleapi", "ksmedia", "mmdeviceapi", "objbase", "profileapi", "std", "synchapi", "winbase", "winuser"] }
|
||||
asio-sys = { version = "0.2", path = "asio-sys", optional = true }
|
||||
num-traits = { version = "0.2.6", optional = true }
|
||||
parking_lot = "0.11"
|
||||
lazy_static = "1.4"
|
||||
parking_lot = "0.12"
|
||||
once_cell = "1.12"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))'.dependencies]
|
||||
alsa = "0.6"
|
||||
|
|
@ -43,10 +43,10 @@ core-foundation-sys = "0.8.2" # For linking to CoreFoundation.framework and hand
|
|||
mach = "0.3" # For access to mach_timebase type.
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
coreaudio-rs = { version = "0.10.0", default-features = false, features = ["audio_unit", "core_audio"] }
|
||||
coreaudio-rs = { version = "0.10", default-features = false, features = ["audio_unit", "core_audio"] }
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
coreaudio-rs = { version = "0.10.0", default-features = false, features = ["audio_unit", "core_audio", "audio_toolbox"] }
|
||||
coreaudio-rs = { version = "0.10", default-features = false, features = ["audio_unit", "core_audio", "audio_toolbox"] }
|
||||
|
||||
[target.'cfg(target_os = "emscripten")'.dependencies]
|
||||
stdweb = { version = "0.1.3", default-features = false }
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ walkdir = "2"
|
|||
cc = "1.0.25"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "1.0.0"
|
||||
once_cell = "1.12"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ pub mod errors;
|
|||
|
||||
use self::errors::{AsioError, AsioErrorWrapper, LoadDriverError};
|
||||
use num_traits::FromPrimitive;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::{c_char, c_double, c_long, c_void};
|
||||
|
|
@ -248,17 +249,16 @@ struct BufferSizes {
|
|||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct CallbackId(usize);
|
||||
|
||||
lazy_static! {
|
||||
/// A global way to access all the callbacks.
|
||||
///
|
||||
/// This is required because of how ASIO calls the `buffer_switch` function with no data
|
||||
/// parameters.
|
||||
///
|
||||
/// Options are used so that when a callback is removed we don't change the Vec indices.
|
||||
///
|
||||
/// The indices are how we match a callback with a stream.
|
||||
static ref BUFFER_CALLBACK: Mutex<Vec<(CallbackId, BufferCallback)>> = Mutex::new(Vec::new());
|
||||
}
|
||||
/// A global way to access all the callbacks.
|
||||
///
|
||||
/// This is required because of how ASIO calls the `buffer_switch` function with no data
|
||||
/// parameters.
|
||||
///
|
||||
/// Options are used so that when a callback is removed we don't change the Vec indices.
|
||||
///
|
||||
/// The indices are how we match a callback with a stream.
|
||||
static BUFFER_CALLBACK: Lazy<Mutex<Vec<(CallbackId, BufferCallback)>>> =
|
||||
Lazy::new(|| Mutex::new(Vec::new()));
|
||||
|
||||
impl Asio {
|
||||
/// Initialise the ASIO API.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[allow(unused_imports)]
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate once_cell;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
#[macro_use]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use crate::{
|
|||
SupportedBufferSize, SupportedStreamConfig, SupportedStreamConfigRange,
|
||||
SupportedStreamConfigsError, COMMON_SAMPLE_RATES,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
use std;
|
||||
use std::ffi::OsString;
|
||||
use std::fmt;
|
||||
|
|
@ -1068,29 +1069,27 @@ impl Endpoint {
|
|||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref ENUMERATOR: Enumerator = {
|
||||
// COM initialization is thread local, but we only need to have COM initialized in the
|
||||
// thread we create the objects in
|
||||
com::com_initialized();
|
||||
static ENUMERATOR: Lazy<Enumerator> = Lazy::new(|| {
|
||||
// COM initialization is thread local, but we only need to have COM initialized in the
|
||||
// thread we create the objects in
|
||||
com::com_initialized();
|
||||
|
||||
// building the devices enumerator object
|
||||
unsafe {
|
||||
let mut enumerator: *mut IMMDeviceEnumerator = ptr::null_mut();
|
||||
// building the devices enumerator object
|
||||
unsafe {
|
||||
let mut enumerator: *mut IMMDeviceEnumerator = ptr::null_mut();
|
||||
|
||||
let hresult = CoCreateInstance(
|
||||
&CLSID_MMDeviceEnumerator,
|
||||
ptr::null_mut(),
|
||||
CLSCTX_ALL,
|
||||
&IMMDeviceEnumerator::uuidof(),
|
||||
&mut enumerator as *mut *mut IMMDeviceEnumerator as *mut _,
|
||||
);
|
||||
let hresult = CoCreateInstance(
|
||||
&CLSID_MMDeviceEnumerator,
|
||||
ptr::null_mut(),
|
||||
CLSCTX_ALL,
|
||||
&IMMDeviceEnumerator::uuidof(),
|
||||
&mut enumerator as *mut *mut IMMDeviceEnumerator as *mut _,
|
||||
);
|
||||
|
||||
check_result(hresult).unwrap();
|
||||
Enumerator(enumerator)
|
||||
}
|
||||
};
|
||||
}
|
||||
check_result(hresult).unwrap();
|
||||
Enumerator(enumerator)
|
||||
}
|
||||
});
|
||||
|
||||
/// RAII objects around `IMMDeviceEnumerator`.
|
||||
struct Enumerator(*mut IMMDeviceEnumerator);
|
||||
|
|
|
|||
|
|
@ -141,11 +141,8 @@
|
|||
//! stream.pause().unwrap();
|
||||
//! ```
|
||||
|
||||
#![recursion_limit = "512"]
|
||||
#![recursion_limit = "2048"]
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
// Extern crate declarations with `#[macro_use]` must unfortunately be at crate root.
|
||||
#[cfg(target_os = "emscripten")]
|
||||
#[macro_use]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue