In the PinMame altsound code (snd_alt.h) there is a function called "ducking_callback"
void CALLBACK ducking_callback(HSYNC handle, DWORD channel, DWORD data, void *user)
{
It is included in preparation to play a channel sound
BASS_ChannelSetSync(channel_1, BASS_SYNC_END | BASS_SYNC_ONETIME, 0, ducking_callback, 0);
My question is, when does this callback happen? The section of the code that makes this call proceeds to call to play the channel sound:
BASS_ChannelPlay(channel_1, 0);
Then proceeds to set the ducking value for channel 0:
if (psd.ducking[idx] > 0 && psd.ducking[idx] < min_ducking) {
float new_val;
min_ducking = psd.ducking[idx];
new_val = channel_0_vol*(float)((double)psd.ducking[idx] / 100.);
if (channel_0_vol != new_val)
BASS_ChannelSetAttribute(channel_0, BASS_ATTRIB_VOL, new_val);
}
What confuses me here is that we have a ducking_callback function which will modify the volume for channel 0, at some point, and we are also modifying it here after telling the driver to play a sound on channel 1. Depending on when that callback happens, this could be problematic. Is the above call to BASS_ChannelPlay() a blocking call? I'm assuming not, otherwise the ducking code right below it wouldn't affect music playing on channel 0 until AFTER the SFX has finished playing, and that callback would seem unnecessary
I appreciate any insight!
-G




Top








are all trademarks of VPFORUMS.