Sound Volume in Direct Sound 8

Started by
2 comments, last by Dominik_78 21 years, 4 months ago
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.
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."
"That's Tron. He fights for the users."
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."
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) );

This topic is closed to new replies.

Advertisement