pub struct ObjectMap { /* private fields */ }Expand description
The object tree for one driver, materialised from its
DeviceSpec.
Holds the spec plus the AudioObjectIds assigned to the
device and its streams. Construct it with ObjectMap::new; the
framework builds one when the HAL first asks the plug-in for its
object tree, and the property dispatcher consults it on every
property call.
Implementations§
Source§impl ObjectMap
impl ObjectMap
Sourcepub fn new(spec: DeviceSpec) -> Self
pub fn new(spec: DeviceSpec) -> Self
Build the object tree for spec, assigning ids from
AudioObjectId::FIRST_DYNAMIC onwards.
The device takes the first id; the streams follow in input-then-output order, skipping a direction the device does not have.
Sourcepub fn spec(&self) -> &DeviceSpec
pub fn spec(&self) -> &DeviceSpec
The driver’s DeviceSpec.
Sourcepub const fn plugin_id(&self) -> AudioObjectId
pub const fn plugin_id(&self) -> AudioObjectId
The plug-in object’s id — always AudioObjectId::PLUGIN.
Sourcepub const fn device_id(&self) -> AudioObjectId
pub const fn device_id(&self) -> AudioObjectId
The device object’s id.
Sourcepub const fn stream_id(
&self,
direction: StreamDirection,
) -> Option<AudioObjectId>
pub const fn stream_id( &self, direction: StreamDirection, ) -> Option<AudioObjectId>
The id of the stream carrying direction, or None if the
device has no such stream.
Sourcepub fn stream_spec(&self, direction: StreamDirection) -> Option<StreamSpec>
pub fn stream_spec(&self, direction: StreamDirection) -> Option<StreamSpec>
The StreamSpec for direction, or None if the device
has no such stream.
Sourcepub fn resolve(&self, id: AudioObjectId) -> Option<Object>
pub fn resolve(&self, id: AudioObjectId) -> Option<Object>
Resolve an AudioObjectId to the Object it names, or
None if the id is not part of this tree.
Sourcepub fn contains(&self, id: AudioObjectId) -> bool
pub fn contains(&self, id: AudioObjectId) -> bool
true iff id is part of this tree.
Sourcepub fn all_ids(&self) -> Vec<AudioObjectId>
pub fn all_ids(&self) -> Vec<AudioObjectId>
Every AudioObjectId in the tree, in tree order: plug-in,
device, then streams.
Sourcepub fn owned_objects(
&self,
id: AudioObjectId,
scope: PropertyScope,
) -> Vec<AudioObjectId>
pub fn owned_objects( &self, id: AudioObjectId, scope: PropertyScope, ) -> Vec<AudioObjectId>
The objects id owns (its children in the tree), filtered to
scope.
- The plug-in owns the device. (The plug-in’s scope is always
PropertyScope::GLOBAL.) - The device owns its streams;
PropertyScope::INPUT/PropertyScope::OUTPUTnarrow the list to that direction,PropertyScope::GLOBALreturns both. - A stream owns nothing.
An id not in the tree, or a scope that does not apply, yields an empty list.
Sourcepub fn device_streams(&self, scope: PropertyScope) -> Vec<AudioObjectId>
pub fn device_streams(&self, scope: PropertyScope) -> Vec<AudioObjectId>
The device’s stream ids, filtered to scope.
PropertyScope::GLOBAL returns every stream (input first,
then output); PropertyScope::INPUT / PropertyScope::OUTPUT
return just that direction’s stream. Any other scope yields an
empty list.
Sourcepub fn owner_of(&self, id: AudioObjectId) -> Option<AudioObjectId>
pub fn owner_of(&self, id: AudioObjectId) -> Option<AudioObjectId>
The id of the object that owns id (its parent in the tree):
the device for a stream, the plug-in for the device,
AudioObjectId::UNKNOWN for the plug-in (it has no owner),
and None for an id not in the tree.