home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / TOOLKIT / MM / ADMCT / AUDIOMCD.H < prev    next >
C/C++ Source or Header  |  1994-11-17  |  17KB  |  355 lines

  1. /***************************************************************************
  2. *
  3. * Module Name: AUDIOMCD.H
  4. *
  5. * OS/2 2.0 Multimedia Extensions Audio MCI Driver Instance Data
  6. * Block defintions.
  7. *
  8. * Copyright (c) International Business Machines Corporation 1991,1993
  9. *                         All Rights Reserved
  10. *
  11. \***************************************************************************/
  12.  
  13. /*
  14. #ifdef _TORONTO
  15.     typedef  ULONG   NULL;
  16. #endif
  17. */
  18.  
  19. /* Performance stub for pagetuned pragma header files */
  20. #ifndef PERFSTUB
  21.   #include "perfstub.h"
  22.   #define  PERFSTUB
  23. #endif
  24.  
  25. /*************************************/
  26.   // Definitons of sizes
  27. /************************************/
  28. #define  MAX_ERROR_LENGTH         128
  29. #define  MAX_MODULE_NAME          10
  30. #define  MAX_FILE_NAME            16
  31. #define  HANDLER_NAMES_BUFLEN     128
  32. #define  NOTIFY_THREAD_STACKSIZE  32768
  33. #define  HEAP_SIZE                4096
  34. #define  INDEFNITE_PERIOD          -1
  35. #define  ONE_MINUTE               60000
  36. #define  MAX_CUEPOINTS            20
  37. #define  DEFAULT_CLIP_SIZE        1000000
  38. #define  NUM_TAPS                 2
  39. #define  DELAY_LINE_LENGTH        2
  40.  
  41. /************************************************
  42. * Default Wave attributes
  43. ************************************************/
  44. #define DEFAULT_SOURCE_HANDLER_NAME         "FSSH"
  45. #define MEM_PLAYLIST_SH                     "MEMSH"
  46. #define DEFAULT_SOURCE_PDD_NAME             " "
  47. #define DEFAULT_TARGET_HANDLER_NAME         "AUDIOSH$"
  48. #define DEFAULT_DEVDLL_NAME                 "AUDIOIF"
  49. #define DEFAULT_BLOCK_ALIGN                  1
  50.  
  51. /* IO Procedure capabilities */
  52.  
  53. #define CAN_INSERT     0x00000001
  54. #define CAN_DELETE     0x00000002
  55. #define CAN_UNDOREDO   0x00000004
  56. #define CAN_RECORD     0x00000008
  57. #define CAN_SAVE       0x00000010
  58.  
  59. #define TEN_SECONDS    10000
  60.  
  61. /* Undo List */
  62.  
  63. typedef struct _UNDO_LIST {
  64.    ULONG                ulNumLogicalActions;
  65.    struct _UNDO_LIST    *pNextList;
  66.    } UNDOLIST;
  67.  
  68. typedef UNDOLIST  *PUNDOLIST;
  69.  
  70. /*********************************************************************
  71. *   Modified EVCB just has an Implicit Evcb and MCD Instance
  72. *   in a Single Block.
  73. *********************************************************************/
  74. typedef struct MEVCB {
  75.       IMPL_EVCB           evcb;                /* Implicit EVCB           */
  76.       ULONG               ulpInstance;         /* Instance Ptr            */
  77.       USHORT              usUserParm;          /* Returned on Cue Points  */
  78.       } MEVCB; /* Modified EVCB */
  79.  
  80. /********************************************************************
  81. *   Modified Time EVCB Block Contains a Time EVCB with MCD Instance,
  82. *   and other useful Parameters
  83. ********************************************************************/
  84. typedef struct MTIMEEVCB {
  85.     TIME_EVCB            evcb;                /* Time EVCB                */
  86.     USHORT               usDeviceID;           /* Cue Point Notifications  */
  87.     HWND                 hwndCallback;          /* Cue Point Call back Hndl */
  88.     ULONG                ulpInstance;         /* Instance Ptr             */
  89.     USHORT               usCueUsrParm;        /* CuePt User Parm          */
  90.     MMTIME               mmCuePt;             /* CuePt in MMTIME          */
  91.     struct MTIMEEVCB     *pNextEVCB;          /* Pointer to next evcb    */
  92.     HEVENT               HCuePtHndl;          /* Array of CuePt Event hndls*/
  93.  
  94.     } MTIME_EVCB;  /* Modified Event Control Block */
  95.  
  96. /*****************************************************************
  97. *   Streaming Instance is a MCI Driver Layer Data Block
  98. *   defining information needed to Use SSM SPIs. This structure
  99. *   is Instance based. This Structure defines Streaming Info only.
  100. *****************************************************************/
  101. typedef struct _strInstance {
  102.     HID         hidASource;                    /* Source Handler ID         */
  103.     HID         hidATarget;                    /* STarget Handler ID        */
  104.     HID         hidBSource;                    /* Target as Source ID       */
  105.     HID         hidBTarget;                    /* Target as Target ID       */
  106.  
  107. // 6421--we definitely don't need the second variable--what about the first?
  108.  
  109.     char        pszAHandlerName[15];           /* Source Handler Name       */
  110.     char        pszBHandlerName[15];           /* Target Handler Name       */
  111.     HEVENT      hEvent;                        /* Implicit Event Handle     */
  112.     HEVENT      hPosEvent;                     /* Position Event Handle     */
  113.     HEVENT      hPlayToEvent;                  /* Cue Point Event handle    */
  114.     MMTIME      mmStreamTime;                  /* Stream Time               */
  115.     ULONG       ulState;                       /* Stream Pause,Play etc     */
  116.     HSTREAM     hStream;                       /* Address of stream handle  */
  117.     MEVCB       Evcb;                          /* Pointer to ECB            */
  118.     MTIME_EVCB  TimeEvcb;                      /* Cue Point Time EVCB       */
  119.     MTIME_EVCB  PosAdvEvcb;                    /* Time Events for PosAdvisue */
  120.     MTIME_EVCB  *pMCuePtEVCB;
  121.     PVOID       EventRtn;                      /* Event handler entry point */
  122.     SPCBKEY     SpcbKey;                       /* SPCB key with Datatype    */
  123.     ACB_MMIO    acbmmio;                       /* Associate Control Block   */
  124.     ACB_MEM_PLAYL acbPlayList;                 /* Associate Control Block   */
  125.     // 6421--we don't need this info anymore
  126.  
  127. //    DCB_AUDIOSH AudioDCB;                      /* AudioSH Device Control Bl */
  128.     STATUS_LEVEL_EVCB StatusLevelEvcb;         /* Status_level */
  129.     SPCB        spcb;                          /* SPCB for networking info  */
  130.     HEVENT      hStatusLevelEvent;             /* Status_Level */
  131.     } STRINSTANCE;                             /* Streaming Instance Struct */
  132.  
  133. /********************************************************************
  134. *   This Structure defines the data items that are needed to be
  135. *   maintained per MCI Device instance. The Instance structure
  136. *   has a pointer to the Streaming Information Structure defined
  137. *   above. Memory For This data structure is allocated dynamically
  138. *   off a Global heap.
  139. ********************************************************************/
  140.  
  141. typedef struct _Instance {
  142.     USHORT              usAmpDeviceID;             /* Amp Mixer Device ID  */
  143.     USHORT              usWaveDeviceID;            /* Wave Device ID       */
  144.     HEV                 hEventSem;                 /* Event Sem  Handle    */
  145.     HEV                 hThreadSem;                /* Thread Control Sem   */
  146.     HMTX                hmtxDataAccess;            /* Instance Data Access */
  147.     HMTX                hmtxNotifyAccess;          /* Notify status access */
  148.     HMTX                hmtxCloseAccess;           /* Control close access */
  149.     HMTX                hmtxSaveAccess;            /* Control drv_save     */
  150.     HMODULE             hModHandle;                /* Handle of above      */
  151.     HMODULE             hModIOProc;                /* Custom IO Proc Hndl  */
  152.     HMMIO               hmmio;                     /* MMIO file ID         */
  153.     HFILE               hTempFile;                 /* Temp File Handle     */
  154.     ULONG               ulDataSize;                /* size of audio file   */
  155.     CHAR                pszAudioFile[CCHMAXPATH];  /* WAV File Name        */
  156. // 6421--don't keep name
  157. //    CHAR                szAudioDevName[9];         /* Audio Device Name    */
  158.     ULONG               ulNotifyAborted;
  159.     ULONG               ulTimeUnits;               /* Current Time Units   */
  160.     ULONG               ulSyncOffset;              /* Synchronizatn offst  */
  161.     ULONG               ulCreateFlag;              /* Flag for Strm Crtn   */
  162.     ULONG               ulCreatedName;             /* Indicates we created name */
  163.     BOOL                fFileExists;               /* Flag for file load   */
  164.     ULONG               StreamEvent;               /* Stream Event         */
  165.     BOOL                usNotifyPending;           /* Notify Pending Flag  */
  166.     USHORT              usNotPendingMsg;           /* Msg for above        */
  167.     HWND                hwndCallBack;              /* Call Back Handle     */
  168.     HWND                hwndOldCallBack;           /* Temp callback handle */
  169.     HWND                hwndOpenCallBack;          /* Call Back handle for open */
  170.     BOOL                fToEvent;                  /* Play/Record to point */
  171.     USHORT              usUserParm;                /* User Parameter       */
  172.     BOOL                usSaveFlag;                /* Drv Save             */
  173.     STRINSTANCE         StreamInfo;                /* Streaming Info       */
  174.  
  175. // 6421 --no need to keep this variable.
  176.  
  177. //    MCI_AMP_INSTANCE    AmpInstance;               /* VSDI driver Struct   */
  178.     PVOID               pPlayList;                 /* Pointer to Play List */
  179.     BOOL                usPlayLstStrm;             /* Flag for stream Crtn */
  180.     BOOL                usPosAdvise;               /* Position Advise Flag */
  181.     BOOL                usCuePt;                   /* CuePoint On Flag     */
  182.     MMAUDIOHEADER       mmAudioHeader;             /* Audio format info    */
  183.     USHORT              usPosUserParm;             /* User Parm Returned   */
  184.     BOOL                fOpenMMIO;                 /* OPEN_MMIO used to load */
  185.     BOOL                fRecdInsert;               /* Record Insert Flag   */
  186.     BOOL                usWaitPending;             /* Pending Wait Flag    */
  187.     BOOL                fFakeNotify;               /* Asynchronous notify  */
  188.     USHORT              usWaitMsg;                 /* Pending Wait Msg     */
  189.     ULONG               ulAbortedNotify;           /* indicates notify aborted */
  190.     ULONG               ulCapabilities;            /* Capabilities of the io proc */
  191.     ULONG               ulUsingTemp;               /* Using temp files     */
  192.     ULONG               ulOpenTemp;                /* Open with temp files */
  193.     ULONG               ulBlockAlignment;          /* Blk Algnment for wave*/
  194.     ULONG               ulAverageBytesPerSec;      /* Holds average bps    */
  195.     ULONG               ulOldStreamPos;            /* holds destroyed pos  */
  196. //    LONG (* APIENTRY pfnVSD) (PMCI_AMP_INSTANCE, LONG, LONG, LONG, LONG);
  197. //    HAB                 hab;
  198. //    HMQ                 hmq;
  199. //    QMSG                qmsg;
  200. //    HWND                hwndClipWin;               /* Clipboard win handle */
  201.     ULONG               ulBytes;           /* Scaled for Time Calcs    */
  202.     ULONG               ulMMTime;          /* Scaled for Time Calcs    */
  203.     LONG                lDefaultFormat;             /* Default value from INI file */
  204.     LONG                lDefaultSRate;              /* Default value from INI file */
  205.     LONG                lDefaultBPS;                /* Default value from INI file */
  206.     LONG                lDefaultChannels;           /* Default value from INI file */
  207.     LONG                lDefaultOperation;
  208.     LONG                lQosValue;                  /* Network quality of service var */
  209.     LONG                lQOSReporting;              /* Network error reporting flag */
  210.     ULONG               ulHoldState;
  211.  
  212.    ULONG               ulRealTimeTranslation;
  213.  
  214.     ULONG               ulNumUndo;
  215.     ULONG               ulNumRedo;
  216.     PUNDOLIST           pUndoList;
  217.     PUNDOLIST           pRedoList;
  218.     BOOL                fInstalledProtocol;        /* Did we install an SpiProtocol? */
  219.     PVOID               pcodecini;
  220.     MMAUDIOHEADER       mmRealHeader;              /* Holds actual file header, not */
  221.                                                    /* translated header. */
  222.     PVOID               pcodecopen;
  223.     ULONG               ulCodecDescription;        /* Direction of codec */
  224.     BOOL                ulFlags;                    /* Generic flags */
  225.     CHAR                szDevParm[MAX_DEV_PARAMS]; /* Device specific parameters */
  226.  
  227.     ULONG               ulOperation;
  228.     BOOL                fConnected;                /* State of MCI Connection */
  229.     BOOL                fCanStreamFrom;            /* Whether connected device can record */
  230.  
  231. // CONNECTION WORK
  232.     HMTX                hmtxStreamAccess;          /* Access to streaming functions */
  233.     PVOID               pdcb;                      /* Device Control Block */
  234.     BOOL                fFoundMixer;               /* Mixer in network */
  235.     HID                 hidAttached;               /* HID of attached device */
  236.  
  237.     ULONG              ulStatusLevel;              /* Status_Level SJB */
  238.     ULONG              ulStatusLevelState;         /* Status_Level STATUS_LEVEL_ */
  239.  
  240.  
  241.     } INSTANCE;         /* Audio MCD MCI Instance Block */
  242.  
  243. #define STATUS_LEVEL_OFF    0
  244. #define STATUS_LEVEL_ON     1
  245.  
  246.  
  247.  
  248. /*********************************************************************
  249. * Function Parameter Block defines the parameters needed by each MCI
  250. * Message processing function to process the message.
  251. **********************************************************************/
  252. typedef struct {
  253.     PVOID       ulpInstance;       /*  Pointer to Instance               */
  254.     USHORT      usMessage;         /*  The Message                       */
  255.     ULONG       ulParam1;          /*  Flags for the Message             */
  256.     ULONG       ulParam2;          /*  Data for The Message              */
  257.     USHORT      usUserParm;        /*  User Parameter Returned on Notify */
  258.     ULONG       ulNotify;          /*  Notification flag                 */
  259.     INSTANCE    *pInstance;        /*  Shall be Modified later           */
  260.     HWND        hwndCallBack;      /*  Window Handle                     */
  261.     }FUNCTION_PARM_BLOCK;          /*  Audio MCD Function Paramter Block */
  262.  
  263.  
  264. /*********************************************************************
  265. * Function Parameter Block defines the parameters needed by each MCI
  266. * Message processing function to process the message.
  267. **********************************************************************/
  268.  
  269.  
  270. typedef struct {
  271.     QOSInfo     QOSParms;
  272.     QOS         QOSItem[ 6 ];
  273.     } CUSTOM_QOS;
  274.  
  275.  
  276.  
  277.  
  278. /************************************************/
  279.         // MASKS for MCI_WAIT and MCI_NOTIFY
  280. /************************************************/
  281. #define NOTIFY_MASK     ~(MCI_NOTIFY | MCI_WAIT)
  282. #define WAIT_MASK       0xffffff00L
  283. #define   VSDI          "AUDIOIFDriverEntry"
  284.  
  285. /************************************
  286. * Streaming STATE defines
  287. *************************************/
  288. #define CREATE_STATE        0x080
  289. #define PREROLL_STATE       0x081
  290. #define SAVED_STATE         0x082
  291. #define RESTOR_STATE        0x083
  292. #define ACTIVE              0x084
  293. #define UNUSED              0x085
  294. #define STREAM_STOPPED      0x086
  295. #define PLAY_STREAM         0x087
  296. #define RECORD_STREAM       0x088
  297. #define DESTROYED_STATE     0x089
  298. #define CUEPLAY_STATE       0x090
  299. #define CUERECD_STATE       0x091
  300. #define SAVEPAUS_STATE      0x09a
  301. #define OPEN_FATAL          0x09b
  302. #define EVENT_ENABLED       0x09c
  303. #define ASYNCH_MESSAGE      0x09d
  304. #define STREAM_SET_STATE    0x09e
  305. #define STOP_PAUSED         0x09f
  306. #define NO_STATE            0x100
  307. #define NOT_INTIALIZED      -1
  308. #define FILE_LENGTH         -1
  309. #define WAVE_IO_PROC        01
  310. #define AVC_IO_PROC         02
  311.  
  312. /************************************
  313. * Current Time Unit TAGS
  314. ************************************/
  315. #define lMMTIME         01
  316. #define lMILLISECONDS   02
  317. #define lBYTES          03
  318. #define lSAMPLES        04
  319.  
  320. /************************************
  321. *  Internal Error States
  322. ************************************/
  323. #define MCI_WAVEERR_BASE        6000
  324. #define NULLPOINTER             (MCI_WAVEERR_BASE +51)
  325. #define NUM_DATATYPES           42
  326. #define SCALE_FACTOR            100
  327.  
  328. #define XWAVHDR      (ulpInstance->mmAudioHeader.mmXWAVHeader.XWAVHeaderInfo)
  329. #define WAVEHDR      (ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader)
  330. #define CUEPOINT     (ulpInstance->StreamInfo.pMCuePtEVCB)
  331. #define STRMSTATE    (ulpInstance->StreamInfo.ulState)
  332. #define STREAM       (ulpInstance->StreamInfo)
  333. #define AMPMIX       (ulpInstance->AmpInstance)
  334.  
  335. /* CODEC defines */
  336. #define NON_PCM          0x00000001
  337. #define FORMAT_TAG_SET   0x00000002
  338. #define FOURCC_WAV                       mmioFOURCC('W','A','V','E')
  339. #define SOURCE_CODEC     0x00000001
  340. #define TARGET_CODEC     0x00000002
  341. #define MAKE_SOURCE      0x00000004
  342. #define MAKE_TARGET      0x00000008
  343. #define MMIO_RAWHEADER   0x00000001
  344.  
  345.  
  346. /* DEVCAPS stuff */
  347. #define DEVICE_CAN_RECORD  0x0000001
  348. #define DEVICE_CAP_UNKNOWN 0x0000002
  349.  
  350.  
  351. /* Device specific parms information *. */
  352. #define OBTAINDEFAULTS     0x00000001
  353. #define FIRST_RESTORE      0x00000002
  354. #define READ_ONLY_FILE     0x00000004
  355.