Volume Control
Application-specific hotkeys for Windows
VolumeControl.CoreAudio.AudioDeviceManager Class Reference

Manages a list of AudioDevice instances and related events. More...

Inheritance diagram for VolumeControl.CoreAudio.AudioDeviceManager:
Collaboration diagram for VolumeControl.CoreAudio.AudioDeviceManager:

Public Member Functions

 AudioDeviceManager (DataFlow deviceDataFlow, MMDeviceEnumerator deviceEnumerator)
 Creates a new AudioDeviceManager instance. More...
 
 AudioDeviceManager (DataFlow deviceDataFlow)
 Creates a new AudioDeviceManager instance. More...
 
AudioDeviceFindDeviceByID (string deviceID, StringComparison comparisonType=StringComparison.Ordinal)
 Gets the AudioDevice instance associated with the given deviceID string. (MMDevice.ID) More...
 
AudioDeviceFindDeviceByMMDevice (MMDevice mmDevice)
 Gets the AudioDevice instance associated with the given mmDevice . More...
 
AudioDeviceGetDefaultDevice (DataFlow dataFlow, Role deviceRole)
 Gets the default device for the specified dataFlow & deviceRole . More...
 
void Dispose ()
 

Properties

IReadOnlyList< AudioDeviceDevices [get]
 Gets the list of AudioDevice instances. More...
 
DataFlow DeviceDataFlow [get, set]
 Gets the DataFlow type of the audio devices managed by this AudioDeviceManager instance. More...
 

Events

EventHandler< AudioDevice >? DeviceAddedToList
 Occurs when an AudioDevice was added to the Devices list for any reason. More...
 
EventHandler< AudioDevice >? DeviceRemovedFromList
 Occurs when an AudioDevice was removed from the Devices list for any reason. More...
 
EventHandler< AudioDevice >? DeviceStateChanged
 Occurs when an AudioDevice instance's state was changed. More...
 

Detailed Description

Manages a list of AudioDevice instances and related events.

The AudioDeviceManager class is responsible for managing the list of active audio devices and handling all events related directly to AudioDevice instances.

Constructor & Destructor Documentation

◆ AudioDeviceManager() [1/2]

VolumeControl.CoreAudio.AudioDeviceManager.AudioDeviceManager ( DataFlow  deviceDataFlow,
MMDeviceEnumerator  deviceEnumerator 
)

Creates a new AudioDeviceManager instance.

Parameters
deviceDataFlowThe DataFlow type of the devices that this AudioDeviceManager instance will manage. This cannot be changed later.
deviceEnumeratorThe MMDeviceEnumerator instance to use.

References VolumeControl.Log.FLog.Critical(), and VolumeControl.CoreAudio.AudioDeviceManager.DeviceDataFlow.

Here is the call graph for this function:

◆ AudioDeviceManager() [2/2]

VolumeControl.CoreAudio.AudioDeviceManager.AudioDeviceManager ( DataFlow  deviceDataFlow)

Creates a new AudioDeviceManager instance.

Parameters
deviceDataFlowThe DataFlow type of the devices that this AudioDeviceManager instance will manage. This cannot be changed later.

Member Function Documentation

◆ FindDeviceByID()

AudioDevice? VolumeControl.CoreAudio.AudioDeviceManager.FindDeviceByID ( string  deviceID,
StringComparison  comparisonType = StringComparison.Ordinal 
)

Gets the AudioDevice instance associated with the given deviceID string. (MMDevice.ID)

Parameters
deviceIDThe ID of the target device.
comparisonTypeThe StringComparison type to use when comparing ID strings.
Returns
The AudioDevice associated with the given deviceID if found; otherwise null.

Referenced by VolumeControl.CoreAudio.AudioDeviceManager.GetDefaultDevice().

Here is the caller graph for this function:

◆ FindDeviceByMMDevice()

AudioDevice? VolumeControl.CoreAudio.AudioDeviceManager.FindDeviceByMMDevice ( MMDevice  mmDevice)

Gets the AudioDevice instance associated with the given mmDevice .

Parameters
mmDeviceThe MMDevice instance associated with the target device.
Returns
The AudioDevice associated with the given mmDevice if found; otherwise null.

◆ GetDefaultDevice()

AudioDevice? VolumeControl.CoreAudio.AudioDeviceManager.GetDefaultDevice ( DataFlow  dataFlow,
Role  deviceRole 
)

Gets the default device for the specified dataFlow & deviceRole .

Parameters
dataFlowThe DataFlow of the target device.
deviceRoleThe Role of the target device.
Returns
The default AudioDevice instance if one was found; otherwise, null.

References VolumeControl.Log.FLog.Error(), and VolumeControl.CoreAudio.AudioDeviceManager.FindDeviceByID().

Referenced by VolumeControl.CoreAudio.AudioDeviceSelector.SelectDefaultDevice().

Here is the call graph for this function:
Here is the caller graph for this function:

Property Documentation

◆ DeviceDataFlow

DataFlow VolumeControl.CoreAudio.AudioDeviceManager.DeviceDataFlow
getset

Gets the DataFlow type of the audio devices managed by this AudioDeviceManager instance.

Referenced by VolumeControl.CoreAudio.AudioDeviceManager.AudioDeviceManager().

◆ Devices

Event Documentation

◆ DeviceAddedToList

EventHandler<AudioDevice>? VolumeControl.CoreAudio.AudioDeviceManager.DeviceAddedToList

Occurs when an AudioDevice was added to the Devices list for any reason.

◆ DeviceRemovedFromList

EventHandler<AudioDevice>? VolumeControl.CoreAudio.AudioDeviceManager.DeviceRemovedFromList

Occurs when an AudioDevice was removed from the Devices list for any reason.

Referenced by VolumeControl.CoreAudio.AudioDeviceSelector.AudioDeviceSelector().

◆ DeviceStateChanged

EventHandler<AudioDevice>? VolumeControl.CoreAudio.AudioDeviceManager.DeviceStateChanged

Occurs when an AudioDevice instance's state was changed.


The documentation for this class was generated from the following file: