cd.h

// imWare
// Wednesday, February 14, 1990
// James Beninghaus
 
#ifndef __FILES__
    #include    <Files.h>
#endif
#ifndef __DEVICES__
    #include    <Devices.h>
#endif
 
#define csWhoIsThere    97
#define csReadTOC       100
#define csATrkSearch    103
#define csAPlay         104
#define csAPause        105
#define csAStop         106
#define csAStatus       107
 
#define BLOCKADDR       0
#define MSFADDR         1
#define TRACKADDR       2
 
#define TOCTRACKS       1
#define TOCENDOFDISK    2
#define TOCSTARTADDR    3
 
#define STEREO          9
#define MONO            15
 
#define START           0
#define STOP            1
 
#define PAUSE           1
#define CONTINUE        0
 
#define PLAYING         0
#define PAUSED          1
 
typedef unsigned char   Byte;
typedef unsigned short  Word;
typedef unsigned long   Long;
 
typedef struct WhoIsThereRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Byte    fill;
        Byte    SCSIMask;
    } csParam;
} WhoIsThereRec;
 
typedef struct AStatusRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Byte    audioStatus;
        Byte    playMode;
        Byte    cntlField;
        Byte    minutes;
        Byte    seconds;
        Byte    frames;
    } csParam;
} AStatusRec;
 
typedef struct {
    Byte        cntlField;
    Byte        minutes;
    Byte        seconds;
    Byte        frames;
} StartAddrRec;
 
typedef struct ReadTOCRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    union {
        Word    type;
        Byte    addr[3];
        struct {
            Word    fill;
            Long    data;
            Word    length;
            Byte    track;
        } buffer;
    } csParam;
} ReadTOCRec;
 
typedef struct APlayRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Word    type;
        Byte    addr[4];
        Word    startStop;
        Byte    fill;
        Byte    playMode;
    } csParam;
} APlayRec;
 
typedef struct ATrkSearchRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Word    type;
        Byte    addr[4];
        Word    playFlag;
        Byte    fill;
        Byte    playMode;
    } csParam;
} ATrkSearchRec;
 
typedef struct AStopRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Word    type;
        Byte    addr[4];
    } csParam;
} AStopRec;
 
typedef struct APauseRec {
    ParamBlockHeader
    short       ioRefNum;
    short       csCode;
    struct {
        Long    state;
    } csParam;
} APauseRec;
 
void            Usage       (void);
pascal  Byte    Decimal2BCD (Byte n);
pascal  Byte    BCD2Decimal (Byte n);
pascal  OSErr   EjectCD     (short ioRefNum);
pascal  OSErr   OpenCD      (Byte CDDrive, short *ioRefNum);
pascal  OSErr   APlay       (short ioRefNum, Byte startTrack, Byte playMode);
pascal  OSErr   APause      (short ioRefNum, Long state);
pascal  OSErr   AStop       (short ioRefNum, Byte stopTrack);
pascal  OSErr   ATrkSearch  (short ioRefNum, Byte track, Byte playFlag, Byte playMode);
pascal  OSErr   AStatus     (short ioRefNum, Byte *audioStatus, Byte *playMode, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
pascal  OSErr   TrackCount  (short ioRefNum, Byte *lastTrack);
pascal  OSErr   TrackInfo   (short ioRefNum, Byte track, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);