Peak meters for individual programs on Windows 7 Peak meters for individual programs on Windows 7 windows windows

Peak meters for individual programs on Windows 7


You are enumerating audio sessions and getting IAudioSessionControl interfaces (MSDN code snippet). The missing part is that you can query IAudioMeterInformation inteface from IAudioSessionControl you are already holding.

If the audio endpoint supports peak meters, you will be able to obtain this interface, and use IMeterInformation::GetPeakValue for individual sessions. And this is what SndVol supposedly doing.

Here is a piece of code that does the thing:

CComPtr<IAudioSessionControl> pSessionControl;...CComQIPtr<IAudioMeterInformation> pMeterInformation = pSessionControl;FLOAT fPeakValue;pMeterInformation->GetPeakValue(&fPeakValue);_tprintf(_T("nSessionIndex %d, fPeakValue %.2f\n"), nSessionIndex, fPeakValue);


Looking at WASAPI there is an interface to capture audio from a given client, but I don't see any higher level interface for determining peak levels. You may need to write some code to do that, unless there is a library out there that someone has created to do some higher level audio work with this WASPI. CHEERS!


Here is another shot at it: IChannelAudioVolume::GetChannelVolume. I followed the thread on MSDN from SndVol, and this is where I ended up. Quoting from the web page: "The GetChannelVolume method retrieves the volume level for the specified channel in the audio session." You would have to write some software to extract the peak value from this stream. My quick guess would be just to compare if the current value is larger than the last largest value. If so, then the current value becomes the peak.

CHEERS!