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

Username:   Password: 
 RegisterRegister   
 Music help in a procedure
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
INFERNO2K




PostPosted: Thu Jun 05, 2003 6:38 pm   Post subject: Music help in a procedure

code:
procedure playsong
    put "What song would you like to listen to?"
    put "1: Master of Puppets"
    put "2: All Along the Watchtower"
    put "3: E1M1"
    get song

    if song = "1" then
        Music.PlayFile ("mop.mid")
    elsif song = "2" then
        Music.PlayFile ("watchtower.mid")
    elsif song = "3" then
        Music.PlayFile ("e3m3.mid")
    end if

end playsong

playsong


After the user selects a song I want my program to carry on instead of playing the entire song before continuing. How might I be able to do so?
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Thu Jun 05, 2003 6:41 pm   Post subject: (No subject)

use process, look it up under the turing reference/help manual, it allow you to play background music.
INFERNO2K




PostPosted: Thu Jun 05, 2003 6:43 pm   Post subject: (No subject)

Im not quite sure of what the code would look like.
AsianSensation




PostPosted: Thu Jun 05, 2003 6:46 pm   Post subject: (No subject)

there is a tutorial on the help section, but ok, i'll give u the code anyway.

first, declare a process

code:

process BackGroundMusic1
loop
 Music.PlayFile ("mop.mid")
end loop
end BackGroundMusic


when you want to play it, use fork

code:

    if song = "1" then
        fork BackGroundMusic1
    elsif song = "2" then
         fork BackGroundMusic2
    elsif song = "3" then
         fork BackGroundMusic3
    end if


and that should allow u to play music in the background.
INFERNO2K




PostPosted: Thu Jun 05, 2003 6:51 pm   Post subject: (No subject)

Awsome it worked. Cheers Very Happy
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  [ 5 Posts ]
Jump to:   


Style:  
Search: