Page 1 of 1

Help w/ sound...

PostPosted: Mon Dec 20, 2004 9:54 pm
by willg101
hey, anyone here know how to use the sound functions?
i don't get what the documentation means when it says 'void setVolume: channel... blah blah blah'
anyone get how to use 'setVolume' 'setPan' 'Stop Sound'?

PostPosted: Mon Dec 20, 2004 11:26 pm
by makslane
If you can just play a sound file or a music, use the
Play Sound and Play Music actions

right, but...

PostPosted: Mon Dec 20, 2004 11:32 pm
by willg101
right, but i would like to change these setting in-game!

PostPosted: Tue Dec 21, 2004 5:23 am
by jazz_e_bob
Example:

Add a global integer variable called "mySoundChannel".

Using:
mySoundChannel = PlaySound2( soundPath, volume, loop, pan);

You can now use:
setPan(mySoundChannel, pan)
setVolume(mySoundChannel, volume)
stopSound(mySoundChannel)

Image

ok

PostPosted: Tue Jan 25, 2005 11:51 pm
by willg101
ok..
I've got the variable:
sf1=PlaySound2("F:\\mem verse.wav", 1.000000, 1, 0.000000);

but when I do:

setPan.("sf1" , ".5");

I've done an "illegal stucture operation"

PostPosted: Wed Jan 26, 2005 12:31 am
by jazz_e_bob
Whoah. You need a sound demo to play with.

:)

http://www.artsystems.com.au/game%20editor/sonic%20invaders.zip

Use left and right arrow keys.

Up to shoot.

Can't shoot again until bullet destroyed.

Too easy? Turn you monitor off and play using sound alone.

Re: ok

PostPosted: Wed Jan 26, 2005 12:24 pm
by makslane
willg101 wrote:setPan.("sf1" , ".5");


Your sf1 variable must be an Integer (int) and in the setPan function you must use numerical values without quotes:

setPan(sf1, .5);

...

PostPosted: Sat Jan 29, 2005 5:39 pm
by willg101
OK...
Now how do you get it so that the sound doesn't play over and over when you change pan/volume?

Also-
Is it possible to use all variables like this:
Code: Select all
sf1=PlaySound2("var1", var2, var3, var4);


Never mind! :oops:
it works.

OK.
Now we reach another question:
pretending that "var1" is the file name(still focussing up there with that code), if I did:
Event Add->Mouse Button Up->Conditional Action->actor2.text=1->add-script editor->var1=f:\soundfile
would this work after I exported it?