[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


   NAME
       CD_QCODEMSF -- Report current disk position.

   IO REQUEST
       io_Device       preset by the call to opendevice()
       io_Unit         preset by the call to opendevice()
       io_Command      CD_QCODEMSF
       io_Data         pointer to qcode structure
       io_Length       0 - MUST be zero (for future compatability)

   RESULTS
       io_Error        0 for success, or an error code as defined in
                       <devices/cd.h>

   FUNCTION
       This command reports current subcode Q channel time information.  This
       command only returns data when CD Audio is playing (or paused).  At
       any other time, an error is returned.  The Q-Code packet consists of:

       struct qcode {

           ubyte        ctladr;        /* data type / qcode type           */
           ubyte        track;         /* track number                     */
           ubyte        index;         /* track subindex number            */
           ubyte        zero;          /* the "zero" byte of q-code packet */
           union LSNMSF TrackPosition; /* Position from start of track     */
           union LSNMSF DiskPosition;  /* Position from start of disk      */
           };

   EXAMPLE

       struct qcode qcode;

       ior->io_Command = CD_QCODEMSF;  /* Retrieve TOC information */
       ior->io_Length  = 0;            /* MUST be zero             */
       ior->io_Data    = (APTR)qcode;  /* Here's where we want it  */
       doio (ior);

       if (!ior->io_Error) {           /* Command succeeded        */

           printf("Current position is: %02d:%02d:%02dn",
               qcode.DiskPosition.MSF.Minute,
               qcode.DiskPosition.MSF.Second,
               qcode.DiskPosition.MSF.Frame);
           }

   NOTES
       This function may not return immediately.  It may take several frames
       to pass by before a valid Q-Code packet can be returned.  Use sendio()
       and checkio() if response time is critical, and the information is
       not.

   BUGS

   SEE ALSO
       cd_playmsf, cd_playlsn, cd_playtrack, <devices/cd.h>