home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / cdmcidrv / cdaudibm.h next >
C/C++ Source or Header  |  1999-05-11  |  9KB  |  186 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /* SOURCE FILE NAME:  CDAUDIBM.H                                            */
  4. /*                                                                          */
  5. /* DESCRIPTIVE NAME:  Include file for CD Audio MCI Driver (CDAUDIO.C)      */
  6. /*                                                                          */
  7. /* COPYRIGHT:  (c) IBM Corp. 1990 - 1993                                    */
  8. /*                                                                          */
  9. /* FUNCTION:  This file contains the macro definition used in the           */
  10. /*            CD Audio MCI Driver.                                          */
  11. /*                                                                          */
  12. /* NOTES:                                                                   */
  13. /*                                                                          */
  14. /*                                                                          */
  15. /****************************************************************************/
  16.  
  17. #define TRUE            1
  18. #define FALSE           0
  19.  
  20. /* Instance status, must be in this order */
  21. #define UNLOADED  0        // initial state
  22. #define OPENED    1        // lower MCI Driver was opened
  23. #define REGDRIVE  2        // registered drive
  24. #define REGDISC   3        // registered disc
  25. #define REGTRACK  4        // registered tracks
  26. #define NODISC    5        // no disc present, will go to STOPPED or REGDRIVE.
  27. #define PLAYING   6
  28. #define STOPPED   7
  29. #define PAUSED    8
  30. #define SUSPEND  20        // instance lost control
  31.  
  32. /* MODES */
  33. /* addressing mode */
  34. #define TIME_MODE       0x0000000F    // time mode, byte 0.
  35. #define TIME_MODE_SET   0xFFFFFFF0    // time mode, byte 0.
  36. #define CDMC_MMTIME     0x00000001    // Multimedia Time (3000 / sec.)
  37. #define CDMC_MILLSEC    0x00000002    // Millisecond     (1000 / sec.)
  38. #define CDMC_REDBOOK    0x00000003    // Red Book (MSF)  (  75 / sec.)
  39. #define CDMC_TMSF       0x00000004    // Track + MSF     (  75 / sec.)
  40.  
  41. /* streaming mode */
  42. #define STREAM_MODE     0x00000030    // stream mode, byte 1, low nibble.
  43. #define STREAM_MODE_SET 0xFFFFFFCF    // stream mode, byte 1, low nibble.
  44. #define CDMC_INTDAC     0x00000010    // process internal DAC
  45. #define CDMC_STREAM     0x00000020    // processing via stream
  46.  
  47. /* stream capability mode, of instance & drive */
  48. #define STREAM_CAP      0x000000C0    // stream cap mode, byte 1, high nibble.
  49. #define STREAM_CAP_SET  0xFFFFFF3F    // stream cap mode, byte 1, high nibble.
  50. #define CDMC_CAN_DAC    0x00000040    // has internal DAC
  51. #define CDMC_CAN_STREAM 0x00000080    // has streaming capabilities
  52.  
  53. /* channel type enabled mode */
  54. #define CHAN_TYPE       0x00000F00    // channel mode, byte 2.
  55. #define CHAN_TYPE_SET   0xFFFFF0FF    // channel mode, byte 2.
  56. #define CDMC_HEADPHONE  0x00000100    // headphone channel enabled
  57. #define CDMC_SPEAKER    0x00000200    // speaker channel enabled
  58.  
  59. /* channel enabled mode */
  60. #define CHAN_MODE       0x0000F000    // channel mode, byte 3.
  61. #define CHAN_MODE_SET   0xFFFF0FFF    // channel mode, byte 3.
  62. #define CDMC_LFT_CH     0x00001000    // left channel enabled
  63. #define CDMC_RGT_CH     0x00002000    // right channel enabled
  64. #define CDMC_ALL_CH     0x00003000    // both channel enabled, must be LFT | RGT
  65.  
  66. /* misc flags */
  67. #define CDMC_PERCENT    0x00010000    // speed format in %, 0 = frames/sec
  68. #define CDMC_SHAREABLE  0x00020000    // opened as shareable
  69.  
  70. /* Volume Setting Macros */
  71. #define VOL_LEFT(level)     (*(USHORT *)((ULONG *)(&level)))
  72. #define VOL_RIGHT(level)    (*((USHORT *)((ULONG *)(&level))+1))
  73.  
  74. /* Other definition */
  75. #define VALIDID "CDDA"     // valid id, used to validate pointer
  76. #define VALLEN    4        // length of VALIDID
  77. #define MMT_FRAME          40   // MMTIME units per Redbook frame
  78. #define LOAD_MOD_BUF_LEN  100   // length of DLL load module buffer
  79. #define IS_PRE_EMPH      0x10   // Pre-emphasis bit track control information
  80. #define IS_COPYABLE      0x20   // Digital copying is permitted.
  81. #define IS_DATA_TRK      0x40   // Data Track bit track control information
  82. #define HAS_4_CHANS      0x80   // 4 Channel bit track control information
  83. #define IS_OTHER_TRK     0x90   // Other Track bits track control information
  84. #define WAIT_NOTIFY_MASK (0xFFFFFFFF ^ (MCI_WAIT | MCI_NOTIFY))
  85. #define WAIT_FOREVER      -1L   // Suspend until released
  86.  
  87.  
  88. typedef struct instance_state *PINST;
  89.  
  90. /***********************************************/
  91. /* Instance State structure and Instance Table */
  92. /***********************************************/
  93.  
  94. #define IDSIZE sizeof(MCI_CD_ID)
  95.  
  96.  
  97. struct instance_state
  98. {
  99.    CHAR   valid[VALLEN];                 // marker to validate pointer
  100.    ULONG  ulMode;                        // Stream and Addressing mode
  101.    USHORT usStatus;                      // instance status
  102.    ULONG  ulCur_pos,                     // current position of CD head
  103.           ulEnd_play,                    // end address of PLAY
  104.           ulStart_disk,                  // start address of playable Disc
  105.           ulEnd_disk,                    // end address of playable Disc
  106.           ulOffset,                      // Synchronization Offset
  107.           ulMasterVolume,                // master volume level, in %
  108.           ulLevel;                       // component volume level, R:L in %
  109.    PVOID  hHWMCID;                       // hardware specific MCI Driver handle
  110.    PFNCDVSD  pMCIDriver;                 // pointer to HW specific (VSD) entry
  111.    HMODULE hMod;                         // handle to VSD module
  112.    MCIDRV_CD_SAVE_PARMS   recSave;       // Save information record
  113.    USHORT usDeviceOrd;                   // The device ordinal number
  114.    USHORT usCaps;                        // drive capabilities
  115.    ULONG  ulPrerollType,                 // drive preroll type
  116.           ulPrerollTime,                 // drive preroll time
  117.           ulMinStartTime;                // drive minimum seek address
  118.    MCI_CD_REGDISC_PARMS   recDisc;       // Disc info record
  119.    MCI_CD_REGTRACKS_PARMS recTrack;      // Track info record
  120.    PVOID  pTrackInfo;                    // Track info buffer
  121.    ULONG  ulTrackInfoSize;               // Track info buffer size
  122.    USHORT usDeviceID;                    // Device ID from MDM
  123.    ULONG  arrCuePoint[CDMCD_CUEPOINT_MAX];   // array of cuepoints
  124.    BYTE   SyncMaster;                    // Master in sync group, TRUE/FALSE
  125.    HMTX   hInstSem;                      // semaphore for instance table
  126. };
  127.  
  128. /* PROTOTYPES */
  129.  
  130. /*    cdaudio.c      */
  131. ULONG pre_process_msg(PINST, USHORT *, ULONG);
  132. ULONG process_msg(PINST, USHORT, ULONG *, PVOID, USHORT);
  133. ULONG verify_entry(PINST, USHORT, ULONG, PVOID *);
  134. VOID  QMAudio(PINST);
  135. ULONG Register(PINST);
  136. ULONG ReRegister(PINST);
  137. VOID  VSDReturn(ULONG, ULONG, ULONG);
  138. ULONG SetTrackInst(PINST, USHORT);
  139. ULONG ValPointer(PVOID, ULONG);
  140.  
  141.  
  142. /*    cdaudpro.c     */
  143. ULONG ProcClose(PINST, ULONG *, PVOID, USHORT);
  144. ULONG ProcConnector(PINST, ULONG, MCI_CONNECTOR_PARMS *);
  145. ULONG ProcCue(PINST, ULONG);
  146. ULONG ProcCuePoint(PINST, ULONG, MCI_CUEPOINT_PARMS *);
  147. ULONG ProcGeneral(PINST, USHORT, ULONG *, PVOID, USHORT);
  148. ULONG ProcCaps(PINST, ULONG, MCI_GETDEVCAPS_PARMS *);
  149. ULONG ProcInfo(PINST, ULONG, MCI_INFO_PARMS *);
  150. ULONG ProcMAudio(PINST, ULONG, MCI_MASTERAUDIO_PARMS *);
  151. ULONG ProcOpen(ULONG *, MMDRV_OPEN_PARMS *, USHORT);
  152. ULONG ProcPause(PINST, ULONG);
  153. ULONG ProcPlay(PINST, ULONG *, MCI_PLAY_PARMS *, USHORT);
  154. ULONG ProcPosAdvise(PINST, ULONG, MCI_POSITION_PARMS *);
  155. ULONG ProcRestore(PINST);
  156. ULONG ProcResume(PINST, ULONG);
  157. ULONG ProcSave(PINST);
  158. ULONG ProcSeek(PINST, ULONG, MCI_SEEK_PARMS *);
  159. ULONG ProcSet(PINST, ULONG *, MCI_SET_PARMS *);
  160. ULONG ProcSetSync(PINST, ULONG, MCI_SYNC_OFFSET_PARMS *);
  161. ULONG ProcStatus(PINST, ULONG, MCI_STATUS_PARMS *);
  162. ULONG ProcStop(PINST, ULONG);
  163. ULONG ProcSync(PINST, ULONG, MCIDRV_SYNC_PARMS *);
  164.  
  165.  
  166. /*    cdaudutl.c     */
  167. ULONG SetAudio(PINST, ULONG *, MCI_SET_PARMS *, ULONG *, ULONG *);
  168. ULONG SetConnector(PINST, ULONG);
  169. ULONG SetCuePoint(PINST, MCI_CUEPOINT_PARMS *);
  170. ULONG StatusMCD(PINST, ULONG, MCI_STATUS_PARMS *, ULONG, USHORT);
  171. ULONG StatusMCDDef(PINST, ULONG, MCI_STATUS_PARMS *, ULONG);
  172. ULONG StatusVSD(PINST, ULONG, MCI_STATUS_PARMS *, ULONG);
  173. VOID  DisableEvents(PINST);
  174. ULONG GetTimeAddr(PINST, ULONG, USHORT);
  175. ULONG GetTimeAddrRC(PINST, ULONG);
  176. MCI_CD_REGTRACK_REC * GetTrackInfo(PINST, BYTE, ULONG);
  177. ULONG ValAddress(PINST, ULONG *, ULONG *, USHORT);
  178. ULONG ValState(PINST);
  179. ULONG vsdResponse(PINST, ULONG);
  180.  
  181.  
  182. /* cdmccomn.c */
  183.        VOID   parse_DevParm(CHAR *, CHAR **, CHAR **);
  184. static CHAR * get_token(CHAR *);
  185.  
  186.