home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / runnable / mmos2 / mmtoolkt / samples / cdmct / cdaudibm.h next >
Encoding:
C/C++ Source or Header  |  1992-05-06  |  8.7 KB  |  187 lines

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