Peak indicators for individual programs on Windows 7

Is it possible to get maximum counter readings for individual programs in Windows 7, and if so, how?

Using WASAPI, you can capture all the sound of a system through a loopback device, but this does not distinguish between outputs from different programs. This question considers the possibility of capturing sound for one specified application, but the answers seem to be inappropriate when processing all programs that play audio separately. This should be possible because SndVol can do this, as shown in the image below. The question is, how is this done? Is this done using unexposed API calls, or is it really possible to achieve something like this via WASAPI?

enter image description here

Thanks.

+8
windows audio wasapi
source share
3 answers

You list the audio sessions and get the IAudioSessionControl interfaces (MSDN code snippet ). The missing part is that you can request the IAudioMeterInformation inteface from the IAudioSessionControl that you are already holding.

If the audio endpoint supports peak meters, you can get this interface and use IMeterInformation::GetPeakValue for individual sessions. And this is what SndVol supposedly does.

Here is the 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); 
+10
source share

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

0
source share

Here is another snapshot: IChannelAudioVolume :: GetChannelVolume . I followed the thread on MSDN from SndVol, and this is where I ended up. Cited from a web page: β€œThe GetChannelVolume method retrieves the volume level for the specified channel in an audio session.” You will need to write some software to extract the peak value from this stream. My quick guess would be to simply compare if the current value is greater than the last highest value. If so, then the current value becomes a peak.

CHEERS!

0
source share

All Articles