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
|
|
@ -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