From cbdbfc5a91f2c4b96d5de4bd0e1a98c1939e7590 Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Thu, 31 Jul 2025 14:53:28 -0400 Subject: [PATCH 1/9] properly detect `is_default` --- src/host/coreaudio/macos/enumerate.rs | 4 +-- src/host/coreaudio/macos/mod.rs | 45 +++++++++++++++++++++++++-- src/host/coreaudio/mod.rs | 1 - src/samples_formats.rs | 5 +-- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/host/coreaudio/macos/enumerate.rs b/src/host/coreaudio/macos/enumerate.rs index e81a85523..205148476 100644 --- a/src/host/coreaudio/macos/enumerate.rs +++ b/src/host/coreaudio/macos/enumerate.rs @@ -105,7 +105,7 @@ pub fn default_input_device() -> Option { NonNull::from(&mut audio_device_id).cast(), ) }; - if status != kAudioHardwareNoError as i32 { + if status != kAudioHardwareNoError { return None; } @@ -135,7 +135,7 @@ pub fn default_output_device() -> Option { NonNull::from(&mut audio_device_id).cast(), ) }; - if status != kAudioHardwareNoError as i32 { + if status != kAudioHardwareNoError { return None; } diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index 1897a7040..69abc7173 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -24,7 +24,8 @@ use objc2_core_audio::{ kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput, kAudioObjectPropertyScopeOutput, AudioDeviceID, AudioObjectGetPropertyData, AudioObjectGetPropertyDataSize, AudioObjectID, AudioObjectPropertyAddress, - AudioObjectPropertyScope, AudioObjectSetPropertyData, + AudioObjectPropertyScope, AudioObjectSetPropertyData, kAudioHardwarePropertyDefaultInputDevice, + kAudioObjectSystemObject, kAudioHardwarePropertyDefaultOutputDevice }; use objc2_core_audio_types::{ AudioBuffer, AudioBufferList, AudioStreamBasicDescription, AudioValueRange, @@ -164,10 +165,48 @@ impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { + + // Get default input device ID. + let mut property_address = AudioObjectPropertyAddress { + mSelector: kAudioHardwarePropertyDefaultInputDevice, + mScope: kAudioObjectPropertyScopeGlobal, + mElement: kAudioObjectPropertyElementMaster, + }; + + let mut default_input_device_id: AudioDeviceID = 0; + let data_size = mem::size_of::() as u32; + let input_status = unsafe { + AudioObjectGetPropertyData( + kAudioObjectSystemObject as AudioObjectID, + NonNull::from(&property_address), + 0, + null(), + NonNull::from(&data_size), + NonNull::from(&mut default_input_device_id).cast(), + ) + }; + + // Get default output device ID. + property_address.mSelector = kAudioHardwarePropertyDefaultOutputDevice; + + let mut default_output_device_id: AudioDeviceID = 0; + let output_status = unsafe { + AudioObjectGetPropertyData( + kAudioObjectSystemObject as AudioObjectID, + NonNull::from(&property_address), + 0, + null(), + NonNull::from(&data_size), + NonNull::from(&mut default_output_device_id).cast(), + ) + }; + + Device { audio_device_id, - // TODO: This could be made to detect the default device properly. - is_default: false, + is_default: + (default_input_device_id == audio_device_id && input_status == 0) || + (default_output_device_id == audio_device_id && output_status == 0) } } diff --git a/src/host/coreaudio/mod.rs b/src/host/coreaudio/mod.rs index 9133d7cec..3c74b99bd 100644 --- a/src/host/coreaudio/mod.rs +++ b/src/host/coreaudio/mod.rs @@ -26,7 +26,6 @@ pub use self::macos::{ }; /// Common helper methods used by both macOS and iOS - fn check_os_status(os_status: OSStatus) -> Result<(), BackendSpecificError> { match coreaudio::Error::from_os_status(os_status) { Ok(()) => Ok(()), diff --git a/src/samples_formats.rs b/src/samples_formats.rs index 27e4fa46f..5461c52c7 100644 --- a/src/samples_formats.rs +++ b/src/samples_formats.rs @@ -37,6 +37,7 @@ pub enum SampleFormat { // /// `I48` with a valid range of '-(1 << 47)..(1 << 47)' with `0` being the origin // I48, + /// `i64` with a valid range of `i64::MIN..=i64::MAX` with `0` being the origin. I64, @@ -46,13 +47,13 @@ pub enum SampleFormat { /// `u16` with a valid range of `u16::MIN..=u16::MAX` with `1 << 15 == 32768` being the origin. U16, - /// `U24` with a valid range of '0..16777216' with `1 << 23 == 8388608` being the origin + // /// `U24` with a valid range of '0..16777216' with `1 << 23 == 8388608` being the origin // U24, /// `u32` with a valid range of `u32::MIN..=u32::MAX` with `1 << 31` being the origin. U32, - /// `U48` with a valid range of '0..(1 << 48)' with `1 << 47` being the origin + // /// `U48` with a valid range of '0..(1 << 48)' with `1 << 47` being the origin // U48, /// `u64` with a valid range of `u64::MIN..=u64::MAX` with `1 << 63` being the origin. From 7e6ca1b288d6e76bb9b0171fe8a81345947f546c Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Thu, 31 Jul 2025 15:28:40 -0400 Subject: [PATCH 2/9] fix formatting issues --- src/host/coreaudio/macos/mod.rs | 18 +++++++----------- src/samples_formats.rs | 3 --- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index 69abc7173..f4866e756 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -20,12 +20,12 @@ use objc2_core_audio::{ kAudioDevicePropertyAvailableNominalSampleRates, kAudioDevicePropertyBufferFrameSize, kAudioDevicePropertyBufferFrameSizeRange, kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyStreamConfiguration, - kAudioDevicePropertyStreamFormat, kAudioObjectPropertyElementMaster, + kAudioDevicePropertyStreamFormat, kAudioHardwarePropertyDefaultInputDevice, + kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput, - kAudioObjectPropertyScopeOutput, AudioDeviceID, AudioObjectGetPropertyData, - AudioObjectGetPropertyDataSize, AudioObjectID, AudioObjectPropertyAddress, - AudioObjectPropertyScope, AudioObjectSetPropertyData, kAudioHardwarePropertyDefaultInputDevice, - kAudioObjectSystemObject, kAudioHardwarePropertyDefaultOutputDevice + kAudioObjectPropertyScopeOutput, kAudioObjectSystemObject, AudioDeviceID, + AudioObjectGetPropertyData, AudioObjectGetPropertyDataSize, AudioObjectID, + AudioObjectPropertyAddress, AudioObjectPropertyScope, AudioObjectSetPropertyData, }; use objc2_core_audio_types::{ AudioBuffer, AudioBufferList, AudioStreamBasicDescription, AudioValueRange, @@ -165,7 +165,6 @@ impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { - // Get default input device ID. let mut property_address = AudioObjectPropertyAddress { mSelector: kAudioHardwarePropertyDefaultInputDevice, @@ -200,13 +199,10 @@ impl Device { NonNull::from(&mut default_output_device_id).cast(), ) }; - - Device { audio_device_id, - is_default: - (default_input_device_id == audio_device_id && input_status == 0) || - (default_output_device_id == audio_device_id && output_status == 0) + is_default: (default_input_device_id == audio_device_id && input_status == 0) + || (default_output_device_id == audio_device_id && output_status == 0), } } diff --git a/src/samples_formats.rs b/src/samples_formats.rs index 5461c52c7..dc4952100 100644 --- a/src/samples_formats.rs +++ b/src/samples_formats.rs @@ -37,7 +37,6 @@ pub enum SampleFormat { // /// `I48` with a valid range of '-(1 << 47)..(1 << 47)' with `0` being the origin // I48, - /// `i64` with a valid range of `i64::MIN..=i64::MAX` with `0` being the origin. I64, @@ -49,13 +48,11 @@ pub enum SampleFormat { // /// `U24` with a valid range of '0..16777216' with `1 << 23 == 8388608` being the origin // U24, - /// `u32` with a valid range of `u32::MIN..=u32::MAX` with `1 << 31` being the origin. U32, // /// `U48` with a valid range of '0..(1 << 48)' with `1 << 47` being the origin // U48, - /// `u64` with a valid range of `u64::MIN..=u64::MAX` with `1 << 63` being the origin. U64, From 5d7fcb260cef29636b7e910260b6c65f9abdc962 Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Tue, 5 Aug 2025 13:48:03 -0400 Subject: [PATCH 3/9] fix requested changes --- src/host/coreaudio/macos/enumerate.rs | 4 +-- src/host/coreaudio/macos/mod.rs | 52 +++++++-------------------- src/samples_formats.rs | 4 +-- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/src/host/coreaudio/macos/enumerate.rs b/src/host/coreaudio/macos/enumerate.rs index 205148476..e81a85523 100644 --- a/src/host/coreaudio/macos/enumerate.rs +++ b/src/host/coreaudio/macos/enumerate.rs @@ -105,7 +105,7 @@ pub fn default_input_device() -> Option { NonNull::from(&mut audio_device_id).cast(), ) }; - if status != kAudioHardwareNoError { + if status != kAudioHardwareNoError as i32 { return None; } @@ -135,7 +135,7 @@ pub fn default_output_device() -> Option { NonNull::from(&mut audio_device_id).cast(), ) }; - if status != kAudioHardwareNoError { + if status != kAudioHardwareNoError as i32 { return None; } diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index f4866e756..ff789b9f1 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -20,10 +20,9 @@ use objc2_core_audio::{ kAudioDevicePropertyAvailableNominalSampleRates, kAudioDevicePropertyBufferFrameSize, kAudioDevicePropertyBufferFrameSizeRange, kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyStreamConfiguration, - kAudioDevicePropertyStreamFormat, kAudioHardwarePropertyDefaultInputDevice, - kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyElementMaster, + kAudioDevicePropertyStreamFormat, kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput, - kAudioObjectPropertyScopeOutput, kAudioObjectSystemObject, AudioDeviceID, + kAudioObjectPropertyScopeOutput, AudioDeviceID, AudioObjectGetPropertyData, AudioObjectGetPropertyDataSize, AudioObjectID, AudioObjectPropertyAddress, AudioObjectPropertyScope, AudioObjectSetPropertyData, }; @@ -165,44 +164,19 @@ impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { - // Get default input device ID. - let mut property_address = AudioObjectPropertyAddress { - mSelector: kAudioHardwarePropertyDefaultInputDevice, - mScope: kAudioObjectPropertyScopeGlobal, - mElement: kAudioObjectPropertyElementMaster, - }; - let mut default_input_device_id: AudioDeviceID = 0; - let data_size = mem::size_of::() as u32; - let input_status = unsafe { - AudioObjectGetPropertyData( - kAudioObjectSystemObject as AudioObjectID, - NonNull::from(&property_address), - 0, - null(), - NonNull::from(&data_size), - NonNull::from(&mut default_input_device_id).cast(), - ) - }; - - // Get default output device ID. - property_address.mSelector = kAudioHardwarePropertyDefaultOutputDevice; - - let mut default_output_device_id: AudioDeviceID = 0; - let output_status = unsafe { - AudioObjectGetPropertyData( - kAudioObjectSystemObject as AudioObjectID, - NonNull::from(&property_address), - 0, - null(), - NonNull::from(&data_size), - NonNull::from(&mut default_output_device_id).cast(), - ) - }; - Device { + let is_default = + default_input_device() + .map(|d| d.audio_device_id == audio_device_id) + .unwrap_or(false) + || + default_output_device() + .map(|d| d.audio_device_id == audio_device_id) + .unwrap_or(false); + + Self { audio_device_id, - is_default: (default_input_device_id == audio_device_id && input_status == 0) - || (default_output_device_id == audio_device_id && output_status == 0), + is_default, } } diff --git a/src/samples_formats.rs b/src/samples_formats.rs index dc4952100..7888c9d94 100644 --- a/src/samples_formats.rs +++ b/src/samples_formats.rs @@ -46,12 +46,12 @@ pub enum SampleFormat { /// `u16` with a valid range of `u16::MIN..=u16::MAX` with `1 << 15 == 32768` being the origin. U16, - // /// `U24` with a valid range of '0..16777216' with `1 << 23 == 8388608` being the origin + /// `U24` with a valid range of '0..16777216' with `1 << 23 == 8388608` being the origin // U24, /// `u32` with a valid range of `u32::MIN..=u32::MAX` with `1 << 31` being the origin. U32, - // /// `U48` with a valid range of '0..(1 << 48)' with `1 << 47` being the origin + /// `U48` with a valid range of '0..(1 << 48)' with `1 << 47` being the origin // U48, /// `u64` with a valid range of `u64::MIN..=u64::MAX` with `1 << 63` being the origin. U64, From 05fe95e3935aaa2da591e8156e3ceb378fafdc61 Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Tue, 5 Aug 2025 18:05:39 -0400 Subject: [PATCH 4/9] create helper function --- src/host/coreaudio/macos/mod.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index 3faa9efa2..6047dcf11 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -162,20 +162,24 @@ pub struct Device { is_default: bool, } +fn is_default_device(audio_device_id: AudioDeviceID) -> bool { + default_input_device() + .map(|d| d.audio_device_id == audio_device_id) + .unwrap_or(false) + || + default_output_device() + .map(|d| d.audio_device_id == audio_device_id) + .unwrap_or(false) +} + + impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { - - let is_default = - default_input_device() - .map(|d| d.audio_device_id == audio_device_id) - .unwrap_or(false) - || - default_output_device() - .map(|d| d.audio_device_id == audio_device_id) - .unwrap_or(false); + let is_default = is_default_device(audio_device_id); + Self { audio_device_id, is_default, From e20b7b1ac1569d7e709e8277f5c58d9c88f73b9b Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Thu, 7 Aug 2025 17:57:44 -0400 Subject: [PATCH 5/9] removed `is_default` from `Device` struct --- src/host/coreaudio/macos/enumerate.rs | 3 --- src/host/coreaudio/macos/mod.rs | 17 ++++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/host/coreaudio/macos/enumerate.rs b/src/host/coreaudio/macos/enumerate.rs index 66d500174..55952a0ca 100644 --- a/src/host/coreaudio/macos/enumerate.rs +++ b/src/host/coreaudio/macos/enumerate.rs @@ -81,7 +81,6 @@ impl Iterator for Devices { fn next(&mut self) -> Option { self.0.next().map(|id| Device { audio_device_id: id, - is_default: false, }) } } @@ -111,7 +110,6 @@ pub fn default_input_device() -> Option { let device = Device { audio_device_id, - is_default: true, }; Some(device) } @@ -141,7 +139,6 @@ pub fn default_output_device() -> Option { let device = Device { audio_device_id, - is_default: true, }; Some(device) } diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index 6047dcf11..87ab90d34 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -159,16 +159,15 @@ impl DeviceTrait for Device { #[derive(Clone, PartialEq, Eq)] pub struct Device { pub(crate) audio_device_id: AudioDeviceID, - is_default: bool, } -fn is_default_device(audio_device_id: AudioDeviceID) -> bool { +fn is_default_device(device: Device) -> bool { default_input_device() - .map(|d| d.audio_device_id == audio_device_id) + .map(|d| d.audio_device_id == device.audio_device_id) .unwrap_or(false) || default_output_device() - .map(|d| d.audio_device_id == audio_device_id) + .map(|d| d.audio_device_id == device.audio_device_id) .unwrap_or(false) } @@ -177,12 +176,8 @@ impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { - - let is_default = is_default_device(audio_device_id); - Self { audio_device_id, - is_default, } } @@ -536,7 +531,7 @@ where } fn audio_unit_from_device(device: &Device, input: bool) -> Result { - let output_type = if device.is_default && !input { + let output_type = if is_default_device(device.clone()) && !input { coreaudio::audio_unit::IOType::DefaultOutput } else { coreaudio::audio_unit::IOType::HalOutput @@ -678,7 +673,7 @@ impl Device { // If we didn't request the default device, stop the stream if the // device disconnects. - if !self.is_default { + if !is_default_device(self.clone()) { add_disconnect_listener(&stream, error_callback_disconnect)?; } @@ -783,7 +778,7 @@ impl Device { // If we didn't request the default device, stop the stream if the // device disconnects. - if !self.is_default { + if !is_default_device(self.clone()) { add_disconnect_listener(&stream, error_callback_disconnect)?; } From 337516ec5ff81a6cd78d6fcac7f4f2e5424a8dc9 Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Fri, 8 Aug 2025 14:03:47 -0400 Subject: [PATCH 6/9] remove unnecessary clone operations And I couldn't reproduce the issue with formatting. I'll check again in a moment. --- src/host/coreaudio/macos/enumerate.rs | 8 ++------ src/host/coreaudio/macos/mod.rs | 26 +++++++++++--------------- src/host/coreaudio/mod.rs | 1 - 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/host/coreaudio/macos/enumerate.rs b/src/host/coreaudio/macos/enumerate.rs index 55952a0ca..806044883 100644 --- a/src/host/coreaudio/macos/enumerate.rs +++ b/src/host/coreaudio/macos/enumerate.rs @@ -108,9 +108,7 @@ pub fn default_input_device() -> Option { return None; } - let device = Device { - audio_device_id, - }; + let device = Device { audio_device_id }; Some(device) } @@ -137,9 +135,7 @@ pub fn default_output_device() -> Option { return None; } - let device = Device { - audio_device_id, - }; + let device = Device { audio_device_id }; Some(device) } diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index 87ab90d34..c0809fa2f 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -22,9 +22,9 @@ use objc2_core_audio::{ kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyStreamFormat, kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput, - kAudioObjectPropertyScopeOutput, AudioDeviceID, - AudioObjectGetPropertyData, AudioObjectGetPropertyDataSize, AudioObjectID, - AudioObjectPropertyAddress, AudioObjectPropertyScope, AudioObjectSetPropertyData, + kAudioObjectPropertyScopeOutput, AudioDeviceID, AudioObjectGetPropertyData, + AudioObjectGetPropertyDataSize, AudioObjectID, AudioObjectPropertyAddress, + AudioObjectPropertyScope, AudioObjectSetPropertyData, }; use objc2_core_audio_types::{ AudioBuffer, AudioBufferList, AudioStreamBasicDescription, AudioValueRange, @@ -161,24 +161,20 @@ pub struct Device { pub(crate) audio_device_id: AudioDeviceID, } -fn is_default_device(device: Device) -> bool { +fn is_default_device(device: &Device) -> bool { default_input_device() .map(|d| d.audio_device_id == device.audio_device_id) .unwrap_or(false) - || - default_output_device() - .map(|d| d.audio_device_id == device.audio_device_id) - .unwrap_or(false) + || default_output_device() + .map(|d| d.audio_device_id == device.audio_device_id) + .unwrap_or(false) } - impl Device { /// Construct a new device given its ID. /// Useful for constructing hidden devices. pub fn new(audio_device_id: AudioDeviceID) -> Self { - Self { - audio_device_id, - } + Self { audio_device_id } } fn name(&self) -> Result { @@ -531,7 +527,7 @@ where } fn audio_unit_from_device(device: &Device, input: bool) -> Result { - let output_type = if is_default_device(device.clone()) && !input { + let output_type = if is_default_device(device) && !input { coreaudio::audio_unit::IOType::DefaultOutput } else { coreaudio::audio_unit::IOType::HalOutput @@ -673,7 +669,7 @@ impl Device { // If we didn't request the default device, stop the stream if the // device disconnects. - if !is_default_device(self.clone()) { + if !is_default_device(self) { add_disconnect_listener(&stream, error_callback_disconnect)?; } @@ -778,7 +774,7 @@ impl Device { // If we didn't request the default device, stop the stream if the // device disconnects. - if !is_default_device(self.clone()) { + if !is_default_device(self) { add_disconnect_listener(&stream, error_callback_disconnect)?; } diff --git a/src/host/coreaudio/mod.rs b/src/host/coreaudio/mod.rs index 2a2fdd928..6a7639812 100644 --- a/src/host/coreaudio/mod.rs +++ b/src/host/coreaudio/mod.rs @@ -25,7 +25,6 @@ pub use self::macos::{ Device, Host, Stream, }; - // Common helper methods used by both macOS and iOS fn check_os_status(os_status: OSStatus) -> Result<(), BackendSpecificError> { match coreaudio::Error::from_os_status(os_status) { From c55a6cebf713db3229825c6cee0acae078770276 Mon Sep 17 00:00:00 2001 From: DischordDynne Date: Fri, 8 Aug 2025 14:26:06 -0400 Subject: [PATCH 7/9] Added changes to `CHANGELOG.md` --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2dcbb8e3..211e6a847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - ALSA(process_output): pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr - WASAPI: Expose IMMDevice from WASAPI host Device. - CoreAudio: `Device::supported_configs` now returns a single element containing the available sample rate range when all elements have the same `mMinimum` and `mMaximum` values (which is the most common case). +- CoreAudio: The `Device.is_default` parameter has been removed, as it did not function as intended. To determine whether an audio device is default, call `is_default_device` in macos/mod.rs. # Version 0.16.0 (2025-06-07) From dc047ec14a7d94db1acd3ed74b8a8c039be1bb3b Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Mon, 11 Aug 2025 14:34:52 +0200 Subject: [PATCH 8/9] docs: lazy CoreAudio default device detection --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 200efe86b..b3f6277db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Unreleased -- ALSA(process_output): pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr. +- ALSA(process_output): Pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr. - CoreAudio: `Device::supported_configs` now returns a single element containing the available sample rate range when all elements have the same `mMinimum` and `mMaximum` values (which is the most common case). +- CoreAudio: Detect default audio device lazily when building a stream, instead of during device enumeration. - iOS: Fix example by properly activating audio session. - WASAPI: Expose IMMDevice from WASAPI host Device. -- CoreAudio: The `Device.is_default` parameter has been removed, as it did not function as intended. To determine whether an audio device is default, call `is_default_device` in macos/mod.rs. # Version 0.16.0 (2025-06-07) From 6cccbc53c141aac6e67f38baeffa21f008e31479 Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Mon, 11 Aug 2025 14:37:11 +0200 Subject: [PATCH 9/9] docs: keep newline between section header and next function --- src/host/coreaudio/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/host/coreaudio/mod.rs b/src/host/coreaudio/mod.rs index 6a7639812..a22b86ee6 100644 --- a/src/host/coreaudio/mod.rs +++ b/src/host/coreaudio/mod.rs @@ -26,6 +26,7 @@ pub use self::macos::{ }; // Common helper methods used by both macOS and iOS + fn check_os_status(os_status: OSStatus) -> Result<(), BackendSpecificError> { match coreaudio::Error::from_os_status(os_status) { Ok(()) => Ok(()),