Interface IAudioEndpointVolumeEvents
- Namespace
- AudioDeviceLib.CoreAudioApi
- Assembly
- AudioDeviceLib.dll
Receives volume and mute change notifications for a single audio endpoint. Implement this and pass the instance to RegisterVolumeNotification(IAudioEndpointVolumeEvents).
public interface IAudioEndpointVolumeEvents
Remarks
THREADING: this callback is raised by Windows Core Audio on an arbitrary, non-UI thread, and calls may arrive concurrently. Keep it fast and non-blocking, do your own synchronization when touching shared state, and marshal to a UI thread yourself if you need to update UI.
Each registered consumer is invoked independently: an exception thrown by one consumer does not prevent the others from receiving the notification. Exceptions are collected, converted to an HRESULT and returned to the audio engine rather than escaping into native code, which means they are not otherwise observable - prefer handling errors inside the callback.
The notification carries no endpoint identity, so a consumer that listens to several endpoints should register a distinct instance per AudioEndpointVolume and let each instance capture which endpoint it belongs to.
Methods
OnVolumeNotification(AudioVolumeNotificationData)
Called when the endpoint master volume, per-channel volume or mute state changes.
void OnVolumeNotification(AudioVolumeNotificationData data)
Parameters
dataAudioVolumeNotificationDataA snapshot of the endpoint's volume and mute state at the time of the change.
Remarks
Called on an arbitrary, non-UI thread.