Directshow, how to set volume?

Started by
2 comments, last by johnnyBravo 19 years, 12 months ago
Hi, all my attempts at setting volume in my directshow music player have failed. Could anyone please post me some code or suggestions, thanks!
Advertisement
Query for a IBasicAudio interface from the graph builder.


m_pGraphBuilder->QueryInterface( IID_IBasicAudio, reinterpret_cast( &m_pBasicAudio ) )


With this interface you can simply change the volume by doing:

m_pBasicAudio->put_Volume( iVolumeRange[dwVolume] );

Careful, put_Volume uses dB in the range of 0 to -10000. You can also set the panning with put_Balance.
Don''t forget to release the interface again.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

i made a class that includes the interface, and it is released when the class is destroyed.

Is that an ok way of releasing it?
I guess so. As long as you do Release on it like with any other COM interface (DirectX interfaces).

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement