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

Username:   Password: 
 RegisterRegister   
 [Tutorial]How to use sound and music in Turing
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3, 4, 5
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dragon20942




PostPosted: Sun Jan 02, 2011 2:07 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

Ok thanks. O_O
Sponsor
Sponsor
Sponsor
sponsor
SirOwnYourFace




PostPosted: Tue Jan 18, 2011 7:40 pm   Post subject: Re: [Tutorial]How to use sound and music in Turing

Some mp3s wont play on turing D:..
Tony




PostPosted: Tue Jan 18, 2011 8:06 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

It could be encoded in a way that Turing doesn't understand. It could potentially help to re-encode the file with different settings, or export it into another supported format.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Feltie




PostPosted: Sat Jun 04, 2011 2:07 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

It wont work when i try to play the music straight from my turing folder Sad
Feltie




PostPosted: Sat Jun 04, 2011 2:51 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

im not sure which folder to put the file in. do i put it in turing 4.4.1, Support or Examples?
Tony




PostPosted: Sat Jun 04, 2011 3:01 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

You put it in the same folder as the source-code file that you are working with.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Raknarg




PostPosted: Sat Jun 04, 2011 4:29 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

Sometimes it could just be the length of the song. I'm not quite sure if this is right, but i've found that with songs that are over 4 minutes, a lot of them don't work.
danthedevil3




PostPosted: Fri Sep 13, 2013 8:28 pm   Post subject: (No subject)

JayLo @ Thu Jun 19, 2003 5:58 pm wrote:
rawr. cdplayer.
code:
import GUI
var cdWindow : int := Window.Open ("graphics:900;300")
var cdBack : int := Pic.FileNew ("cdBack.jpg")
var streamNumber : int
var fileName : string
var maxTracks : int := 0
var cdDrive : string
var track : int := 1
var currentTrack : string := "cd:" + intstr (track)
var fontID : int := Font.New ("verdana:10")
var playPic : int := Pic.FileNew ("play.jpg")
var stopPic : int := Pic.FileNew ("stop.jpg")
var nextPic : int := Pic.FileNew ("next.jpg")
var prevPic : int := Pic.FileNew ("previous.jpg")
var playButton : int
var stopButton : int
var nextTrack : int
var previousTrack : int
var quitButton : int
var playing : boolean := false
var cdDriveField, cdDriveLabel : int
var trackID : int := Font.New ("verdana:30")

process playTrack
    Music.PlayFile (currentTrack)
end playTrack

procedure playMusic
    playing := true
    fork playTrack
end playMusic

procedure stopMusic
    Music.PlayFileStop
    playing := false
end stopMusic

procedure next
    Music.PlayFileStop
    if track = maxTracks then
        track := maxTracks
        Draw.FillBox (340, maxy div 2 - 30, 340 + Font.Width ("Track: " + intstr (track), trackID), maxy div 2 + 40, darkgrey)
        Font.Draw ("Track: " + intstr (track), 340, maxy div 2 - 30, trackID, 43)
    else
        track += 1
        Draw.FillBox (340, maxy div 2 - 30, 340 + Font.Width ("Track: " + intstr (track), trackID), maxy div 2 + 40, darkgrey)
        Font.Draw ("Track: " + intstr (track), 340, maxy div 2 - 30, trackID, 43)
    end if
    currentTrack := "cd:" + intstr (track)
    if playing then
        fork playTrack
    else
    end if
end next

procedure previous
    Music.PlayFileStop
    if track = 1 then
        track := 1
        Draw.FillBox (340, maxy div 2 - 30, 340 + Font.Width ("Track: " + intstr (track), trackID), maxy div 2 + 40, darkgrey)
        Font.Draw ("Track: " + intstr (track), 340, maxy div 2 - 30, trackID, 43)
    else
        track -= 1
        Draw.FillBox (340, maxy div 2 - 30, 340 + Font.Width ("Track: " + intstr (track), trackID), maxy div 2 + 40, darkgrey)
        Font.Draw ("Track: " + intstr (track), 340, maxy div 2 - 30, trackID, 43)
        currentTrack := "cd:" + intstr (track)
    end if
    if playing then
        fork playTrack
    else
    end if
end previous

procedure closeWindow
    quit
end closeWindow

procedure error (text : string)
    GUI.Dispose (cdDriveField)
    GUI.Dispose (cdDriveLabel)
    var key : string (1)
    Font.Draw (text, 340, maxy div 2, trackID, 43)
    Font.Draw ("Press Any Key", 360, maxy div 2 - 30, fontID, 43)
    getch (key)
    quit
end error

procedure inputText (text : string)
    if text = "c" or text = "C" then
        error ("That's not the cd drive.")
    else
        var dirCheck : int
        dirCheck := Dir.Open (text + ":\\")
        if dirCheck = 0 then
            error ("Drive Does Not Exist")
            closeWindow
        else
            streamNumber := Dir.Open (text + ":")
            fileName := Dir.Get (streamNumber)
            if index (fileName (* -4 .. *), ".cda") not= 0 then
                loop
                    fileName := Dir.Get (streamNumber)
                    exit when fileName = ""
                    maxTracks += 1
                end loop
                Dir.Close (streamNumber)
                GUI.Dispose (cdDriveField)
                GUI.Dispose (cdDriveLabel)
                Pic.Draw (cdBack, 0, 0, picMerge)
                Draw.FillBox (340, maxy div 2 - 30, 340 + Font.Width ("Track: " + intstr (track), trackID), maxy div 2 + 40, darkgrey)
                Font.Draw ("Track: " + intstr (track), 340, maxy div 2 - 30, trackID, 43)
                playButton := GUI.CreatePictureButtonFull (120, 100, playPic, playMusic, 0, 0, "'", true)
                stopButton := GUI.CreatePictureButtonFull (600, 100, stopPic, stopMusic, 0, 0, "'", true)
                nextTrack := GUI.CreatePictureButtonFull (120, 50, nextPic, next, 0, 0, "/", true)
                previousTrack := GUI.CreatePictureButtonFull (600, 50, prevPic, previous, 0, 0, "/", true)
                quitButton := GUI.CreateButtonFull (360, 10, 0, "Quit", closeWindow, 0, "/", true)
            else
                error ("Invalid CD in Drive " + text + ":\\.")
            end if
            Dir.Close (dirCheck)
        end if
    end if
end inputText

procedure startScreen
    Pic.Draw (cdBack, 0, 0, picMerge)
    cdDriveField := GUI.CreateTextFieldFull (maxx div 2 + 100, 230, 100, "", inputText, GUI.INDENT, fontID, GUI.ANY)
    cdDriveLabel := GUI.CreateLabelFull (maxx div 2, 230, "CD Drive: ", 0, 0, GUI.LEFT, fontID)
end startScreen
startScreen
loop
    exit when GUI.ProcessEvent
end loop


I get an error of, Illegal picture ID number '0'. (Probable cause: picture was not successfully created.).

Can someone tell me what is going on? I'm new to this on my first computer science classes in high school.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Sep 13, 2013 8:35 pm   Post subject: RE:[Tutorial]How to use sound and music in Turing

That means the image wasn't loaded. The most likely cause is that you do not have a copy of the image.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 5 of 5  [ 69 Posts ]
Goto page Previous  1, 2, 3, 4, 5
Jump to:   


Style:  
Search: