Computer Science Canada Having trouble stoping a "fork" |
Author: | timtimpei [ Sat Jan 12, 2008 4:18 pm ] |
Post subject: | Having trouble stoping a "fork" |
i want to put music into my program, so i did this: Quote: finished := false process bgmusic (welcome_music : string) loop Music.PlayFile (welcome_music) exit when finished end loop end bgmusic procedure welcome_screen fork bgmusic ("bgmusic1.wav") (all my other codes) end welcome_screen welcome_screen then i want to play another music on another screen, so i did this: finished := false Quote: process bgmusic (welcome_music : string)
loop Music.PlayFile (welcome_music) exit when finished end loop end bgmusic procedure welcome_screen fork bgmusic ("bgmusic1.wav") (all my other codes) end welcome_screen procedure menu finished:=false fork bgmusic ("menusong.wav") (other codes) end menu welcome_screen finished:=true menu when i ran the program, the menu procedure played both songs. How can i prevent this without making another process? ![]() |
Author: | Clayton [ Sat Jan 12, 2008 4:35 pm ] |
Post subject: | RE:Having trouble stoping a "fork" |
Did you ensure your other music was stopped? Check into Music.Stop() |
Author: | Tony [ Sat Jan 12, 2008 5:27 pm ] | ||||
Post subject: | RE:Having trouble stoping a "fork" | ||||
The reason this doesn't work is that Music.PlayFile has a loop of it's own. This this out:
I think you were aiming at something along the lines of
Though I think Clayton has a more proper solution. |
Author: | ericfourfour [ Sat Jan 12, 2008 6:10 pm ] |
Post subject: | RE:Having trouble stoping a "fork" |
Play music: Music.PlayFileReturn("music file name") Stop music: Music.PlayFileStop Check the Music module section of the Turing Documentation. |