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

Username:   Password: 
 RegisterRegister   
 HELP! I need to end a fork process for a long song!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CreatedByGabe




PostPosted: Fri Jun 05, 2015 6:32 pm   Post subject: HELP! I need to end a fork process for a long song!

Hi! I have a really big problem! I'm Making a game but the thing is that when I press "A" it need it to end the Process!
How do I end the fork process!
Here is my code, Take a look at it (I use turing 4.1 because 4.1.1 is not good at generating .exe's!)
Code:

var mus : string
mus := "TitleScreenMusic.mid"
var flag : boolean := true
process TitleScreenMusicFork
    if flag then
        loop
            Music.PlayFile (mus)
        end loop
    else
        loop
            Music.PlayFileStop
        end loop
    end if
end TitleScreenMusicFork

%Put music processes ABOVE! --------------------------------------------

put "Music %100 Loaded!"
delay (1000)
cls
Pic.Draw (mypic, maxx div 5, maxy div 5, 0)
fork TitleScreenMusicFork

getch (input)
if input = "a" or input = "A" then
    flag := false
    %fork TitleScreenMusicFork
    cls
    Music.PlayFile ("RealDing.wav")
end if
%Finish TILTLE SCREEN!
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Fri Jun 05, 2015 6:46 pm   Post subject: RE:HELP! I need to end a fork process for a long song!

There's an example of an interuptable looping song in the documentation for Music.PlayFileStop

Edit: You could also use Music.PlayFileLoop instead of doing the looping/forking yourself.
CreatedByGabe




PostPosted: Fri Jun 05, 2015 6:54 pm   Post subject: RE:HELP! I need to end a fork process for a long song!

Zren Wrote wrote:
There's an example of an interuptable looping song in the documentation for Music.PlayFileStop

Edit: You could also use Music.PlayFileLoop instead of doing the looping/forking yourself.


Thank you but I already found the soultion!
instead of
Code:

loop
Music.PlayFile
end loop


You put
Code:

Music.PlayFileLoop


Putting Music.PlayFileLoop would help because you can do
Code:

Music.PlayFileOff


to stop it!

Thanks Though But I already fixed the problem!
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  [ 3 Posts ]
Jump to:   


Style:  
Search: