Page 1 of 1

Is there any way to stop only one sound coming from an

PostPosted: Wed Jan 24, 2007 8:22 pm
by Sgt. Sparky
actor? cus' I am makin' this music game where the notes can get held out, but... WQhen I do stop sound it stops all the sound when there are supposed to be more than one music note at a time :cry: any Ideas :) :o :D

PostPosted: Thu Jan 25, 2007 12:06 am
by irblinx
Probably not much use to you here but;

To prevent a sound being played in the first place you could use a variable for the sound volume (just for that one sound) and then adjust the volume level by altering the variable (i.e. make is 0 to turn the sound off)

Code: Select all
PlaySound2("data/yoursound.wav", soundVolume, 1, 0.000000);


Where soundVolume is a Global variable.

Not sure about altering it whilst it's being played though, :(

PostPosted: Thu Jan 25, 2007 1:09 am
by makslane

PostPosted: Fri Jan 26, 2007 9:35 pm
by Sgt. Sparky
But that does not work when you have 1 actor that makes 2-13 the sounds at the same time :(

PostPosted: Sat Jan 27, 2007 3:06 am
by makslane
Use the channel returned in the play funcions.

PostPosted: Sat Jan 27, 2007 3:07 pm
by Sgt. Sparky
could you please describe the code :D

PostPosted: Sat Jan 27, 2007 8:26 pm
by makslane
Create a variable (integer, actor) to hold the sound.
In the play function, use:

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


To stop this sound, just use:

Code: Select all
stopSound(channel);


If you need control more than one sound per actor, add more variables, or use an array.

PostPosted: Sat Jan 27, 2007 8:52 pm
by Sgt. Sparky
okay thank you! :D
(I think You are going to get a free new version of GE :wink: )
no wait! you made GE! :D
1+karma
EDIT: why do you not have an Icon?(Avatar)