I’m working on a 3D engine and I would like to play sound when I’m walking
on the grass, wood, …

But the problem is I need to modify my function for only playing the sound
if the chanel is not busy ?

Can you help me ?

Here’s my function for playing sound :

void Play_Sound(long Canal, int Sound, int Mode)

// Pointeur sur le son à jouer
FSOUND_SAMPLE   *Sound_To_Play = NULL;

// Le son à jouer
Sound_To_Play = FSOUND_Sample_Load(Canal, Nom_Sons[Sound], FSOUND_STEREO, 0);

// Paramètres du son à jouer
FSOUND_Sample_SetLoopMode(Sound_To_Play, Mode);             

// On joue le son
FSOUND_PlaySound(Canal, Sound_To_Play);

} // Fin de la fonction

And, my function for when I press a key, I play sound.

if ( buffer[DIK_B] & 0x80 )
Play_Sound(1, 1, FSOUND_LOOP_OFF);

How can I fix that for only playing the sound if the channel is not busy ?

  • You must to post comments

u can use the FSOUND_IsPlaying to check to see if it is playing, pass the channel u wish to enquire is playing as a argument. not sure the returns for C++ in VB its 0, not playing and 1 is.

Might be true, false for u C++ users.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.