
-----------------------------------
chrispaks
Sun May 22, 2005 2:03 pm

Music playing thru GUI
-----------------------------------
I want it to play Metallica - Fuel from a GUI, but I need help in making it work ;)

heres what I Got


proc PlayFuel
    Music.PlayFile ("Fuel.mp3")
end PlayFuel

%Music Buttons
    Fuel := GUI.CreateButton (5, 500 - 125, 120, "Fuel", PlayFuel)


Do I have to put a fork in or something?
OR do you need more code because im missing something?

EDIT: It works, but how do I get it to stop playing with a button thats designed to make it stop?

-----------------------------------
Delos
Sun May 22, 2005 2:07 pm


-----------------------------------
GUI is strange.  To make it run, you need to following at the end of your code:


loop
  exit when GUI.ProcessEvent
end loop


-----------------------------------
MysticVegeta
Sun May 22, 2005 2:11 pm


-----------------------------------
import GUI

procedure PlayFuel
    Music.PlayFileLoop ("Fuel.mid")
end PlayFuel

%Music Buttons
var Fuel := GUI.CreateButton (5, 500 - 125, 120, "Fuel", PlayFuel)
var qut := GUI.CreateButton (5, 300, 120, "STOP!", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop
Music.PlayFileStop


-----------------------------------
chrispaks
Sun May 22, 2005 8:17 pm


-----------------------------------
import GUI

procedure PlayFuel
    Music.PlayFileLoop ("Fuel.mid")
end PlayFuel

%Music Buttons
var Fuel := GUI.CreateButton (5, 500 - 125, 120, "Fuel", PlayFuel)
var qut := GUI.CreateButton (5, 300, 120, "STOP!", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop
Music.PlayFileStop


is there a way to make it stop, since im gonna have options of the program and stuff... its a huge thing where i need a button to stop it, not exit the program :P

-----------------------------------
Delos
Sun May 22, 2005 9:41 pm


-----------------------------------
Yes.  Since you've started the play with a Music. command, you can use another Music. command to stop it.  I believe it is Music.PlayFileStop().  Look it up.

-----------------------------------
MysticVegeta
Mon May 23, 2005 9:32 am


-----------------------------------
Making a different procedure can do it  :lol: 
import GUI

procedure PlayFuel
    Music.PlayFileLoop ("music/Fuel.mp3")
end PlayFuel

procedure stop
    Music.PlayFileStop
end stop

%Music Buttons
var Fuel := GUI.CreateButton (5, 500 - 125, 120, "Fuel", PlayFuel)
var sto := GUI.CreateButton (5, 325, 120, "Sound Stop", stop)
var qut := GUI.CreateButton (5, 350, 120, "Exit", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop
Music.PlayFileStop

