Computer Science Canada

Music help in a procedure

Author:  INFERNO2K [ 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?

Author:  AsianSensation [ Thu Jun 05, 2003 6:41 pm ]
Post subject: 

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

Author:  INFERNO2K [ Thu Jun 05, 2003 6:43 pm ]
Post subject: 

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

Author:  AsianSensation [ Thu Jun 05, 2003 6:46 pm ]
Post 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.

Author:  INFERNO2K [ Thu Jun 05, 2003 6:51 pm ]
Post subject: 

Awsome it worked. Cheers Very Happy


: