Dela via


AudioStateMonitor.SoundLevelChanged Event

Definition

Occurs when the system changes the sound level of the audio streams being monitored by the AudioStateMonitor.

// Register
event_token SoundLevelChanged(TypedEventHandler<AudioStateMonitor, IInspectable const&> const& handler) const;

// Revoke with event_token
void SoundLevelChanged(event_token const* cookie) const;

// Revoke with event_revoker
AudioStateMonitor::SoundLevelChanged_revoker SoundLevelChanged(auto_revoke_t, TypedEventHandler<AudioStateMonitor, IInspectable const&> const& handler) const;
public event TypedEventHandler<AudioStateMonitor,object> SoundLevelChanged;
function onSoundLevelChanged(eventArgs) { /* Your code */ }
audioStateMonitor.addEventListener("soundlevelchanged", onSoundLevelChanged);
audioStateMonitor.removeEventListener("soundlevelchanged", onSoundLevelChanged);
- or -
audioStateMonitor.onsoundlevelchanged = onSoundLevelChanged;
Public Custom Event SoundLevelChanged As TypedEventHandler(Of AudioStateMonitor, Object) 

Event Type

Remarks

Windows dynamically mutes or lowers the level of audio streams in response to system events. For example, the volume of a podcast app's audio render stream may be lowered while an alarm is ringing. Or an audio recording app may have their capture stream muted when the app moves to the background. Register a handler for this event to receive notifications when the sound level for a category of audio streams changes, and then check the SoundLevel property to determine the new current audio level.

Applies to