Newbie Asks: How do you load, play, stop, loop sound?

Non-platform specific questions.

Newbie Asks: How do you load, play, stop, loop sound?

Postby ggesterGamePro99 » Thu Apr 19, 2012 11:54 pm

There's a page out there it says you just do this

sfx=PlaySound2("data/ahit4.wav", 1.000000, 1, 0.000000);


Well that doesn't really tell me if that means it's assigning just the sound to the SFX or if it's playing the sound.


What i want to know basically is:
1. How do you load a sound?
2. How do you play a sound?
3 how do you stop a sound?
4. How do you loop a sound?(this is good for level music etc)
5. And how to change the volume level of the sound

The page i found just gives this example for the volume
"musicvol=.1;"

That really doesn't help me.. Does it mean the max is 1?? and what's the minimum?
i don't ge tit. ALso

it doesn't even tell me how i tie that musicvol variable to which sound.
Like let's sad i have two wounds.: sound1, sound2.

do i do this--> sound1.musicvol = 0;

or how?

BTW the page i saw is this one http://game-editor.com/Sound_and_Music
ggesterGamePro99
 
Posts: 44
Joined: Mon Apr 16, 2012 1:53 am
Score: 0 Give a positive score

Re: Newbie Asks: How do you load, play, stop, loop sound?

Postby skydereign » Fri Apr 20, 2012 1:06 am

Actually that does tell you that the sound is playing. If you read up on the PlaySound2 function, it plays a sound, and returns the channel the sound plays in. If you call a function in gE it will do what the function is supposed to do. Most functions happen to return something though, and that just takes advantage of that.
http://game-editor.com/docs/script_reference.htm

1. You can't load a sound in game. You can however load sounds into your game, which is done by clicking the PlaySound2 function.
2. PlaySound2.
3. stopSound.
4. gE has music and sounds. Both music and sound can be looped (read the parameter lists for both). If you set loop to 0, it will repeat until you stop it.
5. Again, the PlaySound2 and PlayMusic2 functions have that. Though there is also the musicvol function as well.
6. musicvol's range is 0.0-1.0.

And for future reference, the wiki right now isn't the best place to look. Searching the forums will usually get you the information you want. But the best resource so far is the script reference which I linked to above.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron