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);