Page 1 of 1

Sounds

PostPosted: Wed Nov 01, 2006 9:15 pm
by Hedfone
is there a way to tell what channel a sound is being played on?
I want to stop a rain soundeffect when my player touches a trigger but I don't know what channel yje sound is on.

PostPosted: Wed Nov 01, 2006 9:55 pm
by makslane
Get the channel used to play the sound that you wants to stop.
Create a channel variable (integer) to get the value:

Code: Select all
channel = PlaySound2("data/explode.wav", 1, 1, 0);

PostPosted: Wed Nov 01, 2006 10:29 pm
by Hedfone
:shock: .......Huh?

PostPosted: Thu Nov 02, 2006 8:57 am
by Novice
Create an integer variable called whatever you want it to be, in this case "channel".
When playing the sound use
Code: Select all
channel = PlaySound2("data/explode.wav", 1, 1, 0);

This way you assign the wav sound to that channel (variable).
When you want to stop that sound just use
Code: Select all
stopSound(channel);

and don't use quotation marks as "channel" is a variable.