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

Username:   Password: 
 RegisterRegister   
 Playing music while displaying an animation
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
illu45




PostPosted: Sun Mar 13, 2005 1:28 pm   Post subject: Playing music while displaying an animation

Hello all...

I'm trying to make a dancing guy while playing music. I've managed to make the dancing guy, but if I plug in the code for music, the animation doesn't start until the music is finished... As I don't think Turing has multi-threading, I guess I'm kinda screwed, but I figure I'd ask first... Here's my code so far (without the music command)
code:

var i, row, col : int := 1
i := 1
locatexy (290, 190)
put "Get up!"
delay (750)
cls
locatexy (280, 190)
put "Get on up!"
delay (750)
cls
locatexy (290, 190)
put "Get up!"
delay (750)
cls
locatexy (280, 190)
put "Get on up!"
delay (750)
cls
locatexy (280, 190)
put "And DANCE!"
delay (750)
cls


put ":D-<"
loop
    if i = 1 then
        delay (100)
        cls
        locate (row, col)
        put ":D|-<"
        row := row + 1
        if row > 25 then
            col := col + 10
            row := 1
        end if
        if col > maxcol then
            col := 1
            row := 1
        end if
        i := 2
    elsif i = 2 then
        delay (100)
        cls
        locate (row, col)
        put ":D/-<"
        row := row + 1
        if row > 25 then
            col := col + 10
            row := 1
        end if
        if col > maxcol then
            col := 1
            row := 1
        end if
        i := 1
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Mar 13, 2005 2:04 pm   Post subject: (No subject)

silly illu45 Rolling Eyes reading documentation is your friend. You can ether make a new thread with process / fork or just use Music.PlayFileReturn() (I think that's the command, check F10) that will create a new thread for you.
illu45




PostPosted: Sun Mar 13, 2005 2:36 pm   Post subject: (No subject)

Oh.. whoops Embarassed . I looked at the documentation, it works now... Thanks Smile

Here's the code, if someone wants it:
code:

var i, row, col : int := 1
i := 1
locatexy (290, 190)
put "Get up!"
delay (750)
cls
locatexy (280, 190)
put "Get on up!"
delay (750)
cls
locatexy (290, 190)
put "Get up!"
delay (750)
cls
locatexy (280, 190)
put "Get on up!"
delay (750)
cls
locatexy (280, 190)
put "And DANCE!"
delay (750)
cls
process music
    Music.PlayFileLoop ("Music.MP3")
end music
process dance
    put ":D-<"
    loop
        if i = 1 then
            delay (100)
            cls
            locate (row, col)
            put ":D|-<"
            row := row + 1
            if row > 25 then
                col := col + 10
                row := 1
            end if
            if col > maxcol then
                col := 1
                row := 1
            end if
            i := 2
        elsif i = 2 then
            delay (100)
            cls
            locate (row, col)
            put ":D/-<"
            row := row + 1
            if row > 25 then
                col := col + 10
                row := 1
            end if
            if col > maxcol then
                col := 1
                row := 1
            end if
            i := 1
        end if
    end loop
end dance
fork music
fork dance


Feel free to use your own music, I used 'One more Time' Very Happy.
[Gandalf]




PostPosted: Sun Mar 13, 2005 3:27 pm   Post subject: (No subject)

Looking at your code, you need MUSIC.mp3 for anything to play.

But I've never seen a stickman done like that, thanks Laughing
illu45




PostPosted: Sun Mar 13, 2005 5:41 pm   Post subject: (No subject)

Glad you liked it... It was inspired by (ripped off of) This bash.org Quote:

http://www.bash.org/?4281
<Zybl0re> get up
<Zybl0re> get on up
<Zybl0re> get up
<Zybl0re> get on up
<phxl|paper> and DANCE
* nmp3bot dances Very Happy-<
* nmp3bot dances Very Happy|-<
* nmp3bot dances Very Happy/-<
<[SA]HatfulOfHollow> i'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
ssr




PostPosted: Sun Mar 13, 2005 8:28 pm   Post subject: (No subject)

nice
lol funny
post ur music too eh Very Happy
illu45




PostPosted: Mon Mar 14, 2005 10:02 am   Post subject: (No subject)

Hmm.. I'm having some trouble uploading the file (It's about 8 MBs in size, which is below the limit...) Any ideas? Here's the error message:

Upload Error: Could not upload Attachment to ./../bbs/files/music.zip.
Tony




PostPosted: Mon Mar 14, 2005 10:07 am   Post subject: (No subject)

illu45 wrote:
It's about 8 MBs in size, which is below the limit...

actually your limit (same as any other new user) is 2MB Confused I could upgrade that for you as needed, but I'm questioning your 8MB music uploads Thinking
Sponsor
Sponsor
Sponsor
sponsor
illu45




PostPosted: Mon Mar 14, 2005 11:47 am   Post subject: (No subject)

Ah... All right... Um, no need to upgrade my storage capacity yet... The file is large, probably becasue its pretty long (6:07 mins)... I'll see if I can get a smaller version (a sample).

EDIT: All right, I found a sample of another song that seems to work pretty well... Here it is:



Music.zip
 Description:

Download
 Filename:  Music.zip
 Filesize:  231.29 KB
 Downloaded:  110 Time(s)

atrain




PostPosted: Wed Mar 16, 2005 6:54 pm   Post subject: (No subject)

it should go:

: D /-<
: D |-<
: D \-<

clearly about to see...
atrain




PostPosted: Wed Mar 16, 2005 6:56 pm   Post subject: (No subject)

hmm never mind crashed when i tried... stupid turing
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: