Dela via


AudioStateMonitor.SoundLevel Property

Definition

Gets a value indicating the current sound level of the audio streams being monitored by the AudioStateMonitor.

public:
 property SoundLevel SoundLevel { SoundLevel get(); };
SoundLevel SoundLevel();
public SoundLevel SoundLevel { get; }
var soundLevel = audioStateMonitor.soundLevel;
Public ReadOnly Property SoundLevel As SoundLevel

Property Value

A value indicating the current sound level of the monitored audio streams.

Remarks

The method you use to instantiate AudioStateMonitor determines which audio streams are monitored. The different factory methods of the AudioStateMonitor class allow you to monitor the level of audio streams based on their MediaCategory, AudioDeviceRole, the ID of the associated audio device, and whether the stream is capturing or rendering audio.

You can check the value of this property, to determine if a category of audio streams will be muted or have its volume lowered, before initiating audio capture or playback. You can register a handler for the SoundLevelChanged 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