View Single Post
Old 22 March 2017, 23:37   #9
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 149
Quote:
Originally Posted by spudje View Post
Oh sorry, I read bb2 as aos39 with boing bag 1 & 2.
No worries, I appreciate you taking the time to reply.

But good news (for me at least), I managed to get CD audio playing using the CompactDisk library functions in WinUAE emulating the CD32, haven't tested on my hardware CD32 yet though. The functions need to be called in Amiga/QAmiga mode. Switching to Blitz mode instantly after starting playback caused the playback not to start, having a delay before switching back to Blitz mode seems to work. This still needs more testing but anyway here is the code for future references.

Code:
; CD32 CD Audio test

; CDStatus bit definitions
#CDSTSB_CLOSED      = 0  ; Drive door is closed
#CDSTSB_DISK        = 1  ; A disk has been detected
#CDSTSB_SPIN        = 2  ; Disk is spinning (motor is on)
#CDSTSB_TOC         = 3  ; Table of contents read.  Disk is valid.
#CDSTSB_CDROM       = 4  ; Track 1 contains CD-ROM data
#CDSTSB_PLAYING     = 5  ; Audio is playing
#CDSTSB_PAUSED      = 6  ; Pause mode (pauses on play command)
#CDSTSB_SEARCH      = 7  ; Search mode (Fast Forward/Fast Reverse)
#CDSTSB_DIRECTION   = 8  ; Search direction (0 = Forward, 1 = Reverse)

; Print at location with colour
Statement PrintAt{x.w, y.w, col.b, text$}
  Locate x,y : Colour col : Print text$
End Statement

; Initialize
BLITZ                                   ; Go into blitz mode
Slice 0,44,320,200,$fff8,4,8,16,320,320 ; Create a slice
BitMap 0, 320, 200, 4                   ; Create a bitmap
Show 0                                  ; Show the bitmap in the slice
BitMapOutput 0                          ; Output print commands to bitmap 0
PalRGB 0,1,15,15,15                     ; Set colour index 1 to white
PalRGB 0,2,15,0,0                       ; Set colour index 2 to red
PalRGB 0,3,0,15,0                       ; Set colour index 3 to green
Use Palette 0                           ; Use palette must be called after changing the colors with PalRGB
Colour 1                                ; Set color index used for printing

; Global variables
device$ = "cd.device"
unit = 0
cd_available = False

; Print header
PrintAt{0,0,1,"CD32 CD Audio Playback Test"}

; Open the cd.device and print the result
If OpenCD(device$, unit) = 0
  PrintAt{0,1,2,"Could not open cd.device!"}
Else
  PrintAt{0,1,3,"cd.device opened successfully!"}
  cd_available = True
EndIf

; Go into QAmiga mode and read CD status and TOC
QAMIGA
cds=CDStatus
If (cds BitTst #CDSTSB_TOC)
  
  Delay_ 50 ; Wait a sec
  CDReadTOC ; Read the TOC
  PrintAt{0,2,3,"TOC was successfully read!"}
  
  ; Calculate total playing time (all tracks) and print to screen
  totalsecs=0
  For h=1 To CDNumTracks
    totalsecs+CDTrackLength(h)
  Next h
  Locate 0,3 : Colour 1 : Print "Tracks: ", CDNumTracks, ", Total length of tracks: ", totalsecs, " seconds"
  
  ; Play track nr. 2 and play all remaining tracks (Track nr. 1 is data)
  CDPlayTrack 2,(CDNumTracks-2) 
  
  PrintAt{0,4,1,"Playing Track 1..."}
  
Else ; fail
  PrintAt{0,2,2,"Reading of TOC failed!"} 
EndIf

; We need to wait a sec before going into Blitz mode, otherwise playing does not start
Delay_ 50

; Go back to Blitz mode after starting Audio CD playback
BLITZ
PrintAt{0,5,1,"Switched to Blitz mode!"} 

Repeat
  ; Just wait for a mouse click
Until Joyb(0)>0

QAMIGA
; Close cd.device before exiting
If cd_available = True
  CDStop
  Delay_ 50
  CloseCD
End If
witchmaster is online now  
 
Page generated in 0.07369 seconds with 10 queries