-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hi Henrik,
I'd like to be able to list out all processes currently outputting audio. It looks like the best way to do this is to access the IAudioSessionManager2 and IAudioSessionEnumerator for each device. I'd also like to check session activity so IAudioSessionControl2 and IAudioMeterInformation would be of interest as well. Taking pseduo code from Matthew van Eerde:
CoCreate(IMMDeviceEnumerator);
IMMDeviceEnumerator::GetDefaultAudioEndpoint;
IMMDevice::Activate(IAudioSessionManager2);
IAudioSessionManager2::GetSessionEnumerator;
for (each session) {
IAudioSessionEnumerator::GetSession
IAudioSessionControl::GetState
#if the state is anything but "active", skip to the next session
QI IAudioSessionControl to IAudioSessionControl2
IAudioSessionControl2::GetSessionIdentifier
QI IAudioSessionControl to IAudioMeterInformation
IAudioMeterInformation::GetPeakValue
#Log the session identifier and the peak value
}I think keeping related interfaces (e.g. IAudioSessionManager and IAudioSessionManager2) separate helps from the point of view of sticking to the existing API, and cleaner handling cases where only one can instantiated (don't quite understand when/if that can happen). If that can be reliably combined though it would be quite nice. Do you know why so many of them are separated?
I'm happy to try implementing this in a few stages, but I wanted to check in first.