Page 1 of 1

How to stop music?

PostPosted: Mon May 30, 2011 7:28 pm
by Clokio
Now when I press a button I want it to stop. What is it, and can it be done in script too?

Thanks

Re: How to stop music?

PostPosted: Mon May 30, 2011 8:23 pm
by schnellboot
you could have used the search function, but I did it for you
http://game-editor.com/forum/viewtopic.php?f=2&t=7495

Re: How to stop music?

PostPosted: Wed Jun 01, 2011 11:10 am
by sonicfire
Best is to define a global integer called "musicCh" or "soundCh".
Then when playing the music call it like this:

Code: Select all
soundCh = playSound2("soundfile",1,1,0);


If you want to stop it, use this anywhere in a script:
Code: Select all
stopSound(soundCh);


Hope that helps :)

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 1:15 am
by Game A Gogo
I think no one though about playing a 1ms long empty wav file once?

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 3:34 am
by Clokio
Game A Gogo wrote:I think no one though about playing a 1ms long empty wav file once?


Your right, I am probably the best dummy ever in the video game design-programmation. And I am a great asset to wherever community I stay :P . Cause when a game engine tweek their doc for dummy like me, they get alot of those, and they get better cause they suceed.

Ex: putting the moon defender as the first tutorial, it's quite not dummy proof.
The doc is great, focus on starters, but maybe in wrong order. I might give a word about it later.

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 6:25 am
by schnellboot
but caveman is dummy proof I assure you

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 6:47 am
by skydereign
Clokio wrote:
Game A Gogo wrote:I think no one though about playing a 1ms long empty wav file once?


Your right, I am probably the best dummy ever in the video game design-programmation. And I am a great asset to wherever community I stay :P . Cause when a game engine tweek their doc for dummy like me, they get alot of those, and they get better cause they suceed.

Ex: putting the moon defender as the first tutorial, it's quite not dummy proof.
The doc is great, focus on starters, but maybe in wrong order. I might give a word about it later.

There are a lot of users that share in your struggle. We are working on improving things, but it will take some time before any of the planned changes are made. Hang in there and keep up the good input.

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 7:34 am
by rykein
Game A Gogo wrote:I think no one though about playing a 1ms long empty wav file once?

what do you mena by this? you mean like if the sound finishes but then you go to stop it you could be stopping something else? if so sky told me awhile back of a way to prevent it. pretty much if i remember it correctly it was to create an array for the channels and then set the length in it. the view would call a function to lower the counts of the arrays which if 0 would not contain a sound. if that isnt im intrigued as to what you did mean.

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 10:52 am
by Clokio
schnellboot wrote:but caveman is dummy proof I assure you

I am sure you will suceed. There is already alot of good things on the the site. Ex: testimony, you get to know who the engine is for.

A trend on new beginer is they (like me) can't make the difference between what game they played and what it take to make them. That is why I did start with 3D, thinking I din't want to learn 2D. I din't know I had stuff to learn. I would lough at other people games and din't know how they did it. I find out that sometime it's more complicated than I tought it would be. I tested many engines that pretend to be easy, wow compare to what, they never tell. It was probably compared to build your own engine in c++. I actually know a guy that did it. Took him many years like 30.

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 8:23 pm
by Game A Gogo
rykein wrote:
Game A Gogo wrote:I think no one though about playing a 1ms long empty wav file once?

what do you mena by this? you mean like if the sound finishes but then you go to stop it you could be stopping something else? if so sky told me awhile back of a way to prevent it. pretty much if i remember it correctly it was to create an array for the channels and then set the length in it. the view would call a function to lower the counts of the arrays which if 0 would not contain a sound. if that isnt im intrigued as to what you did mean.

What you said sounds complicated so I'll go ahead and say it's not what he wanted lol He wanted his music (Music plays only on ONE channel, the first one) to stop, simple as that :) so playing an empty music will stop the music

Re: How to stop music?

PostPosted: Thu Jun 02, 2011 9:42 pm
by rykein
oh i thought you were talking sounds like sonicfire was. yeah that seems to be the only way feature request!