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

Username:   Password: 
 RegisterRegister   
 how to kill a proccess
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lufthansa747




PostPosted: Thu Oct 28, 2010 9:05 pm   Post subject: how to kill a proccess

hi i am running the newest turing version and i would like to know how to kill a process. i have backround music but i would like to know how to stop it. please help
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Fri Oct 29, 2010 12:02 am   Post subject: Re: how to kill a proccess

I'm assuming you just want to know how to stop music, and not how to stop a process in general.

Music.PlayFileStop will stop all currently playing music.
If have multiple music files playing at the same time, playing an empty file with the same extension as the music you want to stop will stop only that music process.
lufthansa747




PostPosted: Fri Oct 29, 2010 2:59 pm   Post subject: Re: how to kill a proccess

TheGuardian001 @ Fri Oct 29, 2010 12:02 am wrote:
I'm assuming you just want to know how to stop music, and not how to stop a process in general.

Music.PlayFileStop will stop all currently playing music.
If have multiple music files playing at the same time, playing an empty file with the same extension as the music you want to stop will stop only that music process.


i am not playing music from a file this is waht code looks like

process PlayMusic (playMusic:boolean)
loop
if playMusic = true then
Music.Play ("4bb-bg+bb-bg+bb-bf+bb-bf+b-g+b-f+b-g+b-f+b-g+b-f+b-g+b-f+4bb-bg+bb-bg+bb-bf+bb-bf+b-g+b-f+b-g+b-f+b-g+b-f+b-g+b-f+")
for i : 1 .. 2
%delay (200)
Music.Play ("4e-f+1g+")
Music.Play ("4e-ee-2f+1e-")
%delay (200)
Music.Play ("4e-2f+1e-4e-1c+")
end for
end Play Music

fork PlayMusic(true)

how can i get it to stop playing
lufthansa747




PostPosted: Mon Nov 01, 2010 4:55 pm   Post subject: Re: how to kill a proccess

does anyone know how to stop the above example
TheGuardian001




PostPosted: Mon Nov 01, 2010 5:17 pm   Post subject: Re: how to kill a proccess

Put an exit condition inside of it.
You currently have an infinite loop. If you put an exit when X inside, then it will exit as soon as you make that condition true.
lufthansa747




PostPosted: Wed Nov 03, 2010 6:57 pm   Post subject: Re: how to kill a proccess

TheGuardian001 @ Mon Nov 01, 2010 5:17 pm wrote:
Put an exit condition inside of it.
You currently have an infinite loop. If you put an exit when X inside, then it will exit as soon as you make that condition true.


if i use an exit when statement first i would have to put it after every line and second it would not exit until it has finished playing that line. how do i get around that or is there a different exit statement to use
mirhagk




PostPosted: Fri Nov 05, 2010 2:10 pm   Post subject: RE:how to kill a proccess

I wonder if calling a second Music.Play with empty notes would cancel the current playing one. combine that with exit statements and it could provide you with a hackjob way around it
SNIPERDUDE




PostPosted: Fri Nov 05, 2010 4:59 pm   Post subject: RE:how to kill a proccess

No, I think that will just run (if it can with no notes) after the current one is done playing. There is a stop command if I remember right, no need for a hack way around it.
Sponsor
Sponsor
Sponsor
sponsor
lordroba




PostPosted: Thu Nov 11, 2010 10:22 pm   Post subject: Re: how to kill a proccess

if done a few test and even with an exit condition inside one or more loops it will continue playing the sound until it has finished. One possible solution that I can see is having the whole process run inside a master "for" loop with a upper bound as a flexible array. In your main program you have a variable that increases by 1 or whatever number each time. When you want to stop the music, you simply stop increasing the value of the upper bound and the music in the process will stop when it reaches that number.
CreatedByGabe




PostPosted: Fri Jun 05, 2015 5:24 pm   Post subject: RE:how to kill a proccess

TheGuardian001 @ Fri Oct 29, 2010 12:02 am wrote:
I'm assuming you just want to know how to stop music, and not how to stop a process in general.

Music.PlayFileStop will stop all currently playing music.
If have multiple music files playing at the same time, playing an empty file with the same extension as the music you want to stop will stop only that music process.


This in not true! I am making a program that has a Fork process but Music.PlayFileStop does not end the Process, In stops it for like 15 Seconds!
CreatedByGabe




PostPosted: Fri Jun 05, 2015 6:27 pm   Post subject: RE:how to kill a proccess

Same Problem!
look, this is sopposed to work!

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!
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  [ 11 Posts ]
Jump to:   


Style:  
Search: