[futurebasic] Re: Audio CD Player, almost done

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1998 : Group Archive : Group : All Groups

From: Bill Sanford <bsanford@...>
Date: 08 Jul 98 11:47:13 -0500
         Reply to:   RE: [FB] Audio CD Player, almost done
Morrison SoftDesign wrote:
>I am just about finished with a simple Audio CD Player in FB. I've been
>porting some C code (from Apple) and am stuck on the function used to read the
>track information about a given track (the play time & length). I've got all
>the other functions working (Play, Stop, Skip Forward, Skip Back, Pause,
>Eject) I also need to finish the Scan functions.
>
>If anybody wants to help I'd be glad to share what I've got thus far. I don't
>think it's too complex (the function I'm stuck on) for someone with some C >knowledge.
>
>Let me know...
>
>

This is what I use to read the table of contents for a CD...

CLEAR LOCAL
DIM pb.100
LOCAL FN ReadCDTOC
  buf& = FN NEWPTR _clear (1024)   LONG IF buf&
    DEF BLOCKFILL(@pb,100,0)
    pb.ioRefNum% = gDriverRefNum%'     <- ref number of the opened CD driver
    pb.csCode%   = 100                            'csCode      read CD TOC
    pb.csParam0% = 4                              'csParam0    table type
    pb.csParam1& = buf&                           'csParam1_2& table address
    err = FN CONTROL(@pb)
    err = pb.ioResult%
        gFirstTrack = FN BCDToDec(PEEK(buf&+3))
    gLastTrack  = FN BCDToDec(PEEK(buf&+8))
        FOR cnt = 0 TO 99
      offset = 11 + (cnt*5)
      gTrackMin(cnt)   = FN BCDToDec((PEEK(buf& + offset + 2))) '  save  in a global array
      gTrackSec(cnt)   = FN BCDToDec((PEEK(buf& + offset + 3)))  '  save  in a global array
      gTrackFrame(cnt) = FN BCDToDec((PEEK(buf& + offset + 4))) '  save  in a global array
    NEXT cnt
        memErr = FN DISPOSPTR(buf&)
  END IF
END FN = err