Skip to main content
gamedev.net
🔒 Locked

Sound Volume in Direct Sound 8

Started by Dominik_78 2 replies 1k views
Original Post
Dominik_78
Dominik_78
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.
trondb
trondb
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."
"That's Tron. He fights for the users."
trondb
trondb
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."
"That's Tron. He fights for the users."
Dominik_78
Dominik_78
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) );

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.