0
0

Hi,
this is my first attempt to add sound to my programs, and I was wondering what the right approach is to stop a looping sample.

I’m playing a looping sample with the FSOUND_PlaySound function with the FSOUND_FREE for the channel number.

I have found the FSOUND_StopSound but this one needs the channel number, which means that I can’t use the FSOUND_FREE.

So if I instead assign this sample to channel one. And then starts and stops it randomly. Does that mean that if I also want to play other sounds, nonlooping, randomly that they cant use the FSOUND_FREE either since they might then occupy channel one?

What I’m trying to do in other words is to play several nonlooping samples randomly and also start and stop a looping sound on command. What is the right way to do this?
Do I have to manage the channels myself in order to do this?

Leif…

  • You must to post comments
0
0

You should use FSOUND_FREE,
the play function then returns to you the channel number that fmod choose to play the sound in.
(chan = FSOUND_PlaySound(FSOUND_FREE, blabla))
If you store this number, you can later use it in the stop functions to stop that particular sound.
You should never use a value instead of FSOUND_FREE, unless it is really necessary for some reason.
You will have to manage the channels you started though.

  • You must to post comments
0
0

aaah,(feeling stupid). Thanks.
Somehow I missed that.

Leif…

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.