View Single Post
Old 24 March 2017, 00:02   #11
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 148
Quote:
Originally Posted by Daedalus View Post
Excellent work, I must try it myself and see if I can get it working on my setup. Thanks for sharing!
But of course, hope you get it working!

earok shared his wisdom about the CD32 library by Acid. I got an example from him that I modified a little. Both this and the previous example are working on a real CD32, I have confirmed this and now I have a few coasters as a bonus. The playback needs to be started in Amiga / QAmiga modes but then when switching to Blitz, the audio is still playing. Anyway here is an example using the Acid library:

Code:
; CD32 CD Audio test
; Based on source code by earok on EAB
; The Acid CD32 library is needed for this example to work:
; http://www.david-mcminn.co.uk/blitz-2000/archives/libraries/acid.html
; CD32 functions can't be used in BLITZ mode, you can switch to Blitz mode after calling PlayCD32

DEFTYPE .w

; When using the CD32 functions, a delay is needed before switching back to CD32 mode 
; From my experiments on a real CD32, a delay of 10 was too short 50 seems to work
#BLITZ_DELAY = 50
#CD32_PLAY     = 1
#CD32_LTRIGGER = 2
#CD32_RTRIGGER = 4
#CD32_GREEN    = 8
#CD32_YELLOW   = 16
#CD32_RED      = 32
#CD32_BLUE     = 64

; 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
Use Palette 0                           ; Use palette must be called after changing the colors with PalRGB
Colour 1                                ; Set color index used for printing

QAMIGA

If InitCD32 ; InitCD32 must be called before using any CD32 functions
  Locate 0,0 : Print "CD32 initialized!"
Else
  Locate 0,0 : Print "Could not init CD32!"
EndIf

Delay_ #BLITZ_DELAY
BLITZ

ypos = 1
looping=true
track=2 ; Track nr. 1 is the data track

While looping

  Option = GameB(1)

  If JoyDown
    If Option=0
      JoyDown=False
    EndIf
  Else
    If Option > 0

      If Option & #CD32_GREEN ;Green plays track
        QAMIGA
        PlayCD32 track
        Delay_ #BLITZ_DELAY
        BLITZ
        ypos+1
        Locate 0,ypos : Print "Playing track nr. ",track
        track+1 ; Simply switch between tracks 2 and 3
        If track>3
          track=2
        EndIf
      EndIf 

      If Option & #CD32_YELLOW ;Yellow stops the music
        QAMIGA
        StopCD32
        Delay_ #BLITZ_DELAY
        BLITZ
      EndIf
      
      If Option & #CD32_RED ; Red exits the loop and ends the program
        looping = False
      EndIf

      JoyDown=True
      Option=0

    EndIf 
  EndIf

  VWait

Wend

QAMIGA
StopCD32
Delay_ 50
End

Last edited by witchmaster; 24 March 2017 at 08:00.
witchmaster is offline  
 
Page generated in 0.12773 seconds with 10 queries