Building an Audio CD Player, Listing 3

### Listing 3. Jcd_Drive.h

    #include <native.h>                       /*  2 */
    /* Header for class Jcd_Drive */          /*  3 */
    struct Hjava_lang_String;                 /*  4 */
    #define Jcd_Drive_FRAMES_PER_SECOND 75L   /*  5 */
    #define Jcd_Drive_LEAD_OUT 170L           /*  6 */
    #define Jcd_Drive_STATUS_INVALID 0L       /*  7 */
    #define Jcd_Drive_STATUS_PLAY 17L         /*  8 */
    #define Jcd_Drive_STATUS_PAUSED 18L       /*  9 */
    #define Jcd_Drive_STATUS_COMPLETED 19L    /* 10 */
    #define Jcd_Drive_STATUS_ERROR 20L        /* 11 */
    #define Jcd_Drive_STATUS_NOSTATUS 21L     /* 12 */
    #define Jcd_Drive_FLAG_NONE 0L            /* 13 */
    #define Jcd_Drive_FLAG_STOP_PLAY 1L       /* 14 */
    typedef struct ClassJcd_Drive {           /* 16 */
        struct Hjava_lang_String *device_name;/* 17 */
        long device_flags;                    /* 18 */
        long fd;                              /* 19 */
        long audio_status;                    /* 20 */
        long number_of_tracks;                /* 21 */
        long current_track;                   /* 22 */
        long current_index;                   /* 23 */
        long current_address;                 /* 24 */
    } ClassJcd_Drive;                         /* 25 */
    /* Tricky definition of HJcd_Drive which includes
     * ClassJcd_Drive.  */
    HandleTo(Jcd_Drive);                      /* 26 */
    extern void                               /* 28 */
      Jcd_Drive_initDrive(struct HJcd_Drive *);
    extern long
      Jcd_Drive_currentTrack(struct HJcd_Drive *);
    extern long
      Jcd_Drive_currentIndex(struct HJcd_Drive *);
    extern long
      Jcd_Drive_numberOfTracks(struct HJcd_Drive *);
    extern long
      Jcd_Drive_currentAddress(struct HJcd_Drive *);
    extern long
      Jcd_Drive_cdEndAddress(struct HJcd_Drive *);
    extern long
      Jcd_Drive_trackAddress(struct HJcd_Drive *,long);
    extern long
      Jcd_Drive_trackLength(struct HJcd_Drive *,long);
    extern struct Hjava_lang_String *
      Jcd_Drive_cddbID(struct HJcd_Drive *);
    extern struct Hjava_lang_String *
      Jcd_Drive_productCode(struct HJcd_Drive *);
    extern long
      Jcd_Drive_status(struct HJcd_Drive *);
    extern void
      Jcd_Drive_play(struct HJcd_Drive *,
    	         long,long,long,long);
    extern void
      Jcd_Drive_stop(struct HJcd_Drive *);
    extern void
      Jcd_Drive_pause(struct HJcd_Drive *);
    extern void
      Jcd_Drive_resume(struct HJcd_Drive *);
    extern void
      Jcd_Drive_eject(struct HJcd_Drive *);
    extern void
      Jcd_Drive_setVolume(struct HJcd_Drive *,long);
    extern long
      Jcd_Drive_volume(struct HJcd_Drive *);