TGC Codebase Backup



Audio CD Player for Laszlo Zoltan ( only executable included ) by Anonymous Coder

7th Nov 2004 1:24
Summary

Audio CD player. Can play most,if not all, audio music tracks. Usage with arrow keys. Instructions: Downkey:Play-Stop. Upkey:Repeat audio CD. Leftkey:Backward track. Rightkey:Forwa



Description

All essential files included , but no documentation.
Working executable exists.

See next application.
Please feel free posting your tools.
May I please be forgiven for any bugs.
Thank you.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Project: Audio CD Player for Laszlo Zoltan
Rem Created: 4/11/2004 9:19:32 μμ

Rem ***** Main Source File *****


global Music_Number=1
global current_track=0
global proceed$="no"
global cd_tracks=0
global repeat$="Yes"
global status$="Stopped"

global rightkey$="free"
global leftkey$="free"
global upkey$="free"
global downkey$="free"

global rightkey_button=0
global leftkey_button=0
global upkey_button=0
global downkey_button=0

global rightkey_switch_button$="off"
global leftkey_switch_button$="off"
global upkey_switch_button$="off"
global downkey_switch_button$="off"

SET WINDOW ON
SET WINDOW TITLE "Audio CD Player for Laszlo Zoltan"
show window
MAXIMIZE WINDOW

audio_cd()

if (proceed$="yes")
   do
      cls
      cursor_reader()
      update_music_sequence()
      screen_info()
   loop
endif
end



function update_music_sequence()
if (status$="Playing")
   if (MUSIC PLAYING(Music_Number)=0)
      if (current_track <> cd_tracks)
         current_track=current_track+1
         loadandplay_audio_CD("play")
      endif
   endif
endif

if (status$="Playing")
   if (repeat$="Yes")
      if (current_track=cd_tracks)
         if (MUSIC PLAYING(Music_Number)=0)
            current_track=1
            loadandplay_audio_CD("play")
         endif
      endif
   endif
endif
endfunction


function locate_track(command$)
if (command$="forward")then:current_track=current_track+1
if (command$="backward")then:current_track=current_track-1
if (current_track<1)then:current_track=cd_tracks
if (current_track>cd_tracks)then:current_track=1
if (command$="play") then: loadandplay_audio_CD("play")
if (command$="stop") then: loadandplay_audio_CD("stop")
if (command$="loop") then: repeat_audio_CD("loop")
if (command$="noloop") then: repeat_audio_CD("noloop")
endfunction

function repeat_audio_CD(command$)
if (command$="loop")
   if (repeat$="No")
      repeat$="Yes"
   endif
endif

if (command$="noloop")
   if (repeat$="Yes")
      repeat$="No"
   endif
endif
endfunction


function loadandplay_audio_CD(command$)
delete music Music_Number
LOAD CDMUSIC current_track,Music_Number
if (command$="play")
   if (MUSIC PLAYING(Music_Number)=0)
      delete music Music_Number
      LOAD CDMUSIC current_track,Music_Number
      PLAY MUSIC Music_Number
      status$="Playing"
   endif
endif

if (command$="stop")
   if (MUSIC PLAYING(Music_Number)=0)
      stop music Music_Number
      status$="Stopped"
   endif
endif
endfunction

function audio_cd()
if (GET NUMBER OF CD TRACKS()=0)
   EXIT PROMPT "No audio CD.", "Error"
   proceed$="no"
else
   proceed$="yes"
   cd_tracks=GET NUMBER OF CD TRACKS()
   current_track=1
   LOAD CDMUSIC current_track,Music_Number

endif
endfunction



function screen_info()
set cursor 0,0:  print "CD Tracks: ",cd_tracks
set cursor 0,15: print "Current Track: ",current_track
set cursor 0,30: print "Repeat audio_cd: ",repeat$
set cursor 0,45: print "Status: ",status$
set cursor 0,60: print "SCANCODE: ",SCANCODE()

set cursor 0,75: print "Rightkey: ",rightkey$
set cursor 0,90: print "Rightkey button: ",rightkey_button
set cursor 0,105:print "Right switch: ",rightkey_switch_button$

set cursor 0,120:print "Leftkey: ",leftkey$
set cursor 0,135:print "Leftkey button: ",leftkey_button
set cursor 0,150:print "Left switch: ",leftkey_switch_button$

set cursor 0,165:print "Upkey: ",upkey$
set cursor 0,180:print "Upkey button: ",upkey_button
set cursor 0,195:print "Up switch: ",upkey_switch_button$

set cursor 0,210:print "Downkey: ",downkey$
set cursor 0,225:print "Downkey button: ",downkey_button
set cursor 0,240:print "Down switch: ",downkey_switch_button$
endfunction


function cursor_reader()

if (rightkey()=1)
   if (rightkey$="free")
      rightkey_button=rightkey_button+1
      if (rightkey_switch_button$="off")
         rightkey_switch_button$="on"
      else
         rightkey_switch_button$="off"
      endif
      locate_track("forward")
      rightkey$="lock"
   endif
endif

if (leftkey()=1)
   if (leftkey$="free")
   leftkey_button=leftkey_button+1
      if (leftkey_switch_button$="off")
         leftkey_switch_button$="on"
      else
         leftkey_switch_button$="off"
      endif
   locate_track("backward")
   leftkey$="lock"
   endif
endif

if (downkey()=1)
   if (downkey$="free")
   downkey_button=downkey_button+1
      if (downkey_switch_button$="off")
         downkey_switch_button$="on"
      else
         downkey_switch_button$="off"
      endif
      if (status$="Playing")
         locate_track("stop")
      else
         locate_track("play")
      endif
   downkey$="lock"
   endif
endif

if (upkey()=1)
   if (upkey$="free")
   upkey_button=upkey_button+1
      if (upkey_switch_button$="off")
         upkey_switch_button$="on"
      else
         upkey_switch_button$="off"
      endif
      if (repeat$="Yes")
         locate_track("noloop")
      else
         locate_track("loop")
      endif
   upkey$="lock"

   endif
endif

if (keystate(scancode())=0)
   rightkey$="free"
   leftkey$="free"
   upkey$="free"
   downkey$="free"
endif
endfunction