Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Music playing thru GUI
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chrispaks




PostPosted: Sun May 22, 2005 2:03 pm   Post subject: Music playing thru GUI

I want it to play Metallica - Fuel from a GUI, but I need help in making it work Wink

heres what I Got

Quote:

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?
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun May 22, 2005 2:07 pm   Post subject: (No subject)

GUI is strange. To make it run, you need to following at the end of your code:

Turing:

loop
  exit when GUI.ProcessEvent
end loop
MysticVegeta




PostPosted: Sun May 22, 2005 2:11 pm   Post subject: (No subject)

code:
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




PostPosted: Sun May 22, 2005 8:17 pm   Post subject: (No subject)

MysticVegeta wrote:
code:
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 Razz
Delos




PostPosted: Sun May 22, 2005 9:41 pm   Post subject: (No subject)

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




PostPosted: Mon May 23, 2005 9:32 am   Post subject: (No subject)

Making a different procedure can do it Laughing
code:
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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: