Skip to content

Commit 51c8a88

Browse files
committed
Don't call set_notification_runloop on Mac OS 10.7 or later version
1 parent 8247ec7 commit 51c8a88

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,15 @@ impl AudioUnitContext {
19551955

19561956
impl ContextOps for AudioUnitContext {
19571957
fn init(_context_name: Option<&CStr>) -> Result<Context> {
1958-
set_notification_runloop();
1958+
// set_notification_runloop (kAudioHardwarePropertyRunLoop) doesn't work since 10.7.
1959+
if let Ok(v) = os_version() {
1960+
if let Ok(v) = v.parse::<f32>() {
1961+
const MAC_OS_LION: f32 = 10.7;
1962+
if v < MAC_OS_LION {
1963+
set_notification_runloop();
1964+
}
1965+
}
1966+
}
19591967
let ctx = Box::new(AudioUnitContext::new());
19601968
Ok(unsafe { Context::from_ptr(Box::into_raw(ctx) as *mut _) })
19611969
}

0 commit comments

Comments
 (0)