diff --git a/src/backend/tests/api.rs b/src/backend/tests/api.rs index e638b04..4cd86c0 100644 --- a/src/backend/tests/api.rs +++ b/src/backend/tests/api.rs @@ -2,8 +2,8 @@ use super::utils::{ test_audiounit_get_buffer_frame_size, test_audiounit_scope_is_enabled, test_create_audiounit, test_device_channels_in_scope, test_device_in_scope, test_get_all_devices, test_get_default_audiounit, test_get_default_device, test_get_default_raw_stream, - test_get_devices_in_scope, test_get_raw_context, test_get_source_name, ComponentSubType, - DeviceFilter, PropertyScope, Scope, + test_get_devices_in_scope, test_get_raw_context, ComponentSubType, DeviceFilter, PropertyScope, + Scope, }; use super::*; diff --git a/src/backend/tests/utils.rs b/src/backend/tests/utils.rs index 6ea1ebf..ef07aee 100644 --- a/src/backend/tests/utils.rs +++ b/src/backend/tests/utils.rs @@ -211,51 +211,6 @@ fn test_enable_audiounit_in_scope( } } -pub fn test_get_source_name(device: AudioObjectID, scope: Scope) -> Option { - test_get_source_data(device, scope).map(u32_to_string) -} - -pub fn test_get_source_data(device: AudioObjectID, scope: Scope) -> Option { - let address = AudioObjectPropertyAddress { - mSelector: kAudioDevicePropertyDataSource, - mScope: match scope { - Scope::Input => kAudioDevicePropertyScopeInput, - Scope::Output => kAudioDevicePropertyScopeOutput, - }, - mElement: kAudioObjectPropertyElementMaster, - }; - let mut size = mem::size_of::(); - let mut data: u32 = 0; - - let status = unsafe { - AudioObjectGetPropertyData( - device, - &address, - 0, - ptr::null(), - &mut size as *mut usize as *mut u32, - &mut data as *mut u32 as *mut c_void, - ) - }; - - // TODO: Can data be 0 when no error returns ? - if status == NO_ERR && data > 0 { - Some(data) - } else { - None - } -} - -fn u32_to_string(data: u32) -> String { - // Reverse 0xWXYZ into 0xZYXW. - let mut buffer = [b'\x00'; 4]; // 4 bytes for u32. - buffer[0] = (data >> 24) as u8; - buffer[1] = (data >> 16) as u8; - buffer[2] = (data >> 8) as u8; - buffer[3] = (data) as u8; - String::from_utf8_lossy(&buffer).to_string() -} - pub enum DeviceFilter { ExcludeCubebAggregateAndVPIO, IncludeAll,