Compartir a través de


IAudioMeterInformation Interface

Previous Next

IAudioMeterInformation Interface

The IAudioMeterInformation interface represents a peak meter on an audio stream to or from an audio endpoint device. The client obtains a reference to the IAudioMeterInformation interface on an endpoint object by calling the IMMDevice::Activate method with parameter iid set to REFIID IID_IAudioMeterInformation.

If the adapter device that streams audio data to or from the endpoint device implements a hardware peak meter, the IAudioMeterInformation interface uses that meter to monitor the peak levels in the audio stream. If the audio device lacks a hardware peak meter, the audio engine automatically implements the peak meter in software, transparently to the client.

If a device has a hardware peak meter, a client can use the methods in the IAudioMeterInformation interface to monitor the device's peak levels in both shared mode and exclusive mode. If a device lacks a hardware peak meter, a client can use those methods to monitor the device's peak levels in shared mode, but not in exclusive mode. In exclusive mode, the client and the device exchange audio data directly, bypassing the software peak meter. In exclusive mode, a software peak meter always reports a peak value of 0.0.

To determine whether a device has a hardware peak meter, call the IAudioMeterInformation::QueryHardwareSupport method.

For a rendering endpoint device, the IAudioMeterInformation interface monitors the peak levels in the output stream before the stream is attenuated by the endpoint volume controls. Similarly, for a capture endpoint device, the interface monitors the peak levels in the input stream before the stream is attenuated by the endpoint volume controls.

The peak values reported by the methods in the IAudioMeterInformation interface are normalized to the range from 0.0 to 1.0. For example, if a PCM stream contains 16-bit samples, and the peak sample value during a particular metering period is –8914, then the absolute value recorded by the peak meter is 8914, and the normalized peak value reported by the IAudioMeterInformation interface is 8914/32768 = 0.272.

For a code example that uses the IAudioMeterInformation interface, see Peak Meters.

IAudioMeterInformation inherits from the IUnknown interface. In addition to the methods inherited from IUnknown, IAudioMeterInformation supports the following methods.

Method Description
GetChannelsPeakValues Gets the peak sample values for all the channels in the audio stream.
GetMeteringChannelCount Gets the number of channels in the audio stream that are monitored by peak meters.
GetPeakValue Gets the peak sample value for the channels in the audio stream.
QueryHardwareSupport Queries the audio endpoint device for its hardware-supported functions.

Requirements

Client: Windows Vista

Header: Include Endpointvolume.h.

See Also

Previous Next