Want volume control on individual media file, not application-wide one. RRS feed

  • Question

  • I am migrating my own project which was coded base on DirectShow, converting them to media foundation.

    In DShow there is an interface IBasicAudio, having method put_Volume / set_Volume, can easily set / get volume per media file.

    But in case of MF, volume control becomes a mission impossible. Despite, compare with DShow, obtaining interfaces for volume control is more complicated, even I get the IMFSimpleAudioVolume interface, it works on application-wide manner, that is, exactly do the same thing as I tune the application volume in SndVol.exe. It is absolutely unacceptable for me, because I need to control the volume of different component within same application individually, such as mute (or decrease the amplitude of) the BGM playing using MF, but keeping have SEs playing using XAudio2, etc.

    I tried IMFAudioStreamVolume, but this seems indeed useless. (poorer than application-wide IMFSimpleAudioVolume)

    The question is, is there any way to do the same task as IBasicAudio::put_Volume in MF? If YES, please kindly also provide code examples if any; or if NO, please provide alternate solutions. (Keeping using DShow is a considerable solution, if this is the only one, although really not preferred to do so.)

    Wednesday, January 20, 2016 8:42 AM