Search code examples
volumeaudiodirectx-9directsound

How to adjust a sound clip's volume in real time using DShow.h and strmiids.lib with C++


I am trying to figure out how to set the volume in in real time that my sound clips play at in my C++ program, and do things like make the volume of the sound increase as 2 objects move closer to one another. Right now, I am using "DShow.h" as well as "strmiids.lib", and I am using the interface provided by the following data member pointers:

IGraphBuilder* m_graphBuilder;

IMediaControl* m_mediaControl;

IMediaEvent*   m_mediaEvent;

IMediaSeeking* m_mediaSeeking;

Using the interface provided by these, is there a way to alter the volume of the media stream playing?


Solution

  • Have a look at the IBasicAudio interface.