Author |
Message |
Lekegolo killer
|
Posted: Thu Jan 08, 2009 1:48 pm Post subject: Play music as background music? |
|
|
hello good ppl of compsci can anyone tell me if i can take this music i ripped out of the submissions section and turn it into background music?
Turing: | %halo theme music%
loop
play(">2ef+gf+4a2gf+1e2b>c+dc+<4a>2c+<b2< b>dega1f+2egf+ef+d1e")
play("<<8eee>>1e<<8eee>>1f+<<8eee>>1g<<8eee>>1a8eaeag1f+")
play("<<8eee>>1e<<8eee>>1f+<<8eee>>1g<<8eee>>1a8eaeag1f+<")
end loop |
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Thu Jan 08, 2009 2:54 pm Post subject: RE:Play music as background music? |
|
|
run it as a process. Might not be efficient, but it works.
code: |
process music
%halo theme music%
loop
play(">2ef+gf+4a2gf+1e2b>c+dc+<4a>2c+<b2< b>dega1f+2egf+ef+d1e")
play("<<8eee>>1e<<8eee>>1f+<<8eee>>1g<<8eee>>1a8eaeag1f+")
play("<<8eee>>1e<<8eee>>1f+<<8eee>>1g<<8eee>>1a8eaeag1f+<")
end loop
end music
fork music
|
|
|
|
|
|
|
syntax_error
|
Posted: Thu Jan 08, 2009 4:28 pm Post subject: RE:Play music as background music? |
|
|
I maybe wrong, but I think the new version of turing have more music playing support so that you do not need to use fork. Check the F10 of the newer versions of turing or the turing walkthough
Fork is a no-no. |
|
|
|
|
|
Tony
|
Posted: Thu Jan 08, 2009 4:57 pm Post subject: RE:Play music as background music? |
|
|
The suggested implementation is to use Music.PlayFileReturn |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Nick
|
Posted: Thu Jan 08, 2009 5:35 pm Post subject: RE:Play music as background music? |
|
|
@syntax_error normally yes, avoid processes, but in this case, no, it's the only solution
@Tony that only accepts a music file, not support of the play procedure, and IIRC it makes use of processes
the only way to run background music in Turing is via a process |
|
|
|
|
|
Tony
|
Posted: Thu Jan 08, 2009 5:50 pm Post subject: RE:Play music as background music? |
|
|
@Nick -- you are right, I think PlayFileReturn is an equivalent of the fork'ed syntax. It's just cleaner to write.
Since the notes being played are static, they could be put into an external program and compiled to a music file to be played. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Nick
|
Posted: Thu Jan 08, 2009 5:56 pm Post subject: RE:Play music as background music? |
|
|
a quick look proves the process
code: | var playFileStopped : int := 0
process PlayFileLoopProc (fileStr : string)
external function error_last : int
var startPlayFileStopped : int := playFileStopped
loop
PlayFile (fileStr)
exit when error_last not= 0
exit when startPlayFileStopped not= playFileStopped
end loop
end PlayFileLoopProc
...
procedure PlayFileReturn (fileStr : string)
fork PlayFileReturnProc (fileStr)
end PlayFileReturn
|
|
|
|
|
|
|
Lekegolo killer
|
Posted: Sat Jan 10, 2009 1:21 pm Post subject: RE:Play music as background music? |
|
|
I am going to admit that i am a programing noob and i have no idea what half of what you guys are saying means, im just gunna copy and paste this code untill i find a bit that works. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
ecookman
|
Posted: Sat Jan 10, 2009 5:10 pm Post subject: RE:Play music as background music? |
|
|
basically youneed to create a process that makes the sound
if you have turing 4.1
you don't need the processes...therre is a function that does it...but i can't remember what it is .... use f10 |
|
|
|
|
|
andrew.
|
Posted: Sun Jan 11, 2009 12:24 am Post subject: RE:Play music as background music? |
|
|
@ecookman: That command (Music.PlayFileReturn) has already been said and it can't work because he/she is playing notes not an actual music file. He/she has to use processes to play music in the background. Also, you don't need Turing 4.1 to do processes. You can do it with the older 4.0.x versions. I haven't used any Turing older than that but I suppose it is supported there too.
@OT: Here is how you use a process:
Turing: | process playMusic
Music.Play ("CEG") %Put the notes for your song here
end playMusic
fork playMusic
% The rest of your program.
|
|
|
|
|
|
|
Lekegolo killer
|
Posted: Mon Jan 12, 2009 1:09 pm Post subject: RE:Play music as background music? |
|
|
thx guys!!!!! |
|
|
|
|
|
|