From fd95691381676c3508e5efcbff3593567c77e6db Mon Sep 17 00:00:00 2001 From: Yury Date: Sun, 27 Oct 2024 13:40:19 +0300 Subject: [PATCH] More AudioObject api --- cidre/src/core_audio/hardware.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cidre/src/core_audio/hardware.rs b/cidre/src/core_audio/hardware.rs index 970e4000..13def7fd 100644 --- a/cidre/src/core_audio/hardware.rs +++ b/cidre/src/core_audio/hardware.rs @@ -94,6 +94,16 @@ impl core_audio::AudioObjId { }) } + #[doc(alias = "AudioObjectHasProperty")] + pub fn has_prop(&self, address: &AudioObjPropAddr) -> bool { + unsafe { AudioObjectHasProperty(*self, address) } + } + + #[doc(alias = "AudioObjectIsPropertySettable")] + pub fn is_prop_settable(&self, address: &AudioObjPropAddr) -> os::Result { + os::result_init(|res| unsafe { AudioObjectIsPropertySettable(*self, address, res) }) + } + #[doc(alias = "AudioObjectGetPropertyDataSize")] pub fn prop_size(&self, address: &AudioObjPropAddr) -> os::Result { let mut val = std::mem::MaybeUninit::uninit(); @@ -696,6 +706,14 @@ extern "C-unwind" { fn AudioObjectShow(objectId: AudioObjId); + fn AudioObjectHasProperty(objectId: AudioObjId, address: *const AudioObjPropAddr) -> bool; + + fn AudioObjectIsPropertySettable( + objectId: AudioObjId, + address: *const AudioObjPropAddr, + out_is_settable: *mut bool, + ) -> os::Status; + fn AudioObjectGetPropertyData( objectId: AudioObjId, address: *const AudioObjPropAddr, @@ -707,7 +725,7 @@ extern "C-unwind" { fn AudioObjectSetPropertyData( objectId: AudioObjId, - address: &AudioObjPropAddr, + address: *const AudioObjPropAddr, qualifier_data_size: u32, qualifier_data: *const c_void, data_size: u32, @@ -716,7 +734,7 @@ extern "C-unwind" { fn AudioObjectGetPropertyDataSize( objectId: AudioObjId, - address: &AudioObjPropAddr, + address: *const AudioObjPropAddr, qualifier_data_size: u32, qualifier_data: *const c_void, data_size: *mut u32,