IAudioMeterInformation::GetChannelsPeakValues method

The GetChannelsPeakValues method gets the peak sample values for all the channels in the audio stream.


HRESULT GetChannelsPeakValues(
  [in]  UINT32 u32ChannelCount,
  [out] float  *afPeakValues


u32ChannelCount [in]

The channel count. This parameter also specifies the number of elements in the afPeakValues array. If the specified count does not match the number of channels in the stream, the method returns error code E_INVALIDARG.

afPeakValues [out]

Pointer to an array of peak sample values. The method writes the peak values for the channels into the array. The array contains one element for each channel in the stream. The peak values are numbers in the normalized range from 0.0 to 1.0.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return codeDescription

Parameter u32ChannelCount does not equal the number of channels in the audio stream.


Parameter afPeakValues is NULL.



This method retrieves the peak sample values for the channels in the stream. The peak value for each channel is recorded over one device period and made available during the subsequent device period. Thus, this method always retrieves the peak values recorded during the previous device period. To obtain the device period, call the IAudioClient::GetDevicePeriod method.

Parameter afPeakValues points to a caller-allocated float array. If the stream contains n channels, the channels are numbered 0 to n– 1. The method stores the peak value for each channel in the array element whose array index matches the channel number. To get the number of channels in the audio stream that are monitored by peak meters, call the IAudioMeterInformation::GetMeteringChannelCount method.


Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]



See also

IAudioMeterInformation Interface



Community Additions

© 2015 Microsoft