Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dominik_78

Sound Volume in Direct Sound 8

This topic is 5730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using: IDirectMusicLoader8* g_pLoader; IDirectMusicPerformance8* g_pPerformance; IDirectMusicSegment8* g_pSegment; to play my midi file. -> works fine. how can I ajust the sound volume of Direct Sound at runtime? just a hint for a function name would be enough i hope.

Share this post


Link to post
Share on other sites
Advertisement
I assume you have an audiopath defined when you initialize DirectAudio9, like for instance

IDirectMusicAudioPath8 *path;

If so, simply add
pPerformance->GetDefaultAudioPath(&path)));
path->SetVolume(0,0);

Parameter 1 is the value for volume, where 0 is full, in the range [0..-9600]. Parameter 2 is duration in milliseconds for the volume-change. 0 = immediate.

You should of course add some errorchecking to this, like
if(ERROR(....

Hope this was what you were looking for,


"That''s Tron. He fights for the users."

Share this post


Link to post
Share on other sites
BTW you should be able to use path->setVolume during runtime if you make *path a global var. Let me know. Thanks,

"That''s Tron. He fights for the users."

Share this post


Link to post
Share on other sites
Thank you !

and yes it is possible to make modifications at runtime - but I found a function:

long value = -1000; // range from -20000 to 200

g_pPerformance->SetGlobalParam( GUID_PerfMasterVolume, (void*)&value, sizeof(long) );

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!