Sounds

Talk about making games.

Sounds

Postby Hedfone » Wed Nov 01, 2006 9:15 pm

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.
User avatar
Hedfone
 
Posts: 174
Joined: Mon Jul 31, 2006 9:47 pm
Score: 2 Give a positive score

Postby makslane » Wed Nov 01, 2006 9:55 pm

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);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hedfone » Wed Nov 01, 2006 10:29 pm

:shock: .......Huh?
User avatar
Hedfone
 
Posts: 174
Joined: Mon Jul 31, 2006 9:47 pm
Score: 2 Give a positive score

Postby Novice » Thu Nov 02, 2006 8:57 am

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.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 0 guests

cron