Having separate volume control over multiple media sessions (Media Foundation)

Hello, I have a class that loads an audio file (wav/mp3) and play them, the class has IMFSimpleAudioVolume member initialized with MFGetSErvice for example:

IMFSimpleAudioVolume* pVolume;


I won't post entry class here since it's huge, but basically the class is a media session that plays a single file.

I create multiple objects of this class, each object representing an audio file that plays in same time as other files, the problem is that when I change master volume in one object (for one file) via IMFSimpleAudioVolume::SetMasterVolume the master volume changes the volume of other objects (files) too!

I need to have each object their own volume level independent of each other, so that if I change volume in one object it does not touch volume of other object. but currently it does when I call IMFSimpleAudioVolume::SetMasterVolume

How do I achieve that? is it possible to have master volume separate for each media session? for example having a master volume and volume control for separate media sessions.

Thank you a lot, any advice is welcome!
Last edited on
As always, read the docs.

To control the volume levels of individual channels, use the IMFAudioStreamVolume interface. The IMFAudioStreamVolume interface is supported by the SAR only.

Hope this helps.
Last edited on
Thanks a lot, that indeed worked!

even though the docs don't explicitly say IMFAudioStreamVolume is per stream volume control, just that it controls individual channels which is not the same IMO.
Registered users can post here. Sign in or register to post.