You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 (eachsession) {
IAudioSessionEnumerator::GetSessionIAudioSessionControl::GetState#if the state is anything but "active", skip to the next sessionQIIAudioSessionControltoIAudioSessionControl2IAudioSessionControl2::GetSessionIdentifierQIIAudioSessionControltoIAudioMeterInformationIAudioMeterInformation::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.
The text was updated successfully, but these errors were encountered:
I don't know why the windows api is divided into so many little bits, but I would guess it's to keep backward compatibility since the apis have been expanded many times over the years.
I would be happy to accept a PR for this. I prefer to stay close to the windows apis and keep the separate things separate, this keeps things simple and it's easy to refer to the Microsoft docs for each separate IAudioSessionControlX etc.
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
andIAudioSessionEnumerator
for each device. I'd also like to check session activity soIAudioSessionControl2
andIAudioMeterInformation
would be of interest as well. Taking pseduo code from Matthew van Eerde:I think keeping related interfaces (e.g.
IAudioSessionManager
andIAudioSessionManager2
) 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.
The text was updated successfully, but these errors were encountered: