Skip to content

Commit

Permalink
add some common props accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jan 12, 2025
1 parent 020bd0f commit 5f0ad90
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cidre/src/core_audio/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ impl Obj {
self.cf_prop(&PropSelector::NAME.global_addr())
}

pub fn model_name(&self) -> os::Result<arc::R<cf::String>> {
self.cf_prop(&PropSelector::MODEL_NAME.global_addr())
}

pub fn manufacturer(&self) -> os::Result<arc::R<cf::String>> {
self.cf_prop(&PropSelector::MANUFACTURER.global_addr())
}

pub fn serial_number(&self) -> os::Result<arc::R<cf::String>> {
self.cf_prop(&PropSelector::SERIAL_NUMBER.global_addr())
}

pub fn firmware_version(&self) -> os::Result<arc::R<cf::String>> {
self.cf_prop(&PropSelector::FIRMWARE_VERSION.global_addr())
}

pub fn class(&self) -> os::Result<Class> {
self.prop(&PropSelector::CLASS.global_addr())
}
Expand Down Expand Up @@ -1266,9 +1282,15 @@ impl AggregateDevice {
os::result_init(|ptr| unsafe { AudioHardwareCreateAggregateDevice(desc, ptr) })
}

#[doc(alias = "kAudioAggregateDevicePropertyComposition")]
pub fn composition(&self) -> os::Result<arc::R<cf::DictionaryOf<cf::String, cf::Type>>> {
self.cf_prop(&PropSelector::AGGREGATE_DEVICE_COMPOSITION.global_addr())
}

#[doc(alias = "kAudioAggregateDevicePropertyFullSubDeviceList")]
pub fn full_sub_device_list(&self) -> os::Result<arc::R<cf::ArrayOf<cf::String>>> {
self.cf_prop(&PropSelector::AGGREGATE_DEVICE_FULL_SUB_DEVICE_LIST.global_addr())
}
}

impl Drop for AggregateDevice {
Expand Down

0 comments on commit 5f0ad90

Please sign in to comment.