Subversion Repositories musikbox

Rev

Blame | Last modification | View Log | RSS feed

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {       Multimedia Interface unit                       }
  7. {                                                       }
  8. {       Copyright (c) 1992,97 Borland International     }
  9. {                                                       }
  10. {*******************************************************}
  11.  
  12. unit Wave_System_Control;
  13.  
  14. {$WEAKPACKAGEUNIT}
  15.  
  16. interface
  17.  
  18. uses Windows;
  19.  
  20.  
  21. {***************************************************************************
  22.  
  23.                     General constants and data types
  24.  
  25. ***************************************************************************}
  26.  
  27. { general constants }
  28. const
  29.   MAXPNAMELEN      =  32;    { max product name length (including nil) }
  30.   MAXERRORLENGTH   = 128;    { max error text length (including nil) }
  31.   MAX_JOYSTICKOEMVXDNAME = 260; { max oem vxd name length (including nil) }
  32.  
  33. {***************************************************************************
  34.  
  35.                          Manufacturer and product IDs
  36.  
  37.     Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS,
  38.     MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures.
  39.  
  40. ***************************************************************************}
  41.  
  42. { manufacturer IDs }
  43. const
  44.   MM_MICROSOFT            = 1;       { Microsoft Corp. }
  45.  
  46. { product IDs }
  47.   MM_MIDI_MAPPER          = 1;       { MIDI Mapper }
  48.   MM_WAVE_MAPPER          = 2;       { Wave Mapper }
  49.   MM_SNDBLST_MIDIOUT      = 3;       { Sound Blaster MIDI output port }
  50.   MM_SNDBLST_MIDIIN       = 4;       { Sound Blaster MIDI input port  }
  51.   MM_SNDBLST_SYNTH        = 5;       { Sound Blaster internal synthesizer }
  52.   MM_SNDBLST_WAVEOUT      = 6;       { Sound Blaster waveform output }
  53.   MM_SNDBLST_WAVEIN       = 7;       { Sound Blaster waveform input }
  54.   MM_ADLIB                = 9;       { Ad Lib-compatible synthesizer }
  55.   MM_MPU401_MIDIOUT       = 10;      { MPU401-compatible MIDI output port }
  56.   MM_MPU401_MIDIIN        = 11;      { MPU401-compatible MIDI input port }
  57.   MM_PC_JOYSTICK          = 12;      { Joystick adapter }
  58.  
  59.  
  60. { general data types }
  61. type
  62.   VERSION = UINT;               { major (high byte), minor (low byte) }
  63.   MMVERSION = UINT;             { major (high byte), minor (low byte) }
  64.   MMRESULT = UINT;              { error return code, 0 means no error }
  65.  
  66. { types for wType field in MMTIME struct }
  67. const
  68.   TIME_MS         = $0001;  { time in milliseconds }
  69.   TIME_SAMPLES    = $0002;  { number of wave samples }
  70.   TIME_BYTES      = $0004;  { current byte offset }
  71.   TIME_SMPTE      = $0008;  { SMPTE time }
  72.   TIME_MIDI       = $0010;  { MIDI time }
  73.   TIME_TICKS      = $0020;  { Ticks within MIDI stream }
  74.  
  75. { MMTIME data structure }
  76. type
  77.   PMMTime = ^TMMTime;
  78.   TMMTime = record
  79.     case wType: UINT of        { indicates the contents of the variant record }
  80.      TIME_MS:      (ms: DWORD);
  81.      TIME_SAMPLES: (sample: DWORD);
  82.      TIME_BYTES:   (cb: DWORD);
  83.      TIME_TICKS:   (ticks: DWORD);
  84.      TIME_SMPTE: (
  85.         hour: Byte;
  86.         min: Byte;
  87.         sec: Byte;
  88.         frame: Byte;
  89.         fps: Byte;
  90.         dummy: Byte;
  91.         pad: array[0..1] of Byte);
  92.       TIME_MIDI : (songptrpos: DWORD);
  93.   end;
  94.  
  95.  
  96. {***************************************************************************
  97.  
  98.                     Multimedia Extensions Window Messages
  99.  
  100. ***************************************************************************}
  101.  
  102. { joystick }
  103. const
  104.   MM_JOY1MOVE         = $3A0;
  105.   MM_JOY2MOVE         = $3A1;
  106.   MM_JOY1ZMOVE        = $3A2;
  107.   MM_JOY2ZMOVE        = $3A3;
  108.   MM_JOY1BUTTONDOWN   = $3B5;
  109.   MM_JOY2BUTTONDOWN   = $3B6;
  110.   MM_JOY1BUTTONUP     = $3B7;
  111.   MM_JOY2BUTTONUP     = $3B8;
  112.  
  113. { MCI }
  114.   MM_MCINOTIFY        = $3B9;
  115.  
  116. { waveform output }
  117.   MM_WOM_OPEN         = $3BB;
  118.   MM_WOM_CLOSE        = $3BC;
  119.   MM_WOM_DONE         = $3BD;
  120.  
  121. { waveform input }
  122.   MM_WIM_OPEN         = $3BE;
  123.   MM_WIM_CLOSE        = $3BF;
  124.   MM_WIM_DATA         = $3C0;
  125.  
  126. { MIDI input }
  127.   MM_MIM_OPEN         = $3C1;
  128.   MM_MIM_CLOSE        = $3C2;
  129.   MM_MIM_DATA         = $3C3;
  130.   MM_MIM_LONGDATA     = $3C4;
  131.   MM_MIM_ERROR        = $3C5;
  132.   MM_MIM_LONGERROR    = $3C6;
  133.  
  134. { MIDI output }
  135.   MM_MOM_OPEN         = $3C7;
  136.   MM_MOM_CLOSE        = $3C8;
  137.   MM_MOM_DONE         = $3C9;
  138.  
  139.   MM_DRVM_OPEN        = $3D0;
  140.   MM_DRVM_CLOSE       = $3D1;
  141.   MM_DRVM_DATA        = $3D2;
  142.   MM_DRVM_ERROR       = $3D3;
  143.  
  144.   MM_STREAM_OPEN            = $3D4;
  145.   MM_STREAM_CLOSE           = $3D5;
  146.   MM_STREAM_DONE            = $3D6;
  147.   MM_STREAM_ERROR           = $3D7;
  148.  
  149.   MM_MOM_POSITIONCB   = $3CA;
  150.  
  151.   MM_MCISIGNAL        = $3CB;
  152.   MM_MIM_MOREDATA     = $3CC;
  153.  
  154.   MM_MIXM_LINE_CHANGE     = $3D0;
  155.   MM_MIXM_CONTROL_CHANGE  = $3D1;
  156.  
  157. {***************************************************************************
  158.  
  159.                 String resource number bases (internal use)
  160.  
  161. ***************************************************************************}
  162.  
  163. const
  164.   MMSYSERR_BASE          = 0;
  165.   WAVERR_BASE            = 32;
  166.   MIDIERR_BASE           = 64;
  167.   TIMERR_BASE            = 96;
  168.   JOYERR_BASE            = 160;
  169.   MCIERR_BASE            = 256;
  170.   MIXERR_BASE            = 1024;
  171.  
  172.   MCI_STRING_OFFSET      = 512;
  173.   MCI_VD_OFFSET          = 1024;
  174.   MCI_CD_OFFSET          = 1088;
  175.   MCI_WAVE_OFFSET        = 1152;
  176.   MCI_SEQ_OFFSET         = 1216;
  177.  
  178. {***************************************************************************
  179.  
  180.                         General error return values
  181.  
  182. ***************************************************************************}
  183.  
  184. { general error return values }
  185. const
  186.   MMSYSERR_NOERROR      = 0;                  { no error }
  187.   MMSYSERR_ERROR        = MMSYSERR_BASE + 1;  { unspecified error }
  188.   MMSYSERR_BADDEVICEID  = MMSYSERR_BASE + 2;  { device ID out of range }
  189.   MMSYSERR_NOTENABLED   = MMSYSERR_BASE + 3;  { driver failed enable }
  190.   MMSYSERR_ALLOCATED    = MMSYSERR_BASE + 4;  { device already allocated }
  191.   MMSYSERR_INVALHANDLE  = MMSYSERR_BASE + 5;  { device handle is invalid }
  192.   MMSYSERR_NODRIVER     = MMSYSERR_BASE + 6;  { no device driver present }
  193.   MMSYSERR_NOMEM        = MMSYSERR_BASE + 7;  { memory allocation error }
  194.   MMSYSERR_NOTSUPPORTED = MMSYSERR_BASE + 8;  { function isn't supported }
  195.   MMSYSERR_BADERRNUM    = MMSYSERR_BASE + 9;  { error value out of range }
  196.   MMSYSERR_INVALFLAG    = MMSYSERR_BASE + 10; { invalid flag passed }
  197.   MMSYSERR_INVALPARAM   = MMSYSERR_BASE + 11; { invalid parameter passed }
  198.   MMSYSERR_HANDLEBUSY   = MMSYSERR_BASE + 12; { handle being used
  199.                                                 simultaneously on another
  200.                                                 thread (eg callback) }
  201.   MMSYSERR_INVALIDALIAS = MMSYSERR_BASE + 13; { specified alias not found }
  202.   MMSYSERR_BADDB        = MMSYSERR_BASE + 14; { bad registry database }
  203.   MMSYSERR_KEYNOTFOUND  = MMSYSERR_BASE + 15; { registry key not found }
  204.   MMSYSERR_READERROR    = MMSYSERR_BASE + 16; { registry read error }
  205.   MMSYSERR_WRITEERROR   = MMSYSERR_BASE + 17; { registry write error }
  206.   MMSYSERR_DELETEERROR  = MMSYSERR_BASE + 18; { registry delete error }
  207.   MMSYSERR_VALNOTFOUND  = MMSYSERR_BASE + 19; { registry value not found }
  208.   MMSYSERR_NODRIVERCB   = MMSYSERR_BASE + 20; { driver does not call DriverCallback }
  209.   MMSYSERR_LASTERROR    = MMSYSERR_BASE + 20; { last error in range }
  210.  
  211. type
  212.   HDRVR = Integer;
  213.  
  214. {***************************************************************************
  215.  
  216.                         Installable driver support
  217.  
  218. ***************************************************************************}
  219.  
  220. type
  221.   PDrvConfigInfoEx = ^TDrvConfigInfoEx;
  222.   TDrvConfigInfoEx = packed record
  223.     dwDCISize: DWORD;
  224.     lpszDCISectionName: PWideChar;
  225.     lpszDCIAliasName: PWideChar;
  226.     dnDevNode: DWORD;
  227.   end;
  228.  
  229. const
  230. { Driver messages }
  231.   DRV_LOAD                = $0001;
  232.   DRV_ENABLE              = $0002;
  233.   DRV_OPEN                = $0003;
  234.   DRV_CLOSE               = $0004;
  235.   DRV_DISABLE             = $0005;
  236.   DRV_FREE                = $0006;
  237.   DRV_CONFIGURE           = $0007;
  238.   DRV_QUERYCONFIGURE      = $0008;
  239.   DRV_INSTALL             = $0009;
  240.   DRV_REMOVE              = $000A;
  241.   DRV_EXITSESSION         = $000B;
  242.   DRV_POWER               = $000F;
  243.   DRV_RESERVED            = $0800;
  244.   DRV_USER                = $4000;
  245.  
  246. type
  247. { LPARAM of DRV_CONFIGURE message }
  248.   PDrvConfigInfo = ^TDrvConfigInfo;
  249.   TDrvConfigInfo = packed record
  250.     dwDCISize: DWORD;
  251.     lpszDCISectionName: PWideChar;
  252.     lpszDCIAliasName: PWideChar;
  253.   end;
  254.  
  255. const
  256. { Supported return values for DRV_CONFIGURE message }
  257.   DRVCNF_CANCEL           = $0000;
  258.   DRVCNF_OK               = $0001;
  259.   DRVCNF_RESTART          = $0002;
  260.  
  261.  
  262. { installable driver function prototypes }
  263. type
  264.   TFNDriverProc = function(dwDriverId: DWORD; hdrvr: HDRVR;
  265.     msg: UINT; lparam1, lparam2: LPARAM): Longint stdcall;
  266.  
  267. function CloseDriver(hDriver: HDRVR; lParam1, lParam2: Longint): Longint; stdcall;
  268. function OpenDriver(szDriverName: PWideChar; szSectionName: PWideChar; lParam2: Longint): HDRVR; stdcall;
  269. function SendDriverMessage(hDriver: HDRVR; message: UINT; lParam1, lParam2: Longint): Longint; stdcall;
  270. function DrvGetModuleHandle(hDriver: HDRVR): HMODULE; stdcall;
  271. function GetDriverModuleHandle(hDriver: HDRVR): HMODULE; stdcall;
  272. function DefDriverProc(dwDriverIdentifier: DWORD; hdrvr: HDRVR; uMsg: UINT;
  273.   lParam1, lParam2: LPARAM): Longint; stdcall;
  274.  
  275. { return values from DriverProc() function }
  276. const
  277.   DRV_CANCEL             = DRVCNF_CANCEL;
  278.   DRV_OK                 = DRVCNF_OK;
  279.   DRV_RESTART            = DRVCNF_RESTART;
  280.  
  281.   DRV_MCI_FIRST          = DRV_RESERVED;
  282.   DRV_MCI_LAST           = DRV_RESERVED + $FFF;
  283.  
  284.  
  285. {***************************************************************************
  286.  
  287.                           Driver callback support
  288.  
  289. ***************************************************************************}
  290.  
  291. { flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and }
  292. { midiOutOpen() to specify the type of the dwCallback parameter. }
  293.  
  294. const
  295.   CALLBACK_TYPEMASK   = $00070000;    { callback type mask }
  296.   CALLBACK_NULL       = $00000000;    { no callback }
  297.   CALLBACK_WINDOW     = $00010000;    { dwCallback is a HWND }
  298.   CALLBACK_TASK       = $00020000;    { dwCallback is a HTASK }
  299.   CALLBACK_FUNCTION   = $00030000;    { dwCallback is a FARPROC }
  300.   CALLBACK_THREAD     = CALLBACK_TASK;{ thread ID replaces 16 bit task }
  301.   CALLBACK_EVENT      = $00050000;    { dwCallback is an EVENT Handle }
  302.  
  303. { driver callback prototypes }
  304.  
  305. type
  306.   TFNDrvCallBack = procedure(hdrvr: HDRVR; uMsg: UINT; dwUser: DWORD;
  307.     dw1, dw2: DWORD) stdcall;
  308.  
  309.  
  310. {***************************************************************************
  311.  
  312.                     General MMSYSTEM support
  313.  
  314. ***************************************************************************}
  315.  
  316. function mmsystemGetVersion: UINT; stdcall;
  317.  
  318. {***************************************************************************
  319.  
  320.                             Sound support
  321.  
  322. ***************************************************************************}
  323.  
  324. function sndPlaySoundA(lpszSoundName: PAnsiChar; uFlags: UINT): BOOL; stdcall;
  325. function sndPlaySoundW(lpszSoundName: PWideChar; uFlags: UINT): BOOL; stdcall;
  326. function sndPlaySound(lpszSoundName: PChar; uFlags: UINT): BOOL; stdcall;
  327.  
  328. { flag values for wFlags parameter }
  329. const
  330.   SND_SYNC            = $0000;  { play synchronously (default) }
  331.   SND_ASYNC           = $0001;  { play asynchronously }
  332.   SND_NODEFAULT       = $0002;  { don't use default sound }
  333.   SND_MEMORY          = $0004;  { lpszSoundName points to a memory file }
  334.   SND_LOOP            = $0008;  { loop the sound until next sndPlaySound }
  335.   SND_NOSTOP          = $0010;  { don't stop any currently playing sound }
  336.  
  337.   SND_NOWAIT          = $00002000;  { don't wait if the driver is busy }
  338.   SND_ALIAS           = $00010000;  { name is a registry alias }
  339.   SND_ALIAS_ID        = $00110000;  { alias is a predefined ID }
  340.   SND_FILENAME        = $00020000;  { name is file name }
  341.   SND_RESOURCE        = $00040004;  { name is resource name or atom }
  342.   SND_PURGE           = $0040;      { purge non-static events for task }
  343.   SND_APPLICATION     = $0080;      { look for application specific association }
  344.  
  345.   SND_ALIAS_START     = 0;   { alias base }
  346.  
  347.   SND_ALIAS_SYSTEMASTERISK       = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('*')) shl 8));
  348.   SND_ALIAS_SYSTEMQUESTION       = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('?')) shl 8));
  349.   SND_ALIAS_SYSTEMHAND           = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('H')) shl 8));
  350.   SND_ALIAS_SYSTEMEXIT           = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('E')) shl 8));
  351.   SND_ALIAS_SYSTEMSTART          = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('S')) shl 8));
  352.   SND_ALIAS_SYSTEMWELCOME        = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('W')) shl 8));
  353.   SND_ALIAS_SYSTEMEXCLAMATION    = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('!')) shl 8));
  354.   SND_ALIAS_SYSTEMDEFAULT        = SND_ALIAS_START + (Longint(Ord('S')) or (Longint(Ord('D')) shl 8));
  355.  
  356. function PlaySoundA(pszSound: PAnsiChar; hmod: HMODULE; fdwSound: DWORD): BOOL; stdcall;
  357. function PlaySoundW(pszSound: PWideChar; hmod: HMODULE; fdwSound: DWORD): BOOL; stdcall;
  358. function PlaySound(pszSound: PChar; hmod: HMODULE; fdwSound: DWORD): BOOL; stdcall;
  359.  
  360. {***************************************************************************
  361.  
  362.                         Waveform audio support
  363.  
  364. ***************************************************************************}
  365.  
  366. { waveform audio error return values }
  367. const
  368.   WAVERR_BADFORMAT      = WAVERR_BASE + 0;    { unsupported wave format }
  369.   WAVERR_STILLPLAYING   = WAVERR_BASE + 1;    { still something playing }
  370.   WAVERR_UNPREPARED     = WAVERR_BASE + 2;    { header not prepared }
  371.   WAVERR_SYNC           = WAVERR_BASE + 3;    { device is synchronous }
  372.   WAVERR_LASTERROR      = WAVERR_BASE + 3;    { last error in range }
  373.  
  374. { waveform audio data types }
  375. type
  376.   PHWAVE = ^HWAVE;
  377.   HWAVE = Integer;
  378.   PHWAVEIN = ^HWAVEIN;
  379.   HWAVEIN = Integer;
  380.   PHWAVEOUT = ^HWAVEOUT;
  381.   HWAVEOUT = Integer;
  382.  
  383. type
  384.   TFNWaveCallBack = TFNDrvCallBack;
  385.  
  386. { wave callback messages }
  387. const
  388.   WOM_OPEN        = MM_WOM_OPEN;
  389.   WOM_CLOSE       = MM_WOM_CLOSE;
  390.   WOM_DONE        = MM_WOM_DONE;
  391.   WIM_OPEN        = MM_WIM_OPEN;
  392.   WIM_CLOSE       = MM_WIM_CLOSE;
  393.   WIM_DATA        = MM_WIM_DATA;
  394.  
  395. { device ID for wave device mapper }
  396.   WAVE_MAPPER     = UINT(-1);
  397.  
  398. { flags for dwFlags parameter in waveOutOpen() and waveInOpen() }
  399.   WAVE_FORMAT_QUERY     = $0001;
  400.   WAVE_ALLOWSYNC        = $0002;
  401.   WAVE_MAPPED           = $0004;
  402.  
  403. { wave data block header }
  404. type
  405.   PWaveHdr = ^TWaveHdr;
  406.   TWaveHdr = record
  407.     lpData: PChar;              { pointer to locked data buffer }
  408.     dwBufferLength: DWORD;      { length of data buffer }
  409.     dwBytesRecorded: DWORD;     { used for input only }
  410.     dwUser: DWORD;              { for client's use }
  411.     dwFlags: DWORD;             { assorted flags (see defines) }
  412.     dwLoops: DWORD;             { loop control counter }
  413.     lpNext: PWaveHdr;           { reserved for driver }
  414.     reserved: DWORD;            { reserved for driver }
  415.   end;
  416.  
  417.  
  418. { flags for dwFlags field of WAVEHDR }
  419. const
  420.   WHDR_DONE       = $00000001;  { done bit }
  421.   WHDR_PREPARED   = $00000002;  { set if this header has been prepared }
  422.   WHDR_BEGINLOOP  = $00000004;  { loop start block }
  423.   WHDR_ENDLOOP    = $00000008;  { loop end block }
  424.   WHDR_INQUEUE    = $00000010;  { reserved for driver }
  425.  
  426. { waveform output device capabilities structure }
  427. type
  428.   PWaveOutCapsA = ^TWaveOutCapsA;
  429.   PWaveOutCapsW = ^TWaveOutCapsW;
  430.   PWaveOutCaps = PWaveOutCapsA;
  431.   TWaveOutCapsA = record
  432.     wMid: Word;                 { manufacturer ID }
  433.     wPid: Word;                 { product ID }
  434.     vDriverVersion: MMVERSION;       { version of the driver }
  435.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;  { product name (NULL terminated string) }
  436.     dwFormats: DWORD;          { formats supported }
  437.     wChannels: Word;            { number of sources supported }
  438.     dwSupport: DWORD;          { functionality supported by driver }
  439.   end;
  440.   TWaveOutCapsW = record
  441.     wMid: Word;                 { manufacturer ID }
  442.     wPid: Word;                 { product ID }
  443.     vDriverVersion: MMVERSION;       { version of the driver }
  444.     szPname: array[0..MAXPNAMELEN-1] of WideChar;  { product name (NULL terminated string) }
  445.     dwFormats: DWORD;          { formats supported }
  446.     wChannels: Word;            { number of sources supported }
  447.     dwSupport: DWORD;          { functionality supported by driver }
  448.   end;
  449.   TWaveOutCaps = TWaveOutCapsA;
  450.  
  451.  
  452. { flags for dwSupport field of WAVEOUTCAPS }
  453. const
  454.   WAVECAPS_PITCH          = $0001;   { supports pitch control }
  455.   WAVECAPS_PLAYBACKRATE   = $0002;   { supports playback rate control }
  456.   WAVECAPS_VOLUME         = $0004;   { supports volume control }
  457.   WAVECAPS_LRVOLUME       = $0008;   { separate left-right volume control }
  458.   WAVECAPS_SYNC           = $0010;
  459.   WAVECAPS_SAMPLEACCURATE = $0020;
  460.   WAVECAPS_DIRECTSOUND    = $0040;
  461.  
  462. { waveform input device capabilities structure }
  463. type
  464.   PWaveInCapsA = ^TWaveInCapsA;
  465.   PWaveInCapsW = ^TWaveInCapsW;
  466.   PWaveInCaps = PWaveInCapsA;
  467.   TWaveInCapsA = record
  468.     wMid: Word;                   { manufacturer ID }
  469.     wPid: Word;                   { product ID }
  470.     vDriverVersion: MMVERSION;         { version of the driver }
  471.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;    { product name (NULL terminated string) }
  472.     dwFormats: DWORD;             { formats supported }
  473.     wChannels: Word;              { number of channels supported }
  474.     wReserved1: Word;             { structure packing }
  475.   end;
  476.   TWaveInCapsW = record
  477.     wMid: Word;                   { manufacturer ID }
  478.     wPid: Word;                   { product ID }
  479.     vDriverVersion: MMVERSION;         { version of the driver }
  480.     szPname: array[0..MAXPNAMELEN-1] of WideChar;    { product name (NULL terminated string) }
  481.     dwFormats: DWORD;             { formats supported }
  482.     wChannels: Word;              { number of channels supported }
  483.     wReserved1: Word;             { structure packing }
  484.   end;
  485.   TWaveInCaps = TWaveInCapsA;
  486.  
  487.  
  488. { defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS }
  489. const
  490.   WAVE_INVALIDFORMAT     = $00000000;       { invalid format }
  491.   WAVE_FORMAT_1M08       = $00000001;       { 11.025 kHz, Mono,   8-bit  }
  492.   WAVE_FORMAT_1S08       = $00000002;       { 11.025 kHz, Stereo, 8-bit  }
  493.   WAVE_FORMAT_1M16       = $00000004;       { 11.025 kHz, Mono,   16-bit }
  494.   WAVE_FORMAT_1S16       = $00000008;       { 11.025 kHz, Stereo, 16-bit }
  495.   WAVE_FORMAT_2M08       = $00000010;       { 22.05  kHz, Mono,   8-bit  }
  496.   WAVE_FORMAT_2S08       = $00000020;       { 22.05  kHz, Stereo, 8-bit  }
  497.   WAVE_FORMAT_2M16       = $00000040;       { 22.05  kHz, Mono,   16-bit }
  498.   WAVE_FORMAT_2S16       = $00000080;       { 22.05  kHz, Stereo, 16-bit }
  499.   WAVE_FORMAT_4M08       = $00000100;       { 44.1   kHz, Mono,   8-bit  }
  500.   WAVE_FORMAT_4S08       = $00000200;       { 44.1   kHz, Stereo, 8-bit  }
  501.   WAVE_FORMAT_4M16       = $00000400;       { 44.1   kHz, Mono,   16-bit }
  502.   WAVE_FORMAT_4S16       = $00000800;       { 44.1   kHz, Stereo, 16-bit }
  503.  
  504. { general waveform format structure (information common to all formats) }
  505. type
  506.   PWaveFormat = ^TWaveFormat;
  507.   TWaveFormat = packed record
  508.     wFormatTag: Word;         { format type }
  509.     nChannels: Word;          { number of channels (i.e. mono, stereo, etc.) }
  510.     nSamplesPerSec: DWORD;  { sample rate }
  511.     nAvgBytesPerSec: DWORD; { for buffer estimation }
  512.     nBlockAlign: Word;      { block size of data }
  513.   end;
  514.  
  515. { flags for wFormatTag field of WAVEFORMAT }
  516. const
  517.   WAVE_FORMAT_PCM     = 1;
  518.  
  519. { specific waveform format structure for PCM data }
  520. type
  521.   PPCMWaveFormat = ^TPCMWaveFormat;
  522.   TPCMWaveFormat = record
  523.       wf: TWaveFormat;
  524.       wBitsPerSample: Word;
  525.    end;
  526.  
  527.  
  528. { extended waveform format structure used for all non-PCM formats. this
  529.   structure is common to all non-PCM formats. }
  530.  
  531.   PWaveFormatEx = ^TWaveFormatEx;
  532.   TWaveFormatEx = packed record
  533.     wFormatTag: Word;         { format type }
  534.     nChannels: Word;          { number of channels (i.e. mono, stereo, etc.) }
  535.     nSamplesPerSec: DWORD;  { sample rate }
  536.     nAvgBytesPerSec: DWORD; { for buffer estimation }
  537.     nBlockAlign: Word;      { block size of data }
  538.     wBitsPerSample: Word;   { number of bits per sample of mono data }
  539.     cbSize: Word;           { the count in bytes of the size of }
  540.   end;
  541.  
  542.  
  543. { waveform audio function prototypes }
  544. function waveOutGetNumDevs: UINT; stdcall;
  545.  
  546. function waveOutGetDevCapsA(uDeviceID: UINT; lpCaps: PWaveOutCapsA; uSize: UINT): MMRESULT; stdcall;
  547. function waveOutGetDevCapsW(uDeviceID: UINT; lpCaps: PWaveOutCapsW; uSize: UINT): MMRESULT; stdcall;
  548. function waveOutGetDevCaps(uDeviceID: UINT; lpCaps: PWaveOutCaps; uSize: UINT): MMRESULT; stdcall;
  549. function waveOutGetVolume(hwo: HWAVEOUT; lpdwVolume: PDWORD): MMRESULT; stdcall;
  550. function waveOutSetVolume(hwo: HWAVEOUT; dwVolume: DWORD): MMRESULT; stdcall;
  551. function waveOutGetErrorTextA(mmrError: MMRESULT; lpText: PAnsiChar; uSize: UINT): MMRESULT; stdcall;
  552. function waveOutGetErrorTextW(mmrError: MMRESULT; lpText: PWideChar; uSize: UINT): MMRESULT; stdcall;
  553. function waveOutGetErrorText(mmrError: MMRESULT; lpText: PChar; uSize: UINT): MMRESULT; stdcall;
  554. function waveOutOpen(lphWaveOut: PHWaveOut; uDeviceID: UINT;
  555.   lpFormat: PWaveFormatEx; dwCallback, dwInstance, dwFlags: DWORD): MMRESULT; stdcall;
  556. function waveOutClose(hWaveOut: HWAVEOUT): MMRESULT; stdcall;
  557. function waveOutPrepareHeader(hWaveOut: HWAVEOUT; lpWaveOutHdr: PWaveHdr;
  558.   uSize: UINT): MMRESULT; stdcall;
  559. function waveOutUnprepareHeader(hWaveOut: HWAVEOUT; lpWaveOutHdr: PWaveHdr;
  560.   uSize: UINT): MMRESULT; stdcall;
  561. function waveOutWrite(hWaveOut: HWAVEOUT; lpWaveOutHdr: PWaveHdr;
  562.   uSize: UINT): MMRESULT; stdcall;
  563. function waveOutPause(hWaveOut: HWAVEOUT): MMRESULT; stdcall;
  564. function waveOutRestart(hWaveOut: HWAVEOUT): MMRESULT; stdcall;
  565. function waveOutReset(hWaveOut: HWAVEOUT): MMRESULT; stdcall;
  566. function waveOutBreakLoop(hWaveOut: HWAVEOUT): MMRESULT; stdcall;
  567. function waveOutGetPosition(hWaveOut: HWAVEOUT; lpInfo: PMMTime; uSize: UINT): MMRESULT; stdcall;
  568. function waveOutGetPitch(hWaveOut: HWAVEOUT; lpdwPitch: PDWORD): MMRESULT; stdcall;
  569. function waveOutSetPitch(hWaveOut: HWAVEOUT; dwPitch: DWORD): MMRESULT; stdcall;
  570. function waveOutGetPlaybackRate(hWaveOut: HWAVEOUT; lpdwRate: PDWORD): MMRESULT; stdcall;
  571. function waveOutSetPlaybackRate(hWaveOut: HWAVEOUT; dwRate: DWORD): MMRESULT; stdcall;
  572. function waveOutGetID(hWaveOut: HWAVEOUT; lpuDeviceID: PUINT): MMRESULT; stdcall;
  573. function waveOutMessage(hWaveOut: HWAVEOUT; uMessage: UINT; dw1, dw2: DWORD): Longint; stdcall;
  574. function waveInGetNumDevs: UINT; stdcall;
  575. function waveInGetDevCapsA(hwo: HWAVEOUT; lpCaps: PWaveInCapsA; uSize: UINT): MMRESULT; stdcall;
  576. function waveInGetDevCapsW(hwo: HWAVEOUT; lpCaps: PWaveInCapsW; uSize: UINT): MMRESULT; stdcall;
  577. function waveInGetDevCaps(hwo: HWAVEOUT; lpCaps: PWaveInCaps; uSize: UINT): MMRESULT; stdcall;
  578. function waveInGetErrorTextA(mmrError: MMRESULT; lpText: PAnsiChar; uSize: UINT): MMRESULT; stdcall;
  579. function waveInGetErrorTextW(mmrError: MMRESULT; lpText: PWideChar; uSize: UINT): MMRESULT; stdcall;
  580. function waveInGetErrorText(mmrError: MMRESULT; lpText: PChar; uSize: UINT): MMRESULT; stdcall;
  581. function waveInOpen(lphWaveIn: PHWAVEIN; uDeviceID: UINT;
  582.   lpFormatEx: PWaveFormatEx; dwCallback, dwInstance, dwFlags: DWORD): MMRESULT; stdcall;
  583. function waveInClose(hWaveIn: HWAVEIN): MMRESULT; stdcall;
  584. function waveInPrepareHeader(hWaveIn: HWAVEIN; lpWaveInHdr: PWaveHdr;
  585.   uSize: UINT): MMRESULT; stdcall;
  586. function waveInUnprepareHeader(hWaveIn: HWAVEIN; lpWaveInHdr: PWaveHdr;
  587.   uSize: UINT): MMRESULT; stdcall;
  588. function waveInAddBuffer(hWaveIn: HWAVEIN; lpWaveInHdr: PWaveHdr;
  589.   uSize: UINT): MMRESULT; stdcall;
  590. function waveInStart(hWaveIn: HWAVEIN): MMRESULT; stdcall;
  591. function waveInStop(hWaveIn: HWAVEIN): MMRESULT; stdcall;
  592. function waveInReset(hWaveIn: HWAVEIN): MMRESULT; stdcall;
  593. function waveInGetPosition(hWaveIn: HWAVEIN; lpInfo: PMMTime;
  594.   uSize: UINT): MMRESULT; stdcall;
  595. function waveInGetID(hWaveIn: HWAVEIN; lpuDeviceID: PUINT): MMRESULT; stdcall;
  596. function waveInMessage(hWaveIn: HWAVEIN; uMessage: UINT;
  597.   dw1, dw2: DWORD): MMRESULT; stdcall;
  598.  
  599. {***************************************************************************
  600.  
  601.                             MIDI audio support
  602.  
  603. ***************************************************************************}
  604.  
  605. { MIDI error return values }
  606. const
  607.   MIDIERR_UNPREPARED    = MIDIERR_BASE + 0;   { header not prepared }
  608.   MIDIERR_STILLPLAYING  = MIDIERR_BASE + 1;   { still something playing }
  609.   MIDIERR_NOMAP         = MIDIERR_BASE + 2;   { no current map }
  610.   MIDIERR_NOTREADY      = MIDIERR_BASE + 3;   { hardware is still busy }
  611.   MIDIERR_NODEVICE      = MIDIERR_BASE + 4;   { port no longer connected }
  612.   MIDIERR_INVALIDSETUP  = MIDIERR_BASE + 5;   { invalid setup }
  613.   MIDIERR_BADOPENMODE   = MIDIERR_BASE + 6;   { operation unsupported w/ open mode }
  614.   MIDIERR_DONT_CONTINUE = MIDIERR_BASE + 7;   { thru device 'eating' a message }
  615.   MIDIERR_LASTERROR     = MIDIERR_BASE + 5;   { last error in range }
  616.  
  617. { MIDI audio data types }
  618. type
  619.   PHMIDI = ^HMIDI;
  620.   HMIDI = Integer;
  621.   PHMIDIIN = ^HMIDIIN;
  622.   HMIDIIN = Integer;
  623.   PHMIDIOUT = ^HMIDIOUT;
  624.   HMIDIOUT = Integer;
  625.   PHMIDISTRM = ^HMIDISTRM;
  626.   HMIDISTRM = Integer;
  627.  
  628. type
  629.   TFNMidiCallBack = TFNDrvCallBack;
  630.  
  631. const
  632.   MIDIPATCHSIZE   = 128;
  633.  
  634. type
  635.   PPatchArray = ^TPatchArray;
  636.   TPatchArray = array[0..MIDIPATCHSIZE-1] of Word;
  637.  
  638.   PKeyArray = ^TKeyArray;
  639.   TKeyArray = array[0..MIDIPATCHSIZE-1] of Word;
  640.  
  641.  
  642. { MIDI callback messages }
  643. const
  644.   MIM_OPEN        = MM_MIM_OPEN;
  645.   MIM_CLOSE       = MM_MIM_CLOSE;
  646.   MIM_DATA        = MM_MIM_DATA;
  647.   MIM_LONGDATA    = MM_MIM_LONGDATA;
  648.   MIM_ERROR       = MM_MIM_ERROR;
  649.   MIM_LONGERROR   = MM_MIM_LONGERROR;
  650.   MOM_OPEN        = MM_MOM_OPEN;
  651.   MOM_CLOSE       = MM_MOM_CLOSE;
  652.   MOM_DONE        = MM_MOM_DONE;
  653.  
  654.   MIM_MOREDATA    = MM_MIM_MOREDATA;
  655.   MOM_POSITIONCB  = MM_MOM_POSITIONCB;
  656.  
  657. { device ID for MIDI mapper }
  658.   MIDIMAPPER     = UINT(-1);
  659.   MIDI_MAPPER    = UINT(-1);
  660.  
  661. { flags for dwFlags parm of midiInOpen() }
  662.   MIDI_IO_STATUS = $00000020;
  663.  
  664. { flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() }
  665.   MIDI_CACHE_ALL      = 1;
  666.   MIDI_CACHE_BESTFIT  = 2;
  667.   MIDI_CACHE_QUERY    = 3;
  668.   MIDI_UNCACHE        = 4;
  669.  
  670. { MIDI output device capabilities structure }
  671. type
  672.   PMidiOutCapsA = ^TMidiOutCapsA;
  673.   PMidiOutCapsW = ^TMidiOutCapsW;
  674.   PMidiOutCaps = PMidiOutCapsA;
  675.   TMidiOutCapsA = record
  676.     wMid: Word;                  { manufacturer ID }
  677.     wPid: Word;                  { product ID }
  678.     vDriverVersion: MMVERSION;        { version of the driver }
  679.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;  { product name (NULL terminated string) }
  680.     wTechnology: Word;           { type of device }
  681.     wVoices: Word;               { # of voices (internal synth only) }
  682.     wNotes: Word;                { max # of notes (internal synth only) }
  683.     wChannelMask: Word;          { channels used (internal synth only) }
  684.     dwSupport: DWORD;            { functionality supported by driver }
  685.   end;
  686.   TMidiOutCapsW = record
  687.     wMid: Word;                  { manufacturer ID }
  688.     wPid: Word;                  { product ID }
  689.     vDriverVersion: MMVERSION;        { version of the driver }
  690.     szPname: array[0..MAXPNAMELEN-1] of WideChar;  { product name (NULL terminated string) }
  691.     wTechnology: Word;           { type of device }
  692.     wVoices: Word;               { # of voices (internal synth only) }
  693.     wNotes: Word;                { max # of notes (internal synth only) }
  694.     wChannelMask: Word;          { channels used (internal synth only) }
  695.     dwSupport: DWORD;            { functionality supported by driver }
  696.   end;
  697.   TMidiOutCaps = TMidiOutCapsA;
  698.  
  699.  
  700. { flags for wTechnology field of MIDIOUTCAPS structure }
  701. const
  702.   MOD_MIDIPORT    = 1;  { output port }
  703.   MOD_SYNTH       = 2;  { generic internal synth }
  704.   MOD_SQSYNTH     = 3;  { square wave internal synth }
  705.   MOD_FMSYNTH     = 4;  { FM internal synth }
  706.   MOD_MAPPER      = 5;  { MIDI mapper }
  707.  
  708. { flags for dwSupport field of MIDIOUTCAPS structure }
  709. const
  710.   MIDICAPS_VOLUME          = $0001;  { supports volume control }
  711.   MIDICAPS_LRVOLUME        = $0002;  { separate left-right volume control }
  712.   MIDICAPS_CACHE           = $0004;
  713.   MIDICAPS_STREAM          = $0008;  { driver supports midiStreamOut directly }
  714.  
  715. { MIDI output device capabilities structure }
  716.  
  717. type
  718.   PMidiInCapsA = ^TMidiInCapsA;
  719.   PMidiInCapsW = ^TMidiInCapsW;
  720.   PMidiInCaps = PMidiInCapsA;
  721.   TMidiInCapsA = record
  722.     wMid: Word;                  { manufacturer ID }
  723.     wPid: Word;                  { product ID }
  724.     vDriverVersion: MMVERSION;   { version of the driver }
  725.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;  { product name (NULL terminated string) }
  726.     dwSupport: DWORD;            { functionality supported by driver }
  727.   end;
  728.   TMidiInCapsW = record
  729.     wMid: Word;                  { manufacturer ID }
  730.     wPid: Word;                  { product ID }
  731.     vDriverVersion: MMVERSION;   { version of the driver }
  732.     szPname: array[0..MAXPNAMELEN-1] of WideChar;  { product name (NULL terminated string) }
  733.     dwSupport: DWORD;            { functionality supported by driver }
  734.   end;
  735.   TMidiInCaps = TMidiInCapsA;
  736.  
  737. { MIDI data block header }
  738. type
  739.   PMidiHdr = ^TMidiHdr;
  740.   TMidiHdr = record
  741.     lpData: PChar;               { pointer to locked data block }
  742.     dwBufferLength: DWORD;       { length of data in data block }
  743.     dwBytesRecorded: DWORD;      { used for input only }
  744.     dwUser: DWORD;               { for client's use }
  745.     dwFlags: DWORD;              { assorted flags (see defines) }
  746.     lpNext: PMidiHdr;            { reserved for driver }
  747.     reserved: DWORD;             { reserved for driver }
  748.     dwOffset: DWORD;             { Callback offset into buffer }
  749.     dwReserved: array[0..7] of DWORD; { Reserved for MMSYSTEM }
  750.   end;
  751.  
  752.   PMidiEvent = ^TMidiEvent;
  753.   TMidiEvent = record
  754.     dwDeltaTime: DWORD;          { Ticks since last event }
  755.     dwStreamID: DWORD;           { Reserved; must be zero }
  756.     dwEvent: DWORD;              { Event type and parameters }
  757.     dwParms: array[0..0] of DWORD;  { Parameters if this is a long event }
  758.   end;
  759.  
  760.   PMidiStrmBuffVer = ^TMidiStrmBuffVer;
  761.   TMidiStrmBuffVer = record
  762.     dwVersion: DWORD;                  { Stream buffer format version }
  763.     dwMid: DWORD;                      { Manufacturer ID as defined in MMREG.H }
  764.     dwOEMVersion: DWORD;               { Manufacturer version for custom ext }
  765.   end;
  766.  
  767. { flags for dwFlags field of MIDIHDR structure }
  768. const
  769.   MHDR_DONE       = $00000001;       { done bit }
  770.   MHDR_PREPARED   = $00000002;       { set if header prepared }
  771.   MHDR_INQUEUE    = $00000004;       { reserved for driver }
  772.   MHDR_ISSTRM     = $00000008;       { Buffer is stream buffer }
  773.  
  774. (*
  775.   Type codes which go in the high byte of the event DWORD of a stream buffer
  776.  
  777.   Type codes 00-7F contain parameters within the low 24 bits
  778.   Type codes 80-FF contain a length of their parameter in the low 24
  779.   bits, followed by their parameter data in the buffer. The event
  780.   DWORD contains the exact byte length; the parm data itself must be
  781.   padded to be an even multiple of 4 bytes long.
  782. *)
  783.  
  784.   MEVT_F_SHORT       = $00000000;
  785.   MEVT_F_LONG        = $80000000;
  786.   MEVT_F_CALLBACK    = $40000000;
  787.  
  788.   MEVT_SHORTMSG     = $00;    { parm = shortmsg for midiOutShortMsg }
  789.   MEVT_TEMPO        = $01;    { parm = new tempo in microsec/qn     }
  790.   MEVT_NOP          = $02;    { parm = unused; does nothing         }
  791.  
  792. { 0x04-0x7F reserved }
  793.  
  794.   MEVT_LONGMSG      = $80;    { parm = bytes to send verbatim       }
  795.   MEVT_COMMENT      = $82;    { parm = comment data                 }
  796.   MEVT_VERSION      = $84;    { parm = MIDISTRMBUFFVER struct       }
  797.  
  798. { 0x81-0xFF reserved }
  799.  
  800.   MIDISTRM_ERROR    =  -2;
  801.  
  802. { Structures and defines for midiStreamProperty }
  803.   MIDIPROP_SET       = $80000000;
  804.   MIDIPROP_GET       = $40000000;
  805.  
  806. { These are intentionally both non-zero so the app cannot accidentally
  807.   leave the operation off and happen to appear to work due to default
  808.   action. }
  809.   MIDIPROP_TIMEDIV   = $00000001;
  810.   MIDIPROP_TEMPO     = $00000002;
  811.  
  812. type
  813.   PMidiPropTimeDiv = ^TMidiPropTimeDiv;
  814.   TMidiPropTimeDiv = record
  815.     cbStruct: DWORD;
  816.     dwTimeDiv: DWORD;
  817.   end;
  818.  
  819.   PMidiPropTempo = ^TMidiPropTempo;
  820.   TMidiPropTempo = record
  821.     cbStruct: DWORD;
  822.     dwTempo: DWORD;
  823.   end;
  824.  
  825. { MIDI function prototypes }
  826.  
  827. function midiOutGetNumDevs: UINT; stdcall;
  828. function midiStreamOpen(phms: PHMIDISTRM; puDeviceID: PUINT;
  829.   cMidi, dwCallback, dwInstance, fdwOpen: DWORD): MMRESULT; stdcall
  830. function midiStreamClose(hms: HMIDISTRM): MMRESULT; stdcall;
  831. function midiStreamProperty(hms: HMIDISTRM; lppropdata: PBYTE; dwProperty: DWORD): MMRESULT; stdcall;
  832. function midiStreamPosition(hms: HMIDISTRM; lpmmt: PMMTime; cbmmt: UINT): MMRESULT; stdcall;
  833. function midiStreamOut(hms: HMIDISTRM; pmh: PMidiHdr; cbmh: UINT): MMRESULT; stdcall;
  834. function midiStreamPause(hms: HMIDISTRM): MMRESULT; stdcall;
  835. function midiStreamRestart(hms: HMIDISTRM): MMRESULT; stdcall;
  836. function midiStreamStop(hms: HMIDISTRM): MMRESULT; stdcall;
  837. function midiConnect(hmi: HMIDI; hmo: HMIDIOUT; pReserved: Pointer): MMRESULT; stdcall;
  838. function midiDisconnect(hmi: HMIDI; hmo: HMIDIOUT; pReserved: Pointer): MMRESULT; stdcall;
  839. function midiOutGetDevCapsA(uDeviceID: UINT; lpCaps: PMidiOutCapsA; uSize: UINT): MMRESULT; stdcall;
  840. function midiOutGetDevCapsW(uDeviceID: UINT; lpCaps: PMidiOutCapsW; uSize: UINT): MMRESULT; stdcall;
  841. function midiOutGetDevCaps(uDeviceID: UINT; lpCaps: PMidiOutCaps; uSize: UINT): MMRESULT; stdcall;
  842. function midiOutGetVolume(hmo: HMIDIOUT; lpdwVolume: PDWORD): MMRESULT; stdcall;
  843. function midiOutSetVolume(hmo: HMIDIOUT; dwVolume: DWORD): MMRESULT; stdcall;
  844. function midiOutGetErrorTextA(mmrError: MMRESULT; pszText: PAnsiChar; uSize: UINT): MMRESULT; stdcall;
  845. function midiOutGetErrorTextW(mmrError: MMRESULT; pszText: PWideChar; uSize: UINT): MMRESULT; stdcall;
  846. function midiOutGetErrorText(mmrError: MMRESULT; pszText: PChar; uSize: UINT): MMRESULT; stdcall;
  847. function midiOutOpen(lphMidiOut: PHMIDIOUT; uDeviceID: UINT;
  848.   dwCallback, dwInstance, dwFlags: DWORD): MMRESULT; stdcall;
  849. function midiOutClose(hMidiOut: HMIDIOUT): MMRESULT; stdcall;
  850. function midiOutPrepareHeader(hMidiOut: HMIDIOUT; lpMidiOutHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  851. function midiOutUnprepareHeader(hMidiOut: HMIDIOUT; lpMidiOutHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  852. function midiOutShortMsg(hMidiOut: HMIDIOUT; dwMsg: DWORD): MMRESULT; stdcall;
  853. function midiOutLongMsg(hMidiOut: HMIDIOUT; lpMidiOutHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  854. function midiOutReset(hMidiOut: HMIDIOUT): MMRESULT; stdcall;
  855. function midiOutCachePatches(hMidiOut: HMIDIOUT;
  856.   uBank: UINT; lpwPatchArray: PWord; uFlags: UINT): MMRESULT; stdcall;
  857. function midiOutCacheDrumPatches(hMidiOut: HMIDIOUT;
  858.   uPatch: UINT; lpwKeyArray: PWord; uFlags: UINT): MMRESULT; stdcall;
  859. function midiOutGetID(hMidiOut: HMIDIOUT; lpuDeviceID: PUINT): MMRESULT; stdcall;
  860. function midiOutMessage(hMidiOut: HMIDIOUT; uMessage: UINT; dw1, dw2: DWORD): MMRESULT; stdcall;
  861. function midiInGetNumDevs: UINT; stdcall;
  862. function midiInGetDevCapsA(DeviceID: UINT; lpCaps: PMidiInCapsA; uSize: UINT): MMRESULT; stdcall;
  863. function midiInGetDevCapsW(DeviceID: UINT; lpCaps: PMidiInCapsW; uSize: UINT): MMRESULT; stdcall;
  864. function midiInGetDevCaps(DeviceID: UINT; lpCaps: PMidiInCaps; uSize: UINT): MMRESULT; stdcall;
  865. function midiInGetErrorTextA(mmrError: MMRESULT; pszText: PAnsiChar; uSize: UINT): MMRESULT; stdcall;
  866. function midiInGetErrorTextW(mmrError: MMRESULT; pszText: PWideChar; uSize: UINT): MMRESULT; stdcall;
  867. function midiInGetErrorText(mmrError: MMRESULT; pszText: PChar; uSize: UINT): MMRESULT; stdcall;
  868. function midiInOpen(lphMidiIn: PHMIDIIN; uDeviceID: UINT;
  869.   dwCallback, dwInstance, dwFlags: DWORD): MMRESULT; stdcall;
  870. function midiInClose(hMidiIn: HMIDIIN): MMRESULT; stdcall;
  871. function midiInPrepareHeader(hMidiIn: HMIDIIN; lpMidiInHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  872. function midiInUnprepareHeader(hMidiIn: HMIDIIN; lpMidiInHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  873. function midiInAddBuffer(hMidiIn: HMIDIIN; lpMidiInHdr: PMidiHdr; uSize: UINT): MMRESULT; stdcall;
  874. function midiInStart(hMidiIn: HMIDIIN): MMRESULT; stdcall;
  875. function midiInStop(hMidiIn: HMIDIIN): MMRESULT; stdcall;
  876. function midiInReset(hMidiIn: HMIDIIN): MMRESULT; stdcall;
  877. function midiInGetID(hMidiIn: HMIDIIN; lpuDeviceID: PUINT): MMRESULT; stdcall;
  878. function midiInMessage(hMidiIn: HMIDIIN; uMessage: UINT; dw1, dw2: DWORD): MMRESULT; stdcall;
  879.  
  880.  
  881. {***************************************************************************
  882.  
  883.                         Auxiliary audio support
  884.  
  885. ***************************************************************************}
  886.  
  887. { device ID for aux device mapper }
  888. const
  889.   AUX_MAPPER     = UINT(-1);
  890.  
  891. { Auxiliary audio device capabilities structure }
  892. type
  893.   PAuxCapsA = ^TAuxCapsA;
  894.   PAuxCapsW = ^TAuxCapsW;
  895.   PAuxCaps = PAuxCapsA;
  896.   TAuxCapsA = record
  897.     wMid: Word;                  { manufacturer ID }
  898.     wPid: Word;                  { product ID }
  899.     vDriverVersion: MMVERSION;        { version of the driver }
  900.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;  { product name (NULL terminated string) }
  901.     wTechnology: Word;           { type of device }
  902.     dwSupport: DWORD;            { functionality supported by driver }
  903.   end;
  904.   TAuxCapsW = record
  905.     wMid: Word;                  { manufacturer ID }
  906.     wPid: Word;                  { product ID }
  907.     vDriverVersion: MMVERSION;        { version of the driver }
  908.     szPname: array[0..MAXPNAMELEN-1] of WideChar;  { product name (NULL terminated string) }
  909.     wTechnology: Word;           { type of device }
  910.     dwSupport: DWORD;            { functionality supported by driver }
  911.   end;
  912.   TAuxCaps = TAuxCapsA;
  913.  
  914. { flags for wTechnology field in AUXCAPS structure }
  915. const
  916.   AUXCAPS_CDAUDIO    = 1;       { audio from internal CD-ROM drive }
  917.   AUXCAPS_AUXIN      = 2;       { audio from auxiliary input jacks }
  918.  
  919. { flags for dwSupport field in AUXCAPS structure }
  920. const
  921.   AUXCAPS_VOLUME     = $0001;  { supports volume control }
  922.   AUXCAPS_LRVOLUME   = $0002;  { separate left-right volume control }
  923.  
  924. { auxiliary audio function prototypes }
  925. function auxGetNumDevs: UINT; stdcall;
  926. function auxGetDevCapsA(uDeviceID: UINT; lpCaps: PAuxCapsA; uSize: UINT): MMRESULT; stdcall;
  927. function auxGetDevCapsW(uDeviceID: UINT; lpCaps: PAuxCapsW; uSize: UINT): MMRESULT; stdcall;
  928. function auxGetDevCaps(uDeviceID: UINT; lpCaps: PAuxCaps; uSize: UINT): MMRESULT; stdcall;
  929. function auxSetVolume(uDeviceID: UINT; dwVolume: DWORD): MMRESULT; stdcall;
  930. function auxGetVolume(uDeviceID: UINT; lpdwVolume: PDWORD): MMRESULT; stdcall;
  931. function auxOutMessage(uDeviceID, uMessage: UINT; dw1, dw2: DWORD): MMRESULT; stdcall;
  932.  
  933.  
  934. {****************************************************************************
  935.  
  936.                             Mixer Support
  937.  
  938. ****************************************************************************}
  939.  
  940. type
  941.   PHMIXEROBJ = ^HMIXEROBJ;
  942.   HMIXEROBJ = Integer;
  943.  
  944.   PHMIXER = ^HMIXER;
  945.   HMIXER = Integer;
  946.  
  947. const
  948.   MIXER_SHORT_NAME_CHARS   = 16;
  949.   MIXER_LONG_NAME_CHARS    = 64;
  950.  
  951. { MMRESULT error return values specific to the mixer API }
  952.  
  953.   MIXERR_INVALLINE            = (MIXERR_BASE + 0);
  954.   MIXERR_INVALCONTROL         = (MIXERR_BASE + 1);
  955.   MIXERR_INVALVALUE           = (MIXERR_BASE + 2);
  956.   MIXERR_LASTERROR            = (MIXERR_BASE + 2);
  957.  
  958.   MIXER_OBJECTF_HANDLE    = $80000000;
  959.   MIXER_OBJECTF_MIXER     = $00000000;
  960.   MIXER_OBJECTF_HMIXER    = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIXER);
  961.   MIXER_OBJECTF_WAVEOUT   = $10000000;
  962.   MIXER_OBJECTF_HWAVEOUT  = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEOUT);
  963.   MIXER_OBJECTF_WAVEIN    = $20000000;
  964.   MIXER_OBJECTF_HWAVEIN   = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEIN);
  965.   MIXER_OBJECTF_MIDIOUT   = $30000000;
  966.   MIXER_OBJECTF_HMIDIOUT  = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIOUT);
  967.   MIXER_OBJECTF_MIDIIN    = $40000000;
  968.   MIXER_OBJECTF_HMIDIIN   = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIIN);
  969.   MIXER_OBJECTF_AUX       = $50000000;
  970.  
  971. function mixerGetNumDevs: UINT; stdcall;
  972.  
  973. type
  974.   PMixerCapsA = ^TMixerCapsA;
  975.   PMixerCapsW = ^TMixerCapsW;
  976.   PMixerCaps = PMixerCapsA;
  977.   TMixerCapsA = record
  978.     wMid: WORD;                    { manufacturer id }
  979.     wPid: WORD;                    { product id }
  980.     vDriverVersion: MMVERSION;     { version of the driver }
  981.     szPname: array [0..MAXPNAMELEN - 1] of AnsiChar;   { product name }
  982.     fdwSupport: DWORD;             { misc. support bits }
  983.     cDestinations: DWORD;          { count of destinations }
  984.   end;
  985.   TMixerCapsW = record
  986.     wMid: WORD;                    { manufacturer id }
  987.     wPid: WORD;                    { product id }
  988.     vDriverVersion: MMVERSION;     { version of the driver }
  989.     szPname: array [0..MAXPNAMELEN - 1] of WideChar;   { product name }
  990.     fdwSupport: DWORD;             { misc. support bits }
  991.     cDestinations: DWORD;          { count of destinations }
  992.   end;
  993.   TMixerCaps = TMixerCapsA;
  994.  
  995. function mixerGetDevCapsA(uMxId: UINT; pmxcaps: PMixerCapsA; cbmxcaps: UINT): MMRESULT; stdcall;
  996. function mixerGetDevCapsW(uMxId: UINT; pmxcaps: PMixerCapsW; cbmxcaps: UINT): MMRESULT; stdcall;
  997. function mixerGetDevCaps(uMxId: UINT; pmxcaps: PMixerCaps; cbmxcaps: UINT): MMRESULT; stdcall;
  998. function mixerOpen(phmx: PHMIXER; uMxId: UINT; dwCallback, dwInstance, fdwOpen: DWORD): MMRESULT; stdcall;
  999. function mixerClose(hmx: HMIXER): MMRESULT; stdcall;
  1000. function mixerMessage(hmx: HMIXER; uMsg: UINT; dwParam1, dwParam2: DWORD): DWORD; stdcall;
  1001.  
  1002. type
  1003.   PMixerLineA = ^TMixerLineA;
  1004.   PMixerLineW = ^TMixerLineW;
  1005.   PMixerLine = PMixerLineA;
  1006.   TMixerLineA = record
  1007.     cbStruct: DWORD;               { size of MIXERLINE structure }
  1008.     dwDestination: DWORD;          { zero based destination index }
  1009.     dwSource: DWORD;               { zero based source index (if source) }
  1010.     dwLineID: DWORD;               { unique line id for mixer device }
  1011.     fdwLine: DWORD;                { state/information about line }
  1012.     dwUser: DWORD;                 { driver specific information }
  1013.     dwComponentType: DWORD;        { component type line connects to }
  1014.     cChannels: DWORD;              { number of channels line supports }
  1015.     cConnections: DWORD;           { number of connections [possible] }
  1016.     cControls: DWORD;              { number of controls at this line }
  1017.     szShortName: array[0..MIXER_SHORT_NAME_CHARS - 1] of AnsiChar;
  1018.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of AnsiChar;
  1019.     Target: record
  1020.       dwType: DWORD;                 { MIXERLINE_TARGETTYPE_xxxx }
  1021.       dwDeviceID: DWORD;             { target device ID of device type }
  1022.       wMid: WORD;                                   { of target device }
  1023.       wPid: WORD;                                   {      " }
  1024.       vDriverVersion: MMVERSION;                    {      " }
  1025.       szPname: array[0..MAXPNAMELEN - 1] of AnsiChar;  {      " }
  1026.          end;
  1027.   end;
  1028.   TMixerLineW = record
  1029.     cbStruct: DWORD;               { size of MIXERLINE structure }
  1030.     dwDestination: DWORD;          { zero based destination index }
  1031.     dwSource: DWORD;               { zero based source index (if source) }
  1032.     dwLineID: DWORD;               { unique line id for mixer device }
  1033.     fdwLine: DWORD;                { state/information about line }
  1034.     dwUser: DWORD;                 { driver specific information }
  1035.     dwComponentType: DWORD;        { component type line connects to }
  1036.     cChannels: DWORD;              { number of channels line supports }
  1037.     cConnections: DWORD;           { number of connections [possible] }
  1038.     cControls: DWORD;              { number of controls at this line }
  1039.     szShortName: array[0..MIXER_SHORT_NAME_CHARS - 1] of WideChar;
  1040.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of WideChar;
  1041.     Target: record
  1042.       dwType: DWORD;                 { MIXERLINE_TARGETTYPE_xxxx }
  1043.       dwDeviceID: DWORD;             { target device ID of device type }
  1044.       wMid: WORD;                                   { of target device }
  1045.       wPid: WORD;                                   {      " }
  1046.       vDriverVersion: MMVERSION;                    {      " }
  1047.       szPname: array[0..MAXPNAMELEN - 1] of WideChar;  {      " }
  1048.          end;
  1049.   end;
  1050.   TMixerLine = TMixerLineA;
  1051.  
  1052. const
  1053. { TMixerLine.fdwLine }
  1054.  
  1055.   MIXERLINE_LINEF_ACTIVE              = $00000001;
  1056.   MIXERLINE_LINEF_DISCONNECTED        = $00008000;
  1057.   MIXERLINE_LINEF_SOURCE              = $80000000;
  1058.  
  1059. { TMixerLine.dwComponentType
  1060.   component types for destinations and sources }
  1061.  
  1062.   MIXERLINE_COMPONENTTYPE_DST_FIRST       = $00000000;
  1063.   MIXERLINE_COMPONENTTYPE_DST_UNDEFINED   = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0);
  1064.   MIXERLINE_COMPONENTTYPE_DST_DIGITAL     = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1);
  1065.   MIXERLINE_COMPONENTTYPE_DST_LINE        = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2);
  1066.   MIXERLINE_COMPONENTTYPE_DST_MONITOR     = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3);
  1067.   MIXERLINE_COMPONENTTYPE_DST_SPEAKERS    = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4);
  1068.   MIXERLINE_COMPONENTTYPE_DST_HEADPHONES  = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5);
  1069.   MIXERLINE_COMPONENTTYPE_DST_TELEPHONE   = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6);
  1070.   MIXERLINE_COMPONENTTYPE_DST_WAVEIN      = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7);
  1071.   MIXERLINE_COMPONENTTYPE_DST_VOICEIN     = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
  1072.   MIXERLINE_COMPONENTTYPE_DST_LAST        = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
  1073.  
  1074.   MIXERLINE_COMPONENTTYPE_SRC_FIRST       = $00001000;
  1075.   MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED   = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0);
  1076.   MIXERLINE_COMPONENTTYPE_SRC_DIGITAL     = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1);
  1077.   MIXERLINE_COMPONENTTYPE_SRC_LINE        = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2);
  1078.   MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE  = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3);
  1079.   MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4);
  1080.   MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5);
  1081.   MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE   = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6);
  1082.   MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER   = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7);
  1083.   MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT     = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8);
  1084.   MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY   = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9);
  1085.   MIXERLINE_COMPONENTTYPE_SRC_ANALOG      = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
  1086.   MIXERLINE_COMPONENTTYPE_SRC_LAST        = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
  1087.  
  1088. { TMixerLine.Target.dwType }
  1089.  
  1090.   MIXERLINE_TARGETTYPE_UNDEFINED      = 0;
  1091.   MIXERLINE_TARGETTYPE_WAVEOUT        = 1;
  1092.   MIXERLINE_TARGETTYPE_WAVEIN         = 2;
  1093.   MIXERLINE_TARGETTYPE_MIDIOUT        = 3;
  1094.   MIXERLINE_TARGETTYPE_MIDIIN         = 4;
  1095.   MIXERLINE_TARGETTYPE_AUX            = 5;
  1096.  
  1097. function mixerGetLineInfoA(hmxobj: HMIXEROBJ; pmxl: PMixerLineA;
  1098.   fdwInfo: DWORD): MMRESULT; stdcall;
  1099. function mixerGetLineInfoW(hmxobj: HMIXEROBJ; pmxl: PMixerLineW;
  1100.   fdwInfo: DWORD): MMRESULT; stdcall;
  1101. function mixerGetLineInfo(hmxobj: HMIXEROBJ; pmxl: PMixerLine;
  1102.   fdwInfo: DWORD): MMRESULT; stdcall;
  1103.  
  1104. const
  1105.   MIXER_GETLINEINFOF_DESTINATION      = $00000000;
  1106.   MIXER_GETLINEINFOF_SOURCE           = $00000001;
  1107.   MIXER_GETLINEINFOF_LINEID           = $00000002;
  1108.   MIXER_GETLINEINFOF_COMPONENTTYPE    = $00000003;
  1109.   MIXER_GETLINEINFOF_TARGETTYPE       = $00000004;
  1110.  
  1111.   MIXER_GETLINEINFOF_QUERYMASK        = $0000000F;
  1112.  
  1113. function mixerGetID(hmxobj: HMIXEROBJ; var puMxId: UINT; fdwId: DWORD): MMRESULT; stdcall;
  1114.  
  1115. type
  1116.   PMixerControlA = ^TMixerControlA;
  1117.   PMixerControlW = ^TMixerControlW;
  1118.   PMixerControl = PMixerControlA;
  1119.   TMixerControlA = packed record
  1120.     cbStruct: DWORD;           { size in bytes of MIXERCONTROL }
  1121.     dwControlID: DWORD;        { unique control id for mixer device }
  1122.     dwControlType: DWORD;      { MIXERCONTROL_CONTROLTYPE_xxx }
  1123.     fdwControl: DWORD;         { MIXERCONTROL_CONTROLF_xxx }
  1124.     cMultipleItems: DWORD;     { if MIXERCONTROL_CONTROLF_MULTIPLE set }
  1125.     szShortName: array[0..MIXER_SHORT_NAME_CHARS - 1] of AnsiChar;
  1126.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of AnsiChar;
  1127.     Bounds: record
  1128.       case Integer of
  1129.         0: (lMinimum, lMaximum: Longint);
  1130.         1: (dwMinimum, dwMaximum: DWORD);
  1131.         2: (dwReserved: array[0..5] of DWORD);
  1132.     end;
  1133.     Metrics: record
  1134.       case Integer of
  1135.         0: (cSteps: DWORD);        { # of steps between min & max }
  1136.         1: (cbCustomData: DWORD);  { size in bytes of custom data }
  1137.         2: (dwReserved: array[0..5] of DWORD);
  1138.     end;
  1139.   end;  
  1140.   TMixerControlW = packed record
  1141.     cbStruct: DWORD;           { size in bytes of MIXERCONTROL }
  1142.     dwControlID: DWORD;        { unique control id for mixer device }
  1143.     dwControlType: DWORD;      { MIXERCONTROL_CONTROLTYPE_xxx }
  1144.     fdwControl: DWORD;         { MIXERCONTROL_CONTROLF_xxx }
  1145.     cMultipleItems: DWORD;     { if MIXERCONTROL_CONTROLF_MULTIPLE set }
  1146.     szShortName: array[0..MIXER_SHORT_NAME_CHARS - 1] of WideChar;
  1147.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of WideChar;
  1148.     Bounds: record
  1149.       case Integer of
  1150.         0: (lMinimum, lMaximum: Longint);
  1151.         1: (dwMinimum, dwMaximum: DWORD);
  1152.         2: (dwReserved: array[0..5] of DWORD);
  1153.     end;
  1154.     Metrics: record
  1155.       case Integer of
  1156.         0: (cSteps: DWORD);        { # of steps between min & max }
  1157.         1: (cbCustomData: DWORD);  { size in bytes of custom data }
  1158.         2: (dwReserved: array[0..5] of DWORD);
  1159.     end;
  1160.   end;  
  1161.   TMixerControl = TMixerControlA;
  1162.  
  1163. const
  1164. { TMixerControl.fdwControl }
  1165.  
  1166.   MIXERCONTROL_CONTROLF_UNIFORM   = $00000001;
  1167.   MIXERCONTROL_CONTROLF_MULTIPLE  = $00000002;
  1168.   MIXERCONTROL_CONTROLF_DISABLED  = $80000000;
  1169.  
  1170. { MIXERCONTROL_CONTROLTYPE_xxx building block defines }
  1171.  
  1172.   MIXERCONTROL_CT_CLASS_MASK          = $F0000000;
  1173.   MIXERCONTROL_CT_CLASS_CUSTOM        = $00000000;
  1174.   MIXERCONTROL_CT_CLASS_METER         = $10000000;
  1175.   MIXERCONTROL_CT_CLASS_SWITCH        = $20000000;
  1176.   MIXERCONTROL_CT_CLASS_NUMBER        = $30000000;
  1177.   MIXERCONTROL_CT_CLASS_SLIDER        = $40000000;
  1178.   MIXERCONTROL_CT_CLASS_FADER         = $50000000;
  1179.   MIXERCONTROL_CT_CLASS_TIME          = $60000000;
  1180.   MIXERCONTROL_CT_CLASS_LIST          = $70000000;
  1181.  
  1182.   MIXERCONTROL_CT_SUBCLASS_MASK       = $0F000000;
  1183.  
  1184.   MIXERCONTROL_CT_SC_SWITCH_BOOLEAN   = $00000000;
  1185.   MIXERCONTROL_CT_SC_SWITCH_BUTTON    = $01000000;
  1186.  
  1187.   MIXERCONTROL_CT_SC_METER_POLLED     = $00000000;
  1188.  
  1189.   MIXERCONTROL_CT_SC_TIME_MICROSECS   = $00000000;
  1190.   MIXERCONTROL_CT_SC_TIME_MILLISECS   = $01000000;
  1191.  
  1192.   MIXERCONTROL_CT_SC_LIST_SINGLE      = $00000000;
  1193.   MIXERCONTROL_CT_SC_LIST_MULTIPLE    = $01000000;
  1194.  
  1195.   MIXERCONTROL_CT_UNITS_MASK          = $00FF0000;
  1196.   MIXERCONTROL_CT_UNITS_CUSTOM        = $00000000;
  1197.   MIXERCONTROL_CT_UNITS_BOOLEAN       = $00010000;
  1198.   MIXERCONTROL_CT_UNITS_SIGNED        = $00020000;
  1199.   MIXERCONTROL_CT_UNITS_UNSIGNED      = $00030000;
  1200.   MIXERCONTROL_CT_UNITS_DECIBELS      = $00040000; { in 10ths }
  1201.   MIXERCONTROL_CT_UNITS_PERCENT       = $00050000; { in 10ths }
  1202.  
  1203. { Commonly used control types for specifying TMixerControl.dwControlType }
  1204.  
  1205.   MIXERCONTROL_CONTROLTYPE_CUSTOM         = (MIXERCONTROL_CT_CLASS_CUSTOM or MIXERCONTROL_CT_UNITS_CUSTOM);
  1206.   MIXERCONTROL_CONTROLTYPE_BOOLEANMETER   = (MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_BOOLEAN);
  1207.   MIXERCONTROL_CONTROLTYPE_SIGNEDMETER    = (MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_SIGNED);
  1208.   MIXERCONTROL_CONTROLTYPE_PEAKMETER      = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1);
  1209.   MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER  = (MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_UNSIGNED);
  1210.   MIXERCONTROL_CONTROLTYPE_BOOLEAN        = (MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN or
  1211.     MIXERCONTROL_CT_UNITS_BOOLEAN);
  1212.   MIXERCONTROL_CONTROLTYPE_ONOFF          = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1);
  1213.   MIXERCONTROL_CONTROLTYPE_MUTE           = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2);
  1214.   MIXERCONTROL_CONTROLTYPE_MONO           = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3);
  1215.   MIXERCONTROL_CONTROLTYPE_LOUDNESS       = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4);
  1216.   MIXERCONTROL_CONTROLTYPE_STEREOENH      = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5);
  1217.   MIXERCONTROL_CONTROLTYPE_BUTTON         = (MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BUTTON or
  1218.     MIXERCONTROL_CT_UNITS_BOOLEAN);
  1219.   MIXERCONTROL_CONTROLTYPE_DECIBELS       = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_DECIBELS);
  1220.   MIXERCONTROL_CONTROLTYPE_SIGNED         = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_SIGNED);
  1221.   MIXERCONTROL_CONTROLTYPE_UNSIGNED       = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_UNSIGNED);
  1222.   MIXERCONTROL_CONTROLTYPE_PERCENT        = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_PERCENT);
  1223.   MIXERCONTROL_CONTROLTYPE_SLIDER         = (MIXERCONTROL_CT_CLASS_SLIDER or MIXERCONTROL_CT_UNITS_SIGNED);
  1224.   MIXERCONTROL_CONTROLTYPE_PAN            = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1);
  1225.   MIXERCONTROL_CONTROLTYPE_QSOUNDPAN      = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2);
  1226.   MIXERCONTROL_CONTROLTYPE_FADER          = (MIXERCONTROL_CT_CLASS_FADER or MIXERCONTROL_CT_UNITS_UNSIGNED);
  1227.   MIXERCONTROL_CONTROLTYPE_VOLUME         = (MIXERCONTROL_CONTROLTYPE_FADER + 1);
  1228.   MIXERCONTROL_CONTROLTYPE_BASS           = (MIXERCONTROL_CONTROLTYPE_FADER + 2);
  1229.   MIXERCONTROL_CONTROLTYPE_TREBLE         = (MIXERCONTROL_CONTROLTYPE_FADER + 3);
  1230.   MIXERCONTROL_CONTROLTYPE_EQUALIZER      = (MIXERCONTROL_CONTROLTYPE_FADER + 4);
  1231.   MIXERCONTROL_CONTROLTYPE_SINGLESELECT   = (MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_SINGLE or MIXERCONTROL_CT_UNITS_BOOLEAN);
  1232.   MIXERCONTROL_CONTROLTYPE_MUX            = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1);
  1233.   MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_MULTIPLE or MIXERCONTROL_CT_UNITS_BOOLEAN);
  1234.   MIXERCONTROL_CONTROLTYPE_MIXER          = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1);
  1235.   MIXERCONTROL_CONTROLTYPE_MICROTIME      = (MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MICROSECS or
  1236.     MIXERCONTROL_CT_UNITS_UNSIGNED);
  1237.   MIXERCONTROL_CONTROLTYPE_MILLITIME      = (MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MILLISECS or
  1238.     MIXERCONTROL_CT_UNITS_UNSIGNED);
  1239.  
  1240.  
  1241. type
  1242.   PMixerLineControlsA = ^TMixerLineControlsA;
  1243.   PMixerLineControlsW = ^TMixerLineControlsW;
  1244.   PMixerLineControls = PMixerLineControlsA;
  1245.   TMixerLineControlsA = record
  1246.     cbStruct: DWORD;               { size in bytes of MIXERLINECONTROLS }
  1247.     dwLineID: DWORD;               { line id (from MIXERLINE.dwLineID) }
  1248.     case Integer of
  1249.       0: (dwControlID: DWORD);     { MIXER_GETLINECONTROLSF_ONEBYID }
  1250.       1: (dwControlType: DWORD;    { MIXER_GETLINECONTROLSF_ONEBYTYPE }
  1251.           cControls: DWORD;        { count of controls pmxctrl points to }
  1252.           cbmxctrl: DWORD;         { size in bytes of _one_ MIXERCONTROL }
  1253.           pamxctrl: PMixerControlA);   { pointer to first MIXERCONTROL array }
  1254.   end;
  1255.   TMixerLineControlsW = record
  1256.     cbStruct: DWORD;               { size in bytes of MIXERLINECONTROLS }
  1257.     dwLineID: DWORD;               { line id (from MIXERLINE.dwLineID) }
  1258.     case Integer of
  1259.       0: (dwControlID: DWORD);     { MIXER_GETLINECONTROLSF_ONEBYID }
  1260.       1: (dwControlType: DWORD;    { MIXER_GETLINECONTROLSF_ONEBYTYPE }
  1261.           cControls: DWORD;        { count of controls pmxctrl points to }
  1262.           cbmxctrl: DWORD;         { size in bytes of _one_ MIXERCONTROL }
  1263.           pamxctrl: PMixerControlW);   { pointer to first MIXERCONTROL array }
  1264.   end;
  1265.   TMixerLineControls = TMixerLineControlsA;
  1266.  
  1267. function mixerGetLineControlsA(hmxobj: HMIXEROBJ; pmxlc: PMixerLineControlsA; fdwControls: DWORD): MMRESULT; stdcall;
  1268. function mixerGetLineControlsW(hmxobj: HMIXEROBJ; pmxlc: PMixerLineControlsW; fdwControls: DWORD): MMRESULT; stdcall;
  1269. function mixerGetLineControls(hmxobj: HMIXEROBJ; pmxlc: PMixerLineControls; fdwControls: DWORD): MMRESULT; stdcall;
  1270.  
  1271. const
  1272.   MIXER_GETLINECONTROLSF_ALL          = $00000000;
  1273.   MIXER_GETLINECONTROLSF_ONEBYID      = $00000001;
  1274.   MIXER_GETLINECONTROLSF_ONEBYTYPE    = $00000002;
  1275.  
  1276.   MIXER_GETLINECONTROLSF_QUERYMASK    = $0000000F;
  1277.  
  1278. type
  1279.   PMixerControlDetails = ^TMixerControlDetails;
  1280.   TMixerControlDetails = record
  1281.     cbStruct: DWORD;       { size in bytes of MIXERCONTROLDETAILS }
  1282.     dwControlID: DWORD;    { control id to get/set details on }
  1283.     cChannels: DWORD;      { number of channels in paDetails array }
  1284.     case Integer of
  1285.            0: (hwndOwner: HWND);        { for MIXER_SETCONTROLDETAILSF_CUSTOM }
  1286.            1: (cMultipleItems: DWORD;   { if _MULTIPLE, the number of items per channel }
  1287.                cbDetails: DWORD;        { size of _one_ details_XX struct }
  1288.                paDetails: Pointer);     { pointer to array of details_XX structs }
  1289.   end;
  1290.  
  1291.   PMixerControlDetailsListTextA = ^TMixerControlDetailsListTextA;
  1292.   PMixerControlDetailsListTextW = ^TMixerControlDetailsListTextW;
  1293.   PMixerControlDetailsListText = PMixerControlDetailsListTextA;
  1294.   TMixerControlDetailsListTextA = record
  1295.     dwParam1: DWORD;
  1296.     dwParam2: DWORD;
  1297.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of AnsiChar;
  1298.   end;
  1299.   TMixerControlDetailsListTextW = record
  1300.     dwParam1: DWORD;
  1301.     dwParam2: DWORD;
  1302.     szName: array[0..MIXER_LONG_NAME_CHARS - 1] of WideChar;
  1303.   end;
  1304.   TMixerControlDetailsListText = TMixerControlDetailsListTextA;
  1305.  
  1306.   PMixerControlDetailsBoolean = ^TMixerControlDetailsBoolean;
  1307.   TMixerControlDetailsBoolean = record
  1308.     fValue: Longint;
  1309.   end;
  1310.  
  1311.   PMixerControlDetailsSigned = ^TMixerControlDetailsSigned;
  1312.   TMixerControlDetailsSigned = record
  1313.     lValue: Longint;
  1314.   end;
  1315.  
  1316.   PMixerControlDetailsUnsigned = ^TMixerControlDetailsUnsigned;
  1317.   TMixerControlDetailsUnsigned = record
  1318.     dwValue: DWORD;
  1319.   end;
  1320.  
  1321. function mixerGetControlDetailsA(hmxobj: HMIXEROBJ; pmxcd: PMixerControlDetails; fdwDetails: DWORD): MMRESULT; stdcall;
  1322. function mixerGetControlDetailsW(hmxobj: HMIXEROBJ; pmxcd: PMixerControlDetails; fdwDetails: DWORD): MMRESULT; stdcall;
  1323. function mixerGetControlDetails(hmxobj: HMIXEROBJ; pmxcd: PMixerControlDetails; fdwDetails: DWORD): MMRESULT; stdcall;
  1324.  
  1325. const
  1326.   MIXER_GETCONTROLDETAILSF_VALUE      = $00000000;
  1327.   MIXER_GETCONTROLDETAILSF_LISTTEXT   = $00000001;
  1328.  
  1329.   MIXER_GETCONTROLDETAILSF_QUERYMASK  = $0000000F;
  1330.  
  1331. function mixerSetControlDetails(hmxobj: HMIXEROBJ; pmxcd: PMixerControlDetails; fdwDetails: DWORD): MMRESULT; stdcall;
  1332.  
  1333. const
  1334.   MIXER_SETCONTROLDETAILSF_VALUE      = $00000000;
  1335.   MIXER_SETCONTROLDETAILSF_CUSTOM     = $00000001;
  1336.  
  1337.   MIXER_SETCONTROLDETAILSF_QUERYMASK  = $0000000F;
  1338.  
  1339. {***************************************************************************
  1340.  
  1341.                             Timer support
  1342.  
  1343. ***************************************************************************}
  1344.  
  1345. { timer error return values }
  1346. const
  1347.   TIMERR_NOERROR        = 0;                  { no error }
  1348.   TIMERR_NOCANDO        = TIMERR_BASE+1;      { request not completed }
  1349.   TIMERR_STRUCT         = TIMERR_BASE+33;     { time struct size }
  1350.  
  1351. { timer data types }
  1352. type
  1353.   TFNTimeCallBack = procedure(uTimerID, uMessage: UINT;
  1354.     dwUser, dw1, dw2: DWORD) stdcall;
  1355.  
  1356.  
  1357. { flags for wFlags parameter of timeSetEvent() function }
  1358. const
  1359.   TIME_ONESHOT    = 0;   { program timer for single event }
  1360.   TIME_PERIODIC   = 1;   { program for continuous periodic event }
  1361.   TIME_CALLBACK_FUNCTION    = $0000;  { callback is function }
  1362.   TIME_CALLBACK_EVENT_SET   = $0010;  { callback is event - use SetEvent }
  1363.   TIME_CALLBACK_EVENT_PULSE = $0020;  { callback is event - use PulseEvent }
  1364.  
  1365. { timer device capabilities data structure }
  1366. type
  1367.   PTimeCaps = ^TTimeCaps;
  1368.   TTimeCaps = record
  1369.     wPeriodMin: UINT;     { minimum period supported  }
  1370.     wPeriodMax: UINT;     { maximum period supported  }
  1371.   end;
  1372.  
  1373. { timer function prototypes }
  1374. function timeGetSystemTime(lpTime: PMMTime; uSize: Word): MMRESULT; stdcall;
  1375.  
  1376. function timeGetTime: DWORD; stdcall;
  1377. function timeSetEvent(uDelay, uResolution: UINT;
  1378.   lpFunction: TFNTimeCallBack; dwUser: DWORD; uFlags: UINT): MMRESULT; stdcall;
  1379. function timeKillEvent(uTimerID: UINT): MMRESULT; stdcall;
  1380. function timeGetDevCaps(lpTimeCaps: PTimeCaps; uSize: UINT): MMRESULT; stdcall;
  1381. function timeBeginPeriod(uPeriod: UINT): MMRESULT; stdcall;
  1382. function timeEndPeriod(uPeriod: UINT): MMRESULT; stdcall;
  1383.  
  1384.  
  1385. {***************************************************************************
  1386.  
  1387.                             Joystick support
  1388.  
  1389. ***************************************************************************}
  1390.  
  1391. { joystick error return values }
  1392. const
  1393.   JOYERR_NOERROR        = 0;                  { no error }
  1394.   JOYERR_PARMS          = JOYERR_BASE+5;      { bad parameters }
  1395.   JOYERR_NOCANDO        = JOYERR_BASE+6;      { request not completed }
  1396.   JOYERR_UNPLUGGED      = JOYERR_BASE+7;      { joystick is unplugged }
  1397.  
  1398. { constants used with TJoyInfo and TJoyInfoEx structure and MM_JOY* messages }
  1399. const
  1400.   JOY_BUTTON1         = $0001;
  1401.   JOY_BUTTON2         = $0002;
  1402.   JOY_BUTTON3         = $0004;
  1403.   JOY_BUTTON4         = $0008;
  1404.   JOY_BUTTON1CHG      = $0100;
  1405.   JOY_BUTTON2CHG      = $0200;
  1406.   JOY_BUTTON3CHG      = $0400;
  1407.   JOY_BUTTON4CHG      = $0800;
  1408.  
  1409. { constants used with TJoyInfoEx }
  1410.   JOY_BUTTON5         = $00000010;
  1411.   JOY_BUTTON6         = $00000020;
  1412.   JOY_BUTTON7         = $00000040;
  1413.   JOY_BUTTON8         = $00000080;
  1414.   JOY_BUTTON9         = $00000100;
  1415.   JOY_BUTTON10        = $00000200;
  1416.   JOY_BUTTON11        = $00000400;
  1417.   JOY_BUTTON12        = $00000800;
  1418.   JOY_BUTTON13        = $00001000;
  1419.   JOY_BUTTON14        = $00002000;
  1420.   JOY_BUTTON15        = $00004000;
  1421.   JOY_BUTTON16        = $00008000;
  1422.   JOY_BUTTON17        = $00010000;
  1423.   JOY_BUTTON18        = $00020000;
  1424.   JOY_BUTTON19        = $00040000;
  1425.   JOY_BUTTON20        = $00080000;
  1426.   JOY_BUTTON21        = $00100000;
  1427.   JOY_BUTTON22        = $00200000;
  1428.   JOY_BUTTON23        = $00400000;
  1429.   JOY_BUTTON24        = $00800000;
  1430.   JOY_BUTTON25        = $01000000;
  1431.   JOY_BUTTON26        = $02000000;
  1432.   JOY_BUTTON27        = $04000000;
  1433.   JOY_BUTTON28        = $08000000;
  1434.   JOY_BUTTON29        = $10000000;
  1435.   JOY_BUTTON30        = $20000000;
  1436.   JOY_BUTTON31        = $40000000;
  1437.   JOY_BUTTON32        = $80000000;
  1438.  
  1439. { constants used with TJoyInfoEx }
  1440.   JOY_POVCENTERED       = -1;
  1441.   JOY_POVFORWARD        = 0;
  1442.   JOY_POVRIGHT          = 9000;
  1443.   JOY_POVBACKWARD       = 18000;
  1444.   JOY_POVLEFT           = 27000;
  1445.  
  1446.   JOY_RETURNX           = $00000001;
  1447.   JOY_RETURNY           = $00000002;
  1448.   JOY_RETURNZ           = $00000004;
  1449.   JOY_RETURNR           = $00000008;
  1450.   JOY_RETURNU           = $00000010; { axis 5 }
  1451.   JOY_RETURNV           = $00000020; { axis 6 }
  1452.   JOY_RETURNPOV         = $00000040;
  1453.   JOY_RETURNBUTTONS     = $00000080;
  1454.   JOY_RETURNRAWDATA     = $00000100;
  1455.   JOY_RETURNPOVCTS      = $00000200;
  1456.   JOY_RETURNCENTERED    = $00000400;
  1457.   JOY_USEDEADZONE               = $00000800;
  1458.   JOY_RETURNALL  = (JOY_RETURNX or JOY_RETURNY or JOY_RETURNZ or
  1459.     JOY_RETURNR or JOY_RETURNU or JOY_RETURNV or
  1460.     JOY_RETURNPOV or JOY_RETURNBUTTONS);
  1461.   JOY_CAL_READALWAYS    = $00010000;
  1462.   JOY_CAL_READXYONLY    = $00020000;
  1463.   JOY_CAL_READ3         = $00040000;
  1464.   JOY_CAL_READ4         = $00080000;
  1465.   JOY_CAL_READXONLY     = $00100000;
  1466.   JOY_CAL_READYONLY     = $00200000;
  1467.   JOY_CAL_READ5         = $00400000;
  1468.   JOY_CAL_READ6         = $00800000;
  1469.   JOY_CAL_READZONLY     = $01000000;
  1470.   JOY_CAL_READRONLY     = $02000000;
  1471.   JOY_CAL_READUONLY     = $04000000;
  1472.   JOY_CAL_READVONLY     = $08000000;
  1473.  
  1474. { joystick ID constants }
  1475. const
  1476.   JOYSTICKID1         = 0;
  1477.   JOYSTICKID2         = 1;
  1478.  
  1479. { joystick driver capabilites }
  1480.   JOYCAPS_HASZ          = $000;
  1481.   JOYCAPS_HASR          = $0002;
  1482.   JOYCAPS_HASU          = $0004;
  1483.   JOYCAPS_HASV          = $0008;
  1484.   JOYCAPS_HASPOV                = $0010;
  1485.   JOYCAPS_POV4DIR               = $0020;
  1486.   JOYCAPS_POVCTS                = $0040;
  1487.  
  1488. { joystick device capabilities data structure }
  1489. type
  1490.   PJoyCapsA = ^TJoyCapsA;
  1491.   PJoyCapsW = ^TJoyCapsW;
  1492.   PJoyCaps = PJoyCapsA;
  1493.   TJoyCapsA = record
  1494.     wMid: Word;                  { manufacturer ID }
  1495.     wPid: Word;                  { product ID }
  1496.     szPname: array[0..MAXPNAMELEN-1] of AnsiChar;  { product name (NULL terminated string) }
  1497.     wXmin: UINT;                 { minimum x position value }
  1498.     wXmax: UINT;                 { maximum x position value }
  1499.     wYmin: UINT;                 { minimum y position value }
  1500.     wYmax: UINT;                 { maximum y position value }
  1501.     wZmin: UINT;                 { minimum z position value }
  1502.     wZmax: UINT;                 { maximum z position value }
  1503.     wNumButtons: UINT;           { number of buttons }
  1504.     wPeriodMin: UINT;            { minimum message period when captured }
  1505.     wPeriodMax: UINT;            { maximum message period when captured }
  1506.     wRmin: UINT;                 { minimum r position value }
  1507.     wRmax: UINT;                 { maximum r position value }
  1508.     wUmin: UINT;                 { minimum u (5th axis) position value }
  1509.     wUmax: UINT;                 { maximum u (5th axis) position value }
  1510.     wVmin: UINT;                 { minimum v (6th axis) position value }
  1511.     wVmax: UINT;                 { maximum v (6th axis) position value }
  1512.     wCaps: UINT;                 { joystick capabilites }
  1513.     wMaxAxes: UINT;             { maximum number of axes supported }
  1514.     wNumAxes: UINT;             { number of axes in use }
  1515.     wMaxButtons: UINT;          { maximum number of buttons supported }
  1516.     szRegKey: array[0..MAXPNAMELEN - 1] of AnsiChar; { registry key }
  1517.     szOEMVxD: array[0..MAX_JOYSTICKOEMVXDNAME - 1] of AnsiChar; { OEM VxD in use }
  1518.   end;
  1519.   TJoyCapsW = record
  1520.     wMid: Word;                  { manufacturer ID }
  1521.     wPid: Word;                  { product ID }
  1522.     szPname: array[0..MAXPNAMELEN-1] of WideChar;  { product name (NULL terminated string) }
  1523.     wXmin: UINT;                 { minimum x position value }
  1524.     wXmax: UINT;                 { maximum x position value }
  1525.     wYmin: UINT;                 { minimum y position value }
  1526.     wYmax: UINT;                 { maximum y position value }
  1527.     wZmin: UINT;                 { minimum z position value }
  1528.     wZmax: UINT;                 { maximum z position value }
  1529.     wNumButtons: UINT;           { number of buttons }
  1530.     wPeriodMin: UINT;            { minimum message period when captured }
  1531.     wPeriodMax: UINT;            { maximum message period when captured }
  1532.     wRmin: UINT;                 { minimum r position value }
  1533.     wRmax: UINT;                 { maximum r position value }
  1534.     wUmin: UINT;                 { minimum u (5th axis) position value }
  1535.     wUmax: UINT;                 { maximum u (5th axis) position value }
  1536.     wVmin: UINT;                 { minimum v (6th axis) position value }
  1537.     wVmax: UINT;                 { maximum v (6th axis) position value }
  1538.     wCaps: UINT;                 { joystick capabilites }
  1539.     wMaxAxes: UINT;             { maximum number of axes supported }
  1540.     wNumAxes: UINT;             { number of axes in use }
  1541.     wMaxButtons: UINT;          { maximum number of buttons supported }
  1542.     szRegKey: array[0..MAXPNAMELEN - 1] of WideChar; { registry key }
  1543.     szOEMVxD: array[0..MAX_JOYSTICKOEMVXDNAME - 1] of WideChar; { OEM VxD in use }
  1544.   end;
  1545.   TJoyCaps = TJoyCapsA;
  1546.  
  1547. { joystick information data structure }
  1548. type
  1549.   PJoyInfo = ^TJoyInfo;
  1550.   TJoyInfo = record
  1551.     wXpos: UINT;                 { x position }
  1552.     wYpos: UINT;                 { y position }
  1553.     wZpos: UINT;                 { z position }
  1554.     wButtons: UINT;              { button states }
  1555.   end;
  1556.  
  1557.   PJoyInfoEx = ^TJoyInfoEx;
  1558.   TJoyInfoEx = record
  1559.     dwSize: DWORD;               { size of structure }
  1560.     dwFlags: DWORD;              { flags to indicate what to return }
  1561.     wXpos: UINT;         { x position }
  1562.     wYpos: UINT;         { y position }
  1563.     wZpos: UINT;         { z position }
  1564.     dwRpos: DWORD;               { rudder/4th axis position }
  1565.     dwUpos: DWORD;               { 5th axis position }
  1566.     dwVpos: DWORD;               { 6th axis position }
  1567.     wButtons: UINT;      { button states }
  1568.     dwButtonNumber: DWORD;  { current button number pressed }
  1569.     dwPOV: DWORD;           { point of view state }
  1570.     dwReserved1: DWORD;          { reserved for communication between winmm & driver }
  1571.     dwReserved2: DWORD;          { reserved for future expansion }
  1572.   end;
  1573.  
  1574. { joystick function prototypes }
  1575. function joyGetNumDevs: UINT; stdcall;
  1576. function joyGetDevCapsA(uJoyID: UINT; lpCaps: PJoyCapsA; uSize: UINT): MMRESULT; stdcall;
  1577. function joyGetDevCapsW(uJoyID: UINT; lpCaps: PJoyCapsW; uSize: UINT): MMRESULT; stdcall;
  1578. function joyGetDevCaps(uJoyID: UINT; lpCaps: PJoyCaps; uSize: UINT): MMRESULT; stdcall;
  1579. function joyGetPos(uJoyID: UINT; lpInfo: PJoyInfo): MMRESULT; stdcall;
  1580. function joyGetPosEx(uJoyID: UINT; lpInfo: PJoyInfoEx): MMRESULT; stdcall;
  1581. function joyGetThreshold(uJoyID: UINT; lpuThreshold: PUINT): MMRESULT; stdcall;
  1582. function joyReleaseCapture(uJoyID: UINT): MMRESULT; stdcall;
  1583. function joySetCapture(Handle: HWND; uJoyID, uPeriod: UINT; bChanged: BOOL): MMRESULT; stdcall;
  1584. function joySetThreshold(uJoyID, uThreshold: UINT): MMRESULT; stdcall;
  1585.  
  1586. {***************************************************************************
  1587.  
  1588.                         Multimedia File I/O support
  1589.  
  1590. ***************************************************************************}
  1591.  
  1592. { MMIO error return values }
  1593. const
  1594.   MMIOERR_BASE            = 256;
  1595.   MMIOERR_FILENOTFOUND    = MMIOERR_BASE + 1;  { file not found }
  1596.   MMIOERR_OUTOFMEMORY     = MMIOERR_BASE + 2;  { out of memory }
  1597.   MMIOERR_CANNOTOPEN      = MMIOERR_BASE + 3;  { cannot open }
  1598.   MMIOERR_CANNOTCLOSE     = MMIOERR_BASE + 4;  { cannot close }
  1599.   MMIOERR_CANNOTREAD      = MMIOERR_BASE + 5;  { cannot read }
  1600.   MMIOERR_CANNOTWRITE     = MMIOERR_BASE + 6;  { cannot write }
  1601.   MMIOERR_CANNOTSEEK      = MMIOERR_BASE + 7;  { cannot seek }
  1602.   MMIOERR_CANNOTEXPAND    = MMIOERR_BASE + 8;  { cannot expand file }
  1603.   MMIOERR_CHUNKNOTFOUND   = MMIOERR_BASE + 9;  { chunk not found }
  1604.   MMIOERR_UNBUFFERED      = MMIOERR_BASE + 10; { file is unbuffered }
  1605.   MMIOERR_PATHNOTFOUND        = MMIOERR_BASE + 11;  { path incorrect }
  1606.   MMIOERR_ACCESSDENIED        = MMIOERR_BASE + 12;  { file was protected }
  1607.   MMIOERR_SHARINGVIOLATION    = MMIOERR_BASE + 13;  { file in use }
  1608.   MMIOERR_NETWORKERROR        = MMIOERR_BASE + 14;  { network not responding }
  1609.   MMIOERR_TOOMANYOPENFILES    = MMIOERR_BASE + 15;  { no more file handles  }
  1610.   MMIOERR_INVALIDFILE         = MMIOERR_BASE + 16;  { default error file error }
  1611.  
  1612. { MMIO constants }
  1613. const
  1614.   CFSEPCHAR       = '+';             { compound file name separator char. }
  1615.  
  1616. type
  1617. { MMIO data types }
  1618.   FOURCC = DWORD;                    { a four character code }
  1619.  
  1620.   PHMMIO = ^HMMIO;
  1621.   HMMIO = Integer;      { a handle to an open file }
  1622.  
  1623.   TFNMMIOProc = function(lpmmioinfo: PChar; uMessage: UINT; lParam1, lParam2: LPARAM): Longint stdcall;
  1624.  
  1625. { general MMIO information data structure }
  1626. type
  1627.   PMMIOInfo = ^TMMIOInfo;
  1628.   TMMIOInfo = record
  1629.     { general fields }
  1630.     dwFlags: DWORD;        { general status flags }
  1631.     fccIOProc: FOURCC;      { pointer to I/O procedure }
  1632.     pIOProc: TFNMMIOProc;        { pointer to I/O procedure }
  1633.     wErrorRet: UINT;      { place for error to be returned }
  1634.     hTask: HTASK;          { alternate local task }
  1635.  
  1636.     { fields maintained by MMIO functions during buffered I/O }
  1637.     cchBuffer: Longint;      { size of I/O buffer (or 0L) }
  1638.     pchBuffer: PChar;      { start of I/O buffer (or NULL) }
  1639.     pchNext: PChar;        { pointer to next byte to read/write }
  1640.     pchEndRead: PChar;     { pointer to last valid byte to read }
  1641.     pchEndWrite: PChar;    { pointer to last byte to write }
  1642.     lBufOffset: Longint;     { disk offset of start of buffer }
  1643.  
  1644.     { fields maintained by I/O procedure }
  1645.     lDiskOffset: Longint;    { disk offset of next read or write }
  1646.     adwInfo: array[0..2] of DWORD;     { data specific to type of MMIOPROC }
  1647.  
  1648.     { other fields maintained by MMIO }
  1649.     dwReserved1: DWORD;    { reserved for MMIO use }
  1650.     dwReserved2: DWORD;    { reserved for MMIO use }
  1651.     hmmio: HMMIO;          { handle to open file }
  1652.   end;
  1653.  
  1654.  
  1655. { RIFF chunk information data structure }
  1656. type
  1657.  
  1658.   PMMCKInfo = ^TMMCKInfo;
  1659.   TMMCKInfo = record
  1660.     ckid: FOURCC;           { chunk ID }
  1661.     cksize: DWORD;         { chunk size }
  1662.     fccType: FOURCC;        { form type or list type }
  1663.     dwDataOffset: DWORD;   { offset of data portion of chunk }
  1664.     dwFlags: DWORD;        { flags used by MMIO functions }
  1665.   end;
  1666.  
  1667. { bit field masks }
  1668. const
  1669.   MMIO_RWMODE     = $00000003;      { open file for reading/writing/both }
  1670.   MMIO_SHAREMODE  = $00000070;      { file sharing mode number }
  1671.  
  1672. { constants for dwFlags field of MMIOINFO }
  1673. const
  1674.   MMIO_CREATE    = $00001000;     { create new file (or truncate file) }
  1675.   MMIO_PARSE     = $00000100;     { parse new file returning path }
  1676.   MMIO_DELETE    = $00000200;     { create new file (or truncate file) }
  1677.   MMIO_EXIST     = $00004000;     { checks for existence of file }
  1678.   MMIO_ALLOCBUF  = $00010000;     { mmioOpen() should allocate a buffer }
  1679.   MMIO_GETTEMP   = $00020000;     { mmioOpen() should retrieve temp name }
  1680.  
  1681. const
  1682.   MMIO_DIRTY     = $10000000;     { I/O buffer is dirty }
  1683.  
  1684. { read/write mode numbers (bit field MMIO_RWMODE) }
  1685. const
  1686.   MMIO_READ       = $00000000;      { open file for reading only }
  1687.   MMIO_WRITE      = $00000001;      { open file for writing only }
  1688.   MMIO_READWRITE  = $00000002;      { open file for reading and writing }
  1689.  
  1690. { share mode numbers (bit field MMIO_SHAREMODE) }
  1691. const
  1692.   MMIO_COMPAT     = $00000000;      { compatibility mode }
  1693.   MMIO_EXCLUSIVE  = $00000010;      { exclusive-access mode }
  1694.   MMIO_DENYWRITE  = $00000020;      { deny writing to other processes }
  1695.   MMIO_DENYREAD   = $00000030;      { deny reading to other processes }
  1696.   MMIO_DENYNONE   = $00000040;      { deny nothing to other processes }
  1697.  
  1698. { various MMIO flags }
  1699. const
  1700.   MMIO_FHOPEN             = $0010;  { mmioClose: keep file handle open }
  1701.   MMIO_EMPTYBUF           = $0010;  { mmioFlush: empty the I/O buffer }
  1702.   MMIO_TOUPPER            = $0010;  { mmioStringToFOURCC: to u-case }
  1703.   MMIO_INSTALLPROC    = $00010000;  { mmioInstallIOProc: install MMIOProc }
  1704.   MMIO_GLOBALPROC     = $10000000;  { mmioInstallIOProc: install globally }
  1705.   MMIO_REMOVEPROC     = $00020000;  { mmioInstallIOProc: remove MMIOProc }
  1706.   MMIO_UNICODEPROC    = $01000000;  { mmioInstallIOProc: Unicode MMIOProc }
  1707.   MMIO_FINDPROC       = $00040000;  { mmioInstallIOProc: find an MMIOProc }
  1708.   MMIO_FINDCHUNK          = $0010;  { mmioDescend: find a chunk by ID }
  1709.   MMIO_FINDRIFF           = $0020;  { mmioDescend: find a LIST chunk }
  1710.   MMIO_FINDLIST           = $0040;  { mmioDescend: find a RIFF chunk }
  1711.   MMIO_CREATERIFF         = $0020;  { mmioCreateChunk: make a LIST chunk }
  1712.   MMIO_CREATELIST         = $0040;  { mmioCreateChunk: make a RIFF chunk }
  1713.  
  1714.  
  1715. { message numbers for MMIOPROC I/O procedure functions }
  1716. const
  1717.   MMIOM_READ      = MMIO_READ;       { read }
  1718.   MMIOM_WRITE    = MMIO_WRITE;       { write }
  1719.   MMIOM_SEEK              = 2;       { seek to a new position in file }
  1720.   MMIOM_OPEN              = 3;       { open file }
  1721.   MMIOM_CLOSE             = 4;       { close file }
  1722.   MMIOM_WRITEFLUSH        = 5;       { write and flush }
  1723.  
  1724. const
  1725.   MMIOM_RENAME            = 6;       { rename specified file }
  1726.  
  1727.   MMIOM_USER         = $8000;       { beginning of user-defined messages }
  1728.  
  1729. { standard four character codes }
  1730. const
  1731.   FOURCC_RIFF = $46464952;   { 'RIFF' }
  1732.   FOURCC_LIST = $5453494C;   { 'LIST' }
  1733.  
  1734. { four character codes used to identify standard built-in I/O procedures }
  1735. const
  1736.   FOURCC_DOS  = $20532F44;   { 'DOS '}
  1737.   FOURCC_MEM  = $204D454D;   { 'MEM '}
  1738.  
  1739. { flags for mmioSeek() }
  1740. const
  1741.   SEEK_SET        = 0;               { seek to an absolute position }
  1742.   SEEK_CUR        = 1;               { seek relative to current position }
  1743.   SEEK_END        = 2;               { seek relative to end of file }
  1744.  
  1745. { other constants }
  1746. const
  1747.   MMIO_DEFAULTBUFFER      = 8192;    { default buffer size }
  1748.  
  1749. { MMIO function prototypes }
  1750. function mmioStringToFOURCCA(sz: PAnsiChar; uFlags: UINT): FOURCC; stdcall;
  1751. function mmioStringToFOURCCW(sz: PWideChar; uFlags: UINT): FOURCC; stdcall;
  1752. function mmioStringToFOURCC(sz: PChar; uFlags: UINT): FOURCC; stdcall;
  1753. function mmioInstallIOProcA(fccIOProc: FOURCC; pIOProc: TFNMMIOProc;
  1754.   dwFlags: DWORD): TFNMMIOProc; stdcall;
  1755. function mmioInstallIOProcW(fccIOProc: FOURCC; pIOProc: TFNMMIOProc;
  1756.   dwFlags: DWORD): TFNMMIOProc; stdcall;
  1757. function mmioInstallIOProc(fccIOProc: FOURCC; pIOProc: TFNMMIOProc;
  1758.   dwFlags: DWORD): TFNMMIOProc; stdcall;
  1759. function mmioOpenA(szFileName: PChar; lpmmioinfo: PMMIOInfo;
  1760.   dwOpenFlags: DWORD): HMMIO; stdcall;
  1761. function mmioOpenW(szFileName: PChar; lpmmioinfo: PMMIOInfo;
  1762.   dwOpenFlags: DWORD): HMMIO; stdcall;
  1763. function mmioOpen(szFileName: PChar; lpmmioinfo: PMMIOInfo;
  1764.   dwOpenFlags: DWORD): HMMIO; stdcall;
  1765. function mmioRenameA(szFileName, szNewFileName: PAnsiChar;
  1766.   lpmmioinfo: PMMIOInfo; dwRenameFlags: DWORD): MMRESULT; stdcall;
  1767. function mmioRenameW(szFileName, szNewFileName: PWideChar;
  1768.   lpmmioinfo: PMMIOInfo; dwRenameFlags: DWORD): MMRESULT; stdcall;
  1769. function mmioRename(szFileName, szNewFileName: PChar;
  1770.   lpmmioinfo: PMMIOInfo; dwRenameFlags: DWORD): MMRESULT; stdcall;
  1771. function mmioClose(hmmio: HMMIO; uFlags: UINT): MMRESULT; stdcall;
  1772. function mmioRead(hmmio: HMMIO; pch: PChar; cch: Longint): Longint; stdcall;
  1773. function mmioWrite(hmmio: HMMIO; pch: PChar; cch: Longint): Longint; stdcall;
  1774. function mmioSeek(hmmio: HMMIO; lOffset: Longint;
  1775.   iOrigin: Integer): Longint; stdcall;
  1776. function mmioGetInfo(hmmio: HMMIO; lpmmioinfo: PMMIOInfo; uFlags: UINT): MMRESULT; stdcall;
  1777. function mmioSetInfo(hmmio: HMMIO; lpmmioinfo: PMMIOInfo; uFlags: UINT): MMRESULT; stdcall;
  1778. function mmioSetBuffer(hmmio: HMMIO; pchBuffer: PChar; cchBuffer: Longint;
  1779.   uFlags: Word): MMRESULT; stdcall;
  1780. function mmioFlush(hmmio: HMMIO; uFlags: UINT): MMRESULT; stdcall;
  1781. function mmioAdvance(hmmio: HMMIO; lpmmioinfo: PMMIOInfo; uFlags: UINT): MMRESULT; stdcall;
  1782. function mmioSendMessage(hmmio: HMMIO; uMessage: UINT;
  1783.   lParam1, lParam2: DWORD): Longint; stdcall;
  1784. function mmioDescend(hmmio: HMMIO; lpck: PMMCKInfo;
  1785.   lpckParent: PMMCKInfo; uFlags: UINT): MMRESULT; stdcall;
  1786. function mmioAscend(hmmio: HMMIO; lpck: PMMCKInfo; uFlags: UINT): MMRESULT; stdcall;
  1787. function mmioCreateChunk(hmmio: HMMIO; lpck: PMMCKInfo; uFlags: UINT): MMRESULT; stdcall;
  1788.  
  1789.  
  1790. {***************************************************************************
  1791.  
  1792.                             MCI support
  1793.  
  1794. ***************************************************************************}
  1795.  
  1796. type
  1797.   MCIERROR = DWORD;     { error return code, 0 means no error }
  1798.   MCIDEVICEID = UINT;   { MCI device ID type }
  1799.  
  1800.   TFNYieldProc = function(mciId: MCIDEVICEID; dwYieldData: DWORD): UINT stdcall;
  1801.  
  1802. { MCI function prototypes }
  1803. function mciSendCommandA(mciId: MCIDEVICEID; uMessage: UINT;
  1804.   dwParam1, dwParam2: DWORD): MCIERROR; stdcall;
  1805. function mciSendCommandW(mciId: MCIDEVICEID; uMessage: UINT;
  1806.   dwParam1, dwParam2: DWORD): MCIERROR; stdcall;
  1807. function mciSendCommand(mciId: MCIDEVICEID; uMessage: UINT;
  1808.   dwParam1, dwParam2: DWORD): MCIERROR; stdcall;
  1809. function mciSendStringA(lpstrCommand, lpstrReturnString: PAnsiChar;
  1810.   uReturnLength: UINT; hWndCallback: HWND): MCIERROR; stdcall;
  1811. function mciSendStringW(lpstrCommand, lpstrReturnString: PWideChar;
  1812.   uReturnLength: UINT; hWndCallback: HWND): MCIERROR; stdcall;
  1813. function mciSendString(lpstrCommand, lpstrReturnString: PChar;
  1814.   uReturnLength: UINT; hWndCallback: HWND): MCIERROR; stdcall;
  1815. function mciGetDeviceIDA(pszDevice: PAnsiChar): MCIDEVICEID; stdcall;
  1816. function mciGetDeviceIDW(pszDevice: PWideChar): MCIDEVICEID; stdcall;
  1817. function mciGetDeviceID(pszDevice: PChar): MCIDEVICEID; stdcall;
  1818. function mciGetDeviceIDFromElementIDA(dwElementID: DWORD; lpstrType: PAnsiChar): MCIDEVICEID; stdcall;
  1819. function mciGetDeviceIDFromElementIDW(dwElementID: DWORD; lpstrType: PWideChar): MCIDEVICEID; stdcall;
  1820. function mciGetDeviceIDFromElementID(dwElementID: DWORD; lpstrType: PChar): MCIDEVICEID; stdcall;
  1821. function mciGetErrorStringA(mcierr: MCIERROR; pszText: PAnsiChar; uLength: UINT): BOOL; stdcall;
  1822. function mciGetErrorStringW(mcierr: MCIERROR; pszText: PWideChar; uLength: UINT): BOOL; stdcall;
  1823. function mciGetErrorString(mcierr: MCIERROR; pszText: PChar; uLength: UINT): BOOL; stdcall;
  1824. function mciSetYieldProc(mcierr: MCIERROR; fpYieldProc: TFNYieldProc;
  1825.   dwYieldData: DWORD): BOOL; stdcall;
  1826. function mciGetCreatorTask(mcierr: MCIERROR): HTASK; stdcall;
  1827. function mciGetYieldProc(mcierr: MCIERROR; lpdwYieldData: PDWORD): TFNYieldProc; stdcall;
  1828. function mciExecute(pszCommand: LPCSTR): BOOL; stdcall;
  1829.  
  1830.  
  1831. { MCI error return values }
  1832. const
  1833.   MCIERR_INVALID_DEVICE_ID        = MCIERR_BASE + 1;
  1834.   MCIERR_UNRECOGNIZED_KEYWORD     = MCIERR_BASE + 3;
  1835.   MCIERR_UNRECOGNIZED_COMMAND     = MCIERR_BASE + 5;
  1836.   MCIERR_HARDWARE                 = MCIERR_BASE + 6;
  1837.   MCIERR_INVALID_DEVICE_NAME      = MCIERR_BASE + 7;
  1838.   MCIERR_OUT_OF_MEMORY            = MCIERR_BASE + 8;
  1839.   MCIERR_DEVICE_OPEN              = MCIERR_BASE + 9;
  1840.   MCIERR_CANNOT_LOAD_DRIVER       = MCIERR_BASE + 10;
  1841.   MCIERR_MISSING_COMMAND_STRING   = MCIERR_BASE + 11;
  1842.   MCIERR_PARAM_OVERFLOW           = MCIERR_BASE + 12;
  1843.   MCIERR_MISSING_STRING_ARGUMENT  = MCIERR_BASE + 13;
  1844.   MCIERR_BAD_INTEGER              = MCIERR_BASE + 14;
  1845.   MCIERR_PARSER_INTERNAL          = MCIERR_BASE + 15;
  1846.   MCIERR_DRIVER_INTERNAL          = MCIERR_BASE + 16;
  1847.   MCIERR_MISSING_PARAMETER        = MCIERR_BASE + 17;
  1848.   MCIERR_UNSUPPORTED_FUNCTION     = MCIERR_BASE + 18;
  1849.   MCIERR_FILE_NOT_FOUND           = MCIERR_BASE + 19;
  1850.   MCIERR_DEVICE_NOT_READY         = MCIERR_BASE + 20;
  1851.   MCIERR_INTERNAL                 = MCIERR_BASE + 21;
  1852.   MCIERR_DRIVER                   = MCIERR_BASE + 22;
  1853.   MCIERR_CANNOT_USE_ALL           = MCIERR_BASE + 23;
  1854.   MCIERR_MULTIPLE                 = MCIERR_BASE + 24;
  1855.   MCIERR_EXTENSION_NOT_FOUND      = MCIERR_BASE + 25;
  1856.   MCIERR_OUTOFRANGE               = MCIERR_BASE + 26;
  1857.   MCIERR_FLAGS_NOT_COMPATIBLE     = MCIERR_BASE + 28;
  1858.   MCIERR_FILE_NOT_SAVED           = MCIERR_BASE + 30;
  1859.   MCIERR_DEVICE_TYPE_REQUIRED     = MCIERR_BASE + 31;
  1860.   MCIERR_DEVICE_LOCKED            = MCIERR_BASE + 32;
  1861.   MCIERR_DUPLICATE_ALIAS          = MCIERR_BASE + 33;
  1862.   MCIERR_BAD_CONSTANT             = MCIERR_BASE + 34;
  1863.   MCIERR_MUST_USE_SHAREABLE       = MCIERR_BASE + 35;
  1864.   MCIERR_MISSING_DEVICE_NAME      = MCIERR_BASE + 36;
  1865.   MCIERR_BAD_TIME_FORMAT          = MCIERR_BASE + 37;
  1866.   MCIERR_NO_CLOSING_QUOTE         = MCIERR_BASE + 38;
  1867.   MCIERR_DUPLICATE_FLAGS          = MCIERR_BASE + 39;
  1868.   MCIERR_INVALID_FILE             = MCIERR_BASE + 40;
  1869.   MCIERR_NULL_PARAMETER_BLOCK     = MCIERR_BASE + 41;
  1870.   MCIERR_UNNAMED_RESOURCE         = MCIERR_BASE + 42;
  1871.   MCIERR_NEW_REQUIRES_ALIAS       = MCIERR_BASE + 43;
  1872.   MCIERR_NOTIFY_ON_AUTO_OPEN      = MCIERR_BASE + 44;
  1873.   MCIERR_NO_ELEMENT_ALLOWED       = MCIERR_BASE + 45;
  1874.   MCIERR_NONAPPLICABLE_FUNCTION   = MCIERR_BASE + 46;
  1875.   MCIERR_ILLEGAL_FOR_AUTO_OPEN    = MCIERR_BASE + 47;
  1876.   MCIERR_FILENAME_REQUIRED        = MCIERR_BASE + 48;
  1877.   MCIERR_EXTRA_CHARACTERS         = MCIERR_BASE + 49;
  1878.   MCIERR_DEVICE_NOT_INSTALLED     = MCIERR_BASE + 50;
  1879.   MCIERR_GET_CD                   = MCIERR_BASE + 51;
  1880.   MCIERR_SET_CD                   = MCIERR_BASE + 52;
  1881.   MCIERR_SET_DRIVE                = MCIERR_BASE + 53;
  1882.   MCIERR_DEVICE_LENGTH            = MCIERR_BASE + 54;
  1883.   MCIERR_DEVICE_ORD_LENGTH        = MCIERR_BASE + 55;
  1884.   MCIERR_NO_INTEGER               = MCIERR_BASE + 56;
  1885.  
  1886. const
  1887.   MCIERR_WAVE_OUTPUTSINUSE        = MCIERR_BASE + 64;
  1888.   MCIERR_WAVE_SETOUTPUTINUSE      = MCIERR_BASE + 65;
  1889.   MCIERR_WAVE_INPUTSINUSE         = MCIERR_BASE + 66;
  1890.   MCIERR_WAVE_SETINPUTINUSE       = MCIERR_BASE + 67;
  1891.   MCIERR_WAVE_OUTPUTUNSPECIFIED   = MCIERR_BASE + 68;
  1892.   MCIERR_WAVE_INPUTUNSPECIFIED    = MCIERR_BASE + 69;
  1893.   MCIERR_WAVE_OUTPUTSUNSUITABLE   = MCIERR_BASE + 70;
  1894.   MCIERR_WAVE_SETOUTPUTUNSUITABLE = MCIERR_BASE + 71;
  1895.   MCIERR_WAVE_INPUTSUNSUITABLE    = MCIERR_BASE + 72;
  1896.   MCIERR_WAVE_SETINPUTUNSUITABLE  = MCIERR_BASE + 73;
  1897.  
  1898.   MCIERR_SEQ_DIV_INCOMPATIBLE     = MCIERR_BASE + 80;
  1899.   MCIERR_SEQ_PORT_INUSE           = MCIERR_BASE + 81;
  1900.   MCIERR_SEQ_PORT_NONEXISTENT     = MCIERR_BASE + 82;
  1901.   MCIERR_SEQ_PORT_MAPNODEVICE     = MCIERR_BASE + 83;
  1902.   MCIERR_SEQ_PORT_MISCERROR       = MCIERR_BASE + 84;
  1903.   MCIERR_SEQ_TIMER                = MCIERR_BASE + 85;
  1904.   MCIERR_SEQ_PORTUNSPECIFIED      = MCIERR_BASE + 86;
  1905.   MCIERR_SEQ_NOMIDIPRESENT        = MCIERR_BASE + 87;
  1906.  
  1907.   MCIERR_NO_WINDOW                = MCIERR_BASE + 90;
  1908.   MCIERR_CREATEWINDOW             = MCIERR_BASE + 91;
  1909.   MCIERR_FILE_READ                = MCIERR_BASE + 92;
  1910.   MCIERR_FILE_WRITE               = MCIERR_BASE + 93;
  1911.  
  1912.   MCIERR_NO_IDENTITY              = MCIERR_BASE + 94;
  1913.  
  1914. { all custom device driver errors must be >= this value }
  1915. const
  1916.   MCIERR_CUSTOM_DRIVER_BASE       = mcierr_Base + 256;
  1917.  
  1918. { MCI command message identifiers }
  1919. const
  1920.   MCI_OPEN       = $0803;
  1921.   MCI_CLOSE      = $0804;
  1922.   MCI_ESCAPE     = $0805;
  1923.   MCI_PLAY       = $0806;
  1924.   MCI_SEEK       = $0807;
  1925.   MCI_STOP       = $0808;
  1926.   MCI_PAUSE      = $0809;
  1927.   MCI_INFO       = $080A;
  1928.   MCI_GETDEVCAPs = $080B;
  1929.   MCI_SPIN       = $080C;
  1930.   MCI_SET        = $080D;
  1931.   MCI_STEP       = $080E;
  1932.   MCI_RECORD     = $080F;
  1933.   MCI_SYSINFO    = $0810;
  1934.   MCI_BREAK      = $0811;
  1935.   MCI_SOUND      = $0812;
  1936.   MCI_SAVE       = $0813;
  1937.   MCI_STATUS     = $0814;
  1938.   MCI_CUE        = $0830;
  1939.   MCI_REALIZE    = $0840;
  1940.   MCI_WINDOW     = $0841;
  1941.   MCI_PUT        = $0842;
  1942.   MCI_WHERE      = $0843;
  1943.   MCI_FREEZE     = $0844;
  1944.   MCI_UNFREEZE   = $0845;
  1945.   MCI_LOAD       = $0850;
  1946.   MCI_CUT        = $0851;
  1947.   MCI_COPY       = $0852;
  1948.   MCI_PASTE      = $0853;
  1949.   MCI_UPDATE     = $0854;
  1950.   MCI_RESUME     = $0855;
  1951.   MCI_DELETE     = $0856;
  1952.  
  1953. { all custom MCI command messages must be >= this value }
  1954. const
  1955.   MCI_USER_MESSAGES               = $400 + drv_MCI_First;
  1956.   MCI_LAST                        = $0FFF;
  1957.  
  1958. { device ID for "all devices" }
  1959. const
  1960.   MCI_ALL_DEVICE_ID               = UINT(-1);
  1961.  
  1962. { constants for predefined MCI device types }
  1963. const
  1964.   MCI_DEVTYPE_VCR                 = MCI_STRING_OFFSET + 1;
  1965.   MCI_DEVTYPE_VIDEODISC           = MCI_STRING_OFFSET + 2;
  1966.   MCI_DEVTYPE_OVERLAY             = MCI_STRING_OFFSET + 3;
  1967.   MCI_DEVTYPE_CD_AUDIO            = MCI_STRING_OFFSET + 4;
  1968.   MCI_DEVTYPE_DAT                 = MCI_STRING_OFFSET + 5;
  1969.   MCI_DEVTYPE_SCANNER             = MCI_STRING_OFFSET + 6;
  1970.   MCI_DEVTYPE_ANIMATION           = MCI_STRING_OFFSET + 7;
  1971.   MCI_DEVTYPE_DIGITAL_VIDEO       = MCI_STRING_OFFSET + 8;
  1972.   MCI_DEVTYPE_OTHER               = MCI_STRING_OFFSET + 9;
  1973.   MCI_DEVTYPE_WAVEFORM_AUDIO      = MCI_STRING_OFFSET + 10;
  1974.   MCI_DEVTYPE_SEQUENCER           = MCI_STRING_OFFSET + 11;
  1975.  
  1976.   MCI_DEVTYPE_FIRST              = MCI_DEVTYPE_VCR;
  1977.   MCI_DEVTYPE_LAST               = MCI_DEVTYPE_SEQUENCER;
  1978.  
  1979.   MCI_DEVTYPE_FIRST_USER         = 1000;
  1980.  
  1981. { return values for 'status mode' command }
  1982. const
  1983.   MCI_MODE_NOT_READY              = MCI_STRING_OFFSET + 12;
  1984.   MCI_MODE_STOP                   = MCI_STRING_OFFSET + 13;
  1985.   MCI_MODE_PLAY                   = MCI_STRING_OFFSET + 14;
  1986.   MCI_MODE_RECORD                 = MCI_STRING_OFFSET + 15;
  1987.   MCI_MODE_SEEK                   = MCI_STRING_OFFSET + 16;
  1988.   MCI_MODE_PAUSE                  = MCI_STRING_OFFSET + 17;
  1989.   MCI_MODE_OPEN                   = MCI_STRING_OFFSET + 18;
  1990.  
  1991. { constants used in 'set time format' and 'status time format' commands }
  1992. const
  1993.   MCI_FORMAT_MILLISECONDS         = 0;
  1994.   MCI_FORMAT_HMS                  = 1;
  1995.   MCI_FORMAT_MSF                  = 2;
  1996.   MCI_FORMAT_FRAMES               = 3;
  1997.   MCI_FORMAT_SMPTE_24             = 4;
  1998.   MCI_FORMAT_SMPTE_25             = 5;
  1999.   MCI_FORMAT_SMPTE_30             = 6;
  2000.   MCI_FORMAT_SMPTE_30DROP         = 7;
  2001.   MCI_FORMAT_BYTES                = 8;
  2002.   MCI_FORMAT_SAMPLES              = 9;
  2003.   MCI_FORMAT_TMSF                 = 10;
  2004.  
  2005. { MCI time format conversion macros }
  2006.  
  2007. function mci_MSF_Minute(msf: Longint): Byte;
  2008. function mci_MSF_Second(msf: Longint): Byte;
  2009. function mci_MSF_Frame(msf: Longint): Byte;
  2010. function mci_Make_MSF(m, s, f: Byte): Longint;
  2011. function mci_TMSF_Track(tmsf: Longint): Byte;
  2012. function mci_TMSF_Minute(tmsf: Longint): Byte;
  2013. function mci_TMSF_Second(tmsf: Longint): Byte;
  2014. function mci_TMSF_Frame(tmsf: Longint): Byte;
  2015. function mci_Make_TMSF(t, m, s, f: Byte): Longint;
  2016. function mci_HMS_Hour(hms: Longint): Byte;
  2017. function mci_HMS_Minute(hms: Longint): Byte;
  2018. function mci_HMS_Second(hms: Longint): Byte;
  2019. function mci_Make_HMS(h, m, s: Byte): Longint;
  2020.  
  2021. { flags for wParam of MM_MCINOTIFY message }
  2022. const
  2023.   MCI_NOTIFY_SUCCESSFUL           = $0001;
  2024.   MCI_NOTIFY_SUPERSEDED           = $0002;
  2025.   MCI_NOTIFY_ABORTED              = $0004;
  2026.   MCI_NOTIFY_FAILURE              = $0008;
  2027.  
  2028. { common flags for dwFlags parameter of MCI command messages }
  2029. const
  2030.   MCI_NOTIFY                      = $00000001;
  2031.   MCI_WAIT                        = $00000002;
  2032.   MCI_FROM                        = $00000004;
  2033.   MCI_TO                          = $00000008;
  2034.   MCI_TRACK                       = $00000010;
  2035.  
  2036. { flags for dwFlags parameter of MCI_OPEN command message }
  2037. const
  2038.   MCI_OPEN_SHAREABLE              = $00000100;
  2039.   MCI_OPEN_ELEMENT                = $00000200;
  2040.   MCI_OPEN_ALIAS                  = $00000400;
  2041.   MCI_OPEN_ELEMENT_ID             = $00000800;
  2042.   MCI_OPEN_TYPE_ID                = $00001000;
  2043.   MCI_OPEN_TYPE                   = $00002000;
  2044.  
  2045. { flags for dwFlags parameter of MCI_SEEK command message }
  2046. const
  2047.   MCI_SEEK_TO_START               = $00000100;
  2048.   MCI_SEEK_TO_END                 = $00000200;
  2049.  
  2050. { flags for dwFlags parameter of MCI_STATUS command message }
  2051. const
  2052.   MCI_STATUS_ITEM                 = $00000100;
  2053.   MCI_STATUS_START                = $00000200;
  2054.  
  2055. { flags for dwItem field of the MCI_STATUS_PARMS parameter block }
  2056. const
  2057.   MCI_STATUS_LENGTH               = $00000001;
  2058.   MCI_STATUS_POSITION             = $00000002;
  2059.   MCI_STATUS_NUMBER_OF_TRACKS     = $00000003;
  2060.   MCI_STATUS_MODE                 = $00000004;
  2061.   MCI_STATUS_MEDIA_PRESENT        = $00000005;
  2062.   MCI_STATUS_TIME_FORMAT          = $00000006;
  2063.   MCI_STATUS_READY                = $00000007;
  2064.   MCI_STATUS_CURRENT_TRACK        = $00000008;
  2065.  
  2066. { flags for dwFlags parameter of MCI_INFO command message }
  2067. const
  2068.   MCI_INFO_PRODUCT                = $00000100;
  2069.   MCI_INFO_FILE                   = $00000200;
  2070.   MCI_INFO_MEDIA_UPC              = $00000400;
  2071.   MCI_INFO_MEDIA_IDENTITY         = $00000800;
  2072.   MCI_INFO_NAME                   = $00001000;
  2073.   MCI_INFO_COPYRIGHT              = $00002000;
  2074.  
  2075. { flags for dwFlags parameter of MCI_GETDEVCAPS command message }
  2076. const
  2077.   MCI_GETDEVCAPS_ITEM             = $00000100;
  2078.  
  2079. { flags for dwItem field of the MCI_GETDEVCAPS_PARMS parameter block }
  2080. const
  2081.   MCI_GETDEVCAPS_CAN_RECORD       = $00000001;
  2082.   MCI_GETDEVCAPS_HAS_AUDIO        = $00000002;
  2083.   MCI_GETDEVCAPS_HAS_VIDEO        = $00000003;
  2084.   MCI_GETDEVCAPS_DEVICE_TYPE      = $00000004;
  2085.   MCI_GETDEVCAPS_USES_FILES       = $00000005;
  2086.   MCI_GETDEVCAPS_COMPOUND_DEVICE  = $00000006;
  2087.   MCI_GETDEVCAPS_CAN_EJECT        = $00000007;
  2088.   MCI_GETDEVCAPS_CAN_PLAY         = $00000008;
  2089.   MCI_GETDEVCAPS_CAN_SAVE         = $00000009;
  2090.  
  2091. { flags for dwFlags parameter of MCI_SYSINFO command message }
  2092. const
  2093.   MCI_SYSINFO_QUANTITY            = $00000100;
  2094.   MCI_SYSINFO_OPEN                = $00000200;
  2095.   MCI_SYSINFO_NAME                = $00000400;
  2096.   MCI_SYSINFO_INSTALLNAME         = $00000800;
  2097.  
  2098. { flags for dwFlags parameter of MCI_SET command message }
  2099. const
  2100.   MCI_SET_DOOR_OPEN               = $00000100;
  2101.   MCI_SET_DOOR_CLOSED             = $00000200;
  2102.   MCI_SET_TIME_FORMAT             = $00000400;
  2103.   MCI_SET_AUDIO                   = $00000800;
  2104.   MCI_SET_VIDEO                   = $00001000;
  2105.   MCI_SET_ON                      = $00002000;
  2106.   MCI_SET_OFF                     = $00004000;
  2107.  
  2108. { flags for dwAudio field of MCI_SET_PARMS or MCI_SEQ_SET_PARMS }
  2109. const
  2110.   MCI_SET_AUDIO_ALL               = $00000000;
  2111.   MCI_SET_AUDIO_LEFT              = $00000001;
  2112.   MCI_SET_AUDIO_RIGHT             = $00000002;
  2113.  
  2114. { flags for dwFlags parameter of MCI_BREAK command message }
  2115. const
  2116.   MCI_BREAK_KEY                   = $00000100;
  2117.   MCI_BREAK_HWND                  = $00000200;
  2118.   MCI_BREAK_OFF                   = $00000400;
  2119.  
  2120. { flags for dwFlags parameter of MCI_RECORD command message }
  2121. const
  2122.   MCI_RECORD_INSERT               = $00000100;
  2123.   MCI_RECORD_OVERWRITE            = $00000200;
  2124.  
  2125. { flags for dwFlags parameter of MCI_SOUND command message }
  2126. const
  2127.   MCI_SOUND_NAME                  = $00000100;
  2128.  
  2129. { flags for dwFlags parameter of MCI_SAVE command message }
  2130. const
  2131.   MCI_SAVE_FILE                   = $00000100;
  2132.  
  2133. { flags for dwFlags parameter of MCI_LOAD command message }
  2134. const
  2135.   MCI_LOAD_FILE                   = $00000100;
  2136.  
  2137. { generic parameter block for MCI command messages with no special parameters }
  2138. type
  2139.   PMCI_Generic_Parms = ^TMCI_Generic_Parms;
  2140.   TMCI_Generic_Parms = record
  2141.     dwCallback: DWORD;
  2142.   end;
  2143.  
  2144. { parameter block for MCI_OPEN command message }
  2145. type
  2146.   PMCI_Open_ParmsA = ^TMCI_Open_ParmsA;
  2147.   PMCI_Open_ParmsW = ^TMCI_Open_ParmsW;
  2148.   PMCI_Open_Parms = PMCI_Open_ParmsA;
  2149.   TMCI_Open_ParmsA = record
  2150.     dwCallback: DWORD;
  2151.     wDeviceID: MCIDEVICEID;
  2152.     lpstrDeviceType: PAnsiChar;
  2153.     lpstrElementName: PAnsiChar;
  2154.     lpstrAlias: PAnsiChar;
  2155.   end;
  2156.   TMCI_Open_ParmsW = record
  2157.     dwCallback: DWORD;
  2158.     wDeviceID: MCIDEVICEID;
  2159.     lpstrDeviceType: PWideChar;
  2160.     lpstrElementName: PWideChar;
  2161.     lpstrAlias: PWideChar;
  2162.   end;
  2163.   TMCI_Open_Parms = TMCI_Open_ParmsA;
  2164.  
  2165. { parameter block for MCI_PLAY command message }
  2166. type
  2167.   PMCI_Play_Parms = ^TMCI_Play_Parms;
  2168.   TMCI_Play_Parms = record
  2169.     dwCallback: DWORD;
  2170.     dwFrom: DWORD;
  2171.     dwTo: DWORD;
  2172.   end;
  2173.  
  2174. { parameter block for MCI_SEEK command message }
  2175. type
  2176.   PMCI_Seek_Parms = ^TMCI_Seek_Parms;
  2177.   TMCI_Seek_Parms = record
  2178.     dwCallback: DWORD;
  2179.     dwTo: DWORD;
  2180.   end;
  2181.  
  2182.  
  2183. { parameter block for MCI_STATUS command message }
  2184. type
  2185.   PMCI_Status_Parms = ^TMCI_Status_Parms;
  2186.   TMCI_Status_Parms = record
  2187.     dwCallback: DWORD;
  2188.     dwReturn: DWORD;
  2189.     dwItem: DWORD;
  2190.     dwTrack: DWORD;
  2191.   end;
  2192.  
  2193. { parameter block for MCI_INFO command message }
  2194. type
  2195.   PMCI_Info_ParmsA = ^TMCI_Info_ParmsA;
  2196.   PMCI_Info_ParmsW = ^TMCI_Info_ParmsW;
  2197.   PMCI_Info_Parms = PMCI_Info_ParmsA;
  2198.   TMCI_Info_ParmsA = record
  2199.     dwCallback: DWORD;
  2200.     lpstrReturn: PAnsiChar;
  2201.     dwRetSize: DWORD;
  2202.   end;
  2203.   TMCI_Info_ParmsW = record
  2204.     dwCallback: DWORD;
  2205.     lpstrReturn: PWideChar;
  2206.     dwRetSize: DWORD;
  2207.   end;
  2208.   TMCI_Info_Parms = TMCI_Info_ParmsA;
  2209.  
  2210. { parameter block for MCI_GETDEVCAPS command message }
  2211. type
  2212.   PMCI_GetDevCaps_Parms = ^TMCI_GetDevCaps_Parms;
  2213.   TMCI_GetDevCaps_Parms = record
  2214.     dwCallback: DWORD;
  2215.     dwReturn: DWORD;
  2216.     dwItem: DWORD;
  2217.   end;
  2218.  
  2219. { parameter block for MCI_SYSINFO command message }
  2220. type
  2221.   PMCI_SysInfo_ParmsA = ^TMCI_SysInfo_ParmsA;
  2222.   PMCI_SysInfo_ParmsW = ^TMCI_SysInfo_ParmsW;
  2223.   PMCI_SysInfo_Parms = PMCI_SysInfo_ParmsA;
  2224.   TMCI_SysInfo_ParmsA = record
  2225.     dwCallback: DWORD;
  2226.     lpstrReturn: PAnsiChar;
  2227.     dwRetSize: DWORD;
  2228.     dwNumber: DWORD;
  2229.     wDeviceType: UINT;
  2230.   end;
  2231.   TMCI_SysInfo_ParmsW = record
  2232.     dwCallback: DWORD;
  2233.     lpstrReturn: PWideChar;
  2234.     dwRetSize: DWORD;
  2235.     dwNumber: DWORD;
  2236.     wDeviceType: UINT;
  2237.   end;
  2238.   TMCI_SysInfo_Parms = TMCI_SysInfo_ParmsA;
  2239.  
  2240. { parameter block for MCI_SET command message }
  2241. type
  2242.   PMCI_Set_Parms = ^TMCI_Set_Parms;
  2243.   TMCI_Set_Parms = record
  2244.     dwCallback: DWORD;
  2245.     dwTimeFormat: DWORD;
  2246.     dwAudio: DWORD;
  2247.   end;
  2248.  
  2249.  
  2250. { parameter block for MCI_BREAK command message }
  2251. type
  2252.   PMCI_Break_Parms = ^TMCI_BReak_Parms;
  2253.   TMCI_BReak_Parms = record
  2254.     dwCallback: DWORD;
  2255.     nVirtKey: Integer;
  2256.     hWndBreak: HWND;
  2257.   end;
  2258.  
  2259. { parameter block for MCI_SOUND command message }
  2260. type
  2261.   PMCI_Sound_Parms = ^TMCI_Sound_Parms;
  2262.   TMCI_Sound_Parms = record
  2263.     dwCallback: Longint;
  2264.     lpstrSoundName: PChar;
  2265.   end;
  2266.  
  2267. { parameter block for MCI_SAVE command message }
  2268. type
  2269.   PMCI_Save_ParmsA = ^TMCI_SaveParmsA;
  2270.   PMCI_Save_ParmsW = ^TMCI_SaveParmsW;
  2271.   PMCI_Save_Parms = PMCI_Save_ParmsA;
  2272.   TMCI_SaveParmsA = record
  2273.     dwCallback: DWORD;
  2274.     lpfilename: PAnsiChar;
  2275.   end;
  2276.   TMCI_SaveParmsW = record
  2277.     dwCallback: DWORD;
  2278.     lpfilename: PWideChar;
  2279.   end;
  2280.   TMCI_SaveParms = TMCI_SaveParmsA;
  2281.  
  2282. { parameter block for MCI_LOAD command message }
  2283. type
  2284.   PMCI_Load_ParmsA = ^TMCI_Load_ParmsA;
  2285.   PMCI_Load_ParmsW = ^TMCI_Load_ParmsW;
  2286.   PMCI_Load_Parms = PMCI_Load_ParmsA;
  2287.   TMCI_Load_ParmsA = record
  2288.     dwCallback: DWORD;
  2289.     lpfilename: PAnsiChar;
  2290.   end;
  2291.   TMCI_Load_ParmsW = record
  2292.     dwCallback: DWORD;
  2293.     lpfilename: PWideChar;
  2294.   end;
  2295.   TMCI_Load_Parms = TMCI_Load_ParmsA;
  2296.  
  2297. { parameter block for MCI_RECORD command message }
  2298. type
  2299.   PMCI_Record_Parms = ^TMCI_Record_Parms;
  2300.   TMCI_Record_Parms = record
  2301.     dwCallback: DWORD;
  2302.     dwFrom: DWORD;
  2303.     dwTo: DWORD;
  2304.   end;
  2305.  
  2306.  
  2307. { MCI extensions for videodisc devices }
  2308.  
  2309. { flag for dwReturn field of MCI_STATUS_PARMS }
  2310. { MCI_STATUS command, (dwItem == MCI_STATUS_MODE) }
  2311. const
  2312.   MCI_VD_MODE_PARK                = MCI_VD_OFFSET + 1;
  2313.  
  2314. { flag for dwReturn field of MCI_STATUS_PARMS }
  2315. { MCI_STATUS command, (dwItem == MCI_VD_STATUS_MEDIA_TYPE) }
  2316. const
  2317.   MCI_VD_MEDIA_CLV                = MCI_VD_OFFSET + 2;
  2318.   MCI_VD_MEDIA_CAV                = MCI_VD_OFFSET + 3;
  2319.   MCI_VD_MEDIA_OTHER              = MCI_VD_OFFSET + 4;
  2320.  
  2321. const
  2322.   MCI_VD_FORMAT_TRACK             = $4001;
  2323.  
  2324. { flags for dwFlags parameter of MCI_PLAY command message }
  2325. const
  2326.   MCI_VD_PLAY_REVERSE             = $00010000;
  2327.   MCI_VD_PLAY_FAST                = $00020000;
  2328.   MCI_VD_PLAY_SPEED               = $00040000;
  2329.   MCI_VD_PLAY_SCAN                = $00080000;
  2330.   MCI_VD_PLAY_SLOW                = $00100000;
  2331.  
  2332. { flag for dwFlags parameter of MCI_SEEK command message }
  2333. const
  2334.   MCI_VD_SEEK_REVERSE             = $00010000;
  2335.  
  2336. { flags for dwItem field of MCI_STATUS_PARMS parameter block }
  2337. const
  2338.   MCI_VD_STATUS_SPEED             = $00004002;
  2339.   MCI_VD_STATUS_FORWARD           = $00004003;
  2340.   MCI_VD_STATUS_MEDIA_TYPE        = $00004004;
  2341.   MCI_VD_STATUS_SIDE              = $00004005;
  2342.   MCI_VD_STATUS_DISC_SIZE         = $00004006;
  2343.  
  2344. { flags for dwFlags parameter of MCI_GETDEVCAPS command message }
  2345. const
  2346.   MCI_VD_GETDEVCAPS_CLV           = $00010000;
  2347.   MCI_VD_GETDEVCAPS_CAV           = $00020000;
  2348.  
  2349.   MCI_VD_SPIN_UP                  = $00010000;
  2350.   MCI_VD_SPIN_DOWN                = $00020000;
  2351.  
  2352. { flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block }
  2353. const
  2354.   MCI_VD_GETDEVCAPS_CAN_REVERSE   = $00004002;
  2355.   MCI_VD_GETDEVCAPS_FAST_RATE     = $00004003;
  2356.   MCI_VD_GETDEVCAPS_SLOW_RATE     = $00004004;
  2357.   MCI_VD_GETDEVCAPS_NORMAL_RATE   = $00004005;
  2358.  
  2359. { flags for the dwFlags parameter of MCI_STEP command message }
  2360. const
  2361.   MCI_VD_STEP_FRAMES              = $00010000;
  2362.   MCI_VD_STEP_REVERSE             = $00020000;
  2363.  
  2364. { flag for the MCI_ESCAPE command message }
  2365. const
  2366.   MCI_VD_ESCAPE_STRING            = $00000100;
  2367.  
  2368. { parameter block for MCI_PLAY command message }
  2369. type
  2370.   PMCI_VD_Play_Parms = ^TMCI_VD_Play_Parms;
  2371.   TMCI_VD_Play_Parms = record
  2372.     dwCallback: DWORD;
  2373.     dwFrom: DWORD;
  2374.     dwTo: DWORD;
  2375.     dwSpeed: DWORD;
  2376.   end;
  2377.  
  2378. { parameter block for MCI_STEP command message }
  2379. type
  2380.   PMCI_VD_Step_Parms = ^TMCI_VD_Step_Parms;
  2381.   TMCI_VD_Step_Parms = record
  2382.     dwCallback: DWORD;
  2383.     dwFrames: DWORD;
  2384.   end;
  2385.  
  2386. { parameter block for MCI_ESCAPE command message }
  2387. type
  2388.   PMCI_VD_Escape_ParmsA = ^TMCI_VD_Escape_ParmsA;
  2389.   PMCI_VD_Escape_ParmsW = ^TMCI_VD_Escape_ParmsW;
  2390.   PMCI_VD_Escape_Parms = PMCI_VD_Escape_ParmsA;
  2391.   TMCI_VD_Escape_ParmsA = record
  2392.     dwCallback: DWORD;
  2393.     lpstrCommand: PAnsiChar;
  2394.   end;
  2395.   TMCI_VD_Escape_ParmsW = record
  2396.     dwCallback: DWORD;
  2397.     lpstrCommand: PWideChar;
  2398.   end;
  2399.   TMCI_VD_Escape_Parms = TMCI_VD_Escape_ParmsA;
  2400.  
  2401. { MCI extensions for CD audio devices }
  2402.  
  2403. { flags for the dwItem field of the MCI_STATUS_PARMS parameter block }
  2404. const
  2405.   MCI_CDA_STATUS_TYPE_TRACK       = 00004001;
  2406.  
  2407. { flags for the dwReturn field of MCI_STATUS_PARMS parameter block }
  2408. { MCI_STATUS command, (dwItem == MCI_CDA_STATUS_TYPE_TRACK) }
  2409.   MCI_CDA_TRACK_AUDIO             = MCI_CD_OFFSET + 0;
  2410.   MCI_CDA_TRACK_OTHER             = MCI_CD_OFFSET + 1;
  2411.  
  2412. { MCI extensions for waveform audio devices }
  2413.   MCI_WAVE_PCM                    = MCI_WAVE_OFFSET + 0;
  2414.   MCI_WAVE_MAPPER                 = MCI_WAVE_OFFSET + 1;
  2415.  
  2416. { flags for the dwFlags parameter of MCI_OPEN command message }
  2417. const
  2418.   MCI_WAVE_OPEN_BUFFER            = $00010000;
  2419.  
  2420. { flags for the dwFlags parameter of MCI_SET command message }
  2421. const
  2422.   MCI_WAVE_SET_FORMATTAG          = $00010000;
  2423.   MCI_WAVE_SET_CHANNELS           = $00020000;
  2424.   MCI_WAVE_SET_SAMPLESPERSEC      = $00040000;
  2425.   MCI_WAVE_SET_AVGBYTESPERSEC     = $00080000;
  2426.   MCI_WAVE_SET_BLOCKALIGN         = $00100000;
  2427.   MCI_WAVE_SET_BITSPERSAMPLE      = $00200000;
  2428.  
  2429. { flags for the dwFlags parameter of MCI_STATUS, MCI_SET command messages }
  2430. const
  2431.   MCI_WAVE_INPUT                  = $00400000;
  2432.   MCI_WAVE_OUTPUT                 = $00800000;
  2433.  
  2434. { flags for the dwItem field of MCI_STATUS_PARMS parameter block }
  2435. const
  2436.   MCI_WAVE_STATUS_FORMATTAG       = $00004001;
  2437.   MCI_WAVE_STATUS_CHANNELS        = $00004002;
  2438.   MCI_WAVE_STATUS_SAMPLESPERSEC   = $00004003;
  2439.   MCI_WAVE_STATUS_AVGBYTESPERSEC  = $00004004;
  2440.   MCI_WAVE_STATUS_BLOCKALIGN      = $00004005;
  2441.   MCI_WAVE_STATUS_BITSPERSAMPLE   = $00004006;
  2442.   MCI_WAVE_STATUS_LEVEL           = $00004007;
  2443.  
  2444. { flags for the dwFlags parameter of MCI_SET command message }
  2445. const
  2446.   MCI_WAVE_SET_ANYINPUT           = $04000000;
  2447.   MCI_WAVE_SET_ANYOUTPUT          = $08000000;
  2448.  
  2449. { flags for the dwFlags parameter of MCI_GETDEVCAPS command message }
  2450. const
  2451.   MCI_WAVE_GETDEVCAPS_INPUTS      = $00004001;
  2452.   MCI_WAVE_GETDEVCAPS_OUTPUTS     = $00004002;
  2453.  
  2454. { parameter block for MCI_OPEN command message }
  2455. type
  2456.   PMCI_Wave_Open_ParmsA = ^TMCI_Wave_Open_ParmsA;
  2457.   PMCI_Wave_Open_ParmsW = ^TMCI_Wave_Open_ParmsW;
  2458.   PMCI_Wave_Open_Parms = PMCI_Wave_Open_ParmsA;
  2459.   TMCI_Wave_Open_ParmsA = record
  2460.     dwCallback: DWORD;
  2461.     wDeviceID: MCIDEVICEID;
  2462.     lpstrDeviceType: PAnsiChar;
  2463.     lpstrElementName: PAnsiChar;
  2464.     lpstrAlias: PAnsiChar;
  2465.     dwBufferSeconds: DWORD;
  2466.   end;
  2467.   TMCI_Wave_Open_ParmsW = record
  2468.     dwCallback: DWORD;
  2469.     wDeviceID: MCIDEVICEID;
  2470.     lpstrDeviceType: PWideChar;
  2471.     lpstrElementName: PWideChar;
  2472.     lpstrAlias: PWideChar;
  2473.     dwBufferSeconds: DWORD;
  2474.   end;
  2475.   TMCI_Wave_Open_Parms = TMCI_Wave_Open_ParmsA;
  2476.  
  2477. { parameter block for MCI_DELETE command message }
  2478. type
  2479.   PMCI_Wave_Delete_Parms = ^TMCI_Wave_Delete_Parms;
  2480.   TMCI_Wave_Delete_Parms = record
  2481.     dwCallback: DWORD;
  2482.     dwFrom: DWORD;
  2483.     dwTo: DWORD;
  2484.   end;
  2485.  
  2486. { parameter block for MCI_SET command message }
  2487. type
  2488.   PMCI_Wave_Set_Parms = ^TMCI_Wave_Set_Parms;
  2489.   TMCI_Wave_Set_Parms = record
  2490.     dwCallback: DWORD;
  2491.     dwTimeFormat: DWORD;
  2492.     dwAudio: DWORD;
  2493.     wInput: UINT;
  2494.     wOutput: UINT;
  2495.     wFormatTag: Word;
  2496.     wReserved2: Word;
  2497.     nChannels: Word;
  2498.     wReserved3: Word;
  2499.     nSamplesPerSec: DWORD;
  2500.     nAvgBytesPerSec: DWORD;
  2501.     nBlockAlign: Word;
  2502.     wReserved4: Word;
  2503.     wBitsPerSample: Word;
  2504.     wReserved5: Word;
  2505.   end;
  2506.  
  2507.  
  2508. { MCI extensions for MIDI sequencer devices }
  2509.  
  2510. { flags for the dwReturn field of MCI_STATUS_PARMS parameter block }
  2511. { MCI_STATUS command, (dwItem == MCI_SEQ_STATUS_DIVTYPE) }
  2512. const
  2513.   MCI_SEQ_DIV_PPQN            = 0 + MCI_SEQ_OFFSET;
  2514.   MCI_SEQ_DIV_SMPTE_24        = 1 + MCI_SEQ_OFFSET;
  2515.   MCI_SEQ_DIV_SMPTE_25        = 2 + MCI_SEQ_OFFSET;
  2516.   MCI_SEQ_DIV_SMPTE_30DROP    = 3 + MCI_SEQ_OFFSET;
  2517.   MCI_SEQ_DIV_SMPTE_30        = 4 + MCI_SEQ_OFFSET;
  2518.  
  2519. { flags for the dwMaster field of MCI_SEQ_SET_PARMS parameter block }
  2520. { MCI_SET command, (dwFlags == MCI_SEQ_SET_MASTER) }
  2521. const
  2522.   MCI_SEQ_FORMAT_SONGPTR      = $4001;
  2523.   MCI_SEQ_FILE                = $4002;
  2524.   MCI_SEQ_MIDI                = $4003;
  2525.   MCI_SEQ_SMPTE               = $4004;
  2526.   MCI_SEQ_NONE                = 65533;
  2527.   MCI_SEQ_MAPPER              = 65535;
  2528.  
  2529. { flags for the dwItem field of MCI_STATUS_PARMS parameter block }
  2530. const
  2531.   MCI_SEQ_STATUS_TEMPO            = $00004002;
  2532.   MCI_SEQ_STATUS_PORT             = $00004003;
  2533.   MCI_SEQ_STATUS_SLAVE            = $00004007;
  2534.   MCI_SEQ_STATUS_MASTER           = $00004008;
  2535.   MCI_SEQ_STATUS_OFFSET           = $00004009;
  2536.   MCI_SEQ_STATUS_DIVTYPE          = $0000400A;
  2537.   MCI_SEQ_STATUS_NAME             = $0000400B;
  2538.   MCI_SEQ_STATUS_COPYRIGHT        = $0000400C;
  2539.  
  2540. { flags for the dwFlags parameter of MCI_SET command message }
  2541. const
  2542.   MCI_SEQ_SET_TEMPO               = $00010000;
  2543.   MCI_SEQ_SET_PORT                = $00020000;
  2544.   MCI_SEQ_SET_SLAVE               = $00040000;
  2545.   MCI_SEQ_SET_MASTER              = $00080000;
  2546.   MCI_SEQ_SET_OFFSET              = $01000000;
  2547.  
  2548. { parameter block for MCI_SET command message }
  2549. type
  2550.   PMCI_Seq_Set_Parms = ^TMCI_Seq_Set_Parms;
  2551.   TMCI_Seq_Set_Parms = record
  2552.     dwCallback: DWORD;
  2553.     dwTimeFormat: DWORD;
  2554.     dwAudio: DWORD;
  2555.     dwTempo: DWORD;
  2556.     dwPort: DWORD;
  2557.     dwSlave: DWORD;
  2558.     dwMaster: DWORD;
  2559.     dwOffset: DWORD;
  2560.   end;
  2561.  
  2562. { MCI extensions for animation devices }
  2563.  
  2564. { flags for dwFlags parameter of MCI_OPEN command message }
  2565. const
  2566.   MCI_ANIM_OPEN_WS                = $00010000;
  2567.   MCI_ANIM_OPEN_PARENT            = $00020000;
  2568.   MCI_ANIM_OPEN_NOSTATIC          = $00040000;
  2569.  
  2570. { flags for dwFlags parameter of MCI_PLAY command message }
  2571. const
  2572.   MCI_ANIM_PLAY_SPEED             = $00010000;
  2573.   MCI_ANIM_PLAY_REVERSE           = $00020000;
  2574.   MCI_ANIM_PLAY_FAST              = $00040000;
  2575.   MCI_ANIM_PLAY_SLOW              = $00080000;
  2576.   MCI_ANIM_PLAY_SCAN              = $00100000;
  2577.  
  2578. { flags for dwFlags parameter of MCI_STEP command message }
  2579. const
  2580.   MCI_ANIM_STEP_REVERSE           = $00010000;
  2581.   MCI_ANIM_STEP_FRAMES            = $00020000;
  2582.  
  2583. { flags for dwItem field of MCI_STATUS_PARMS parameter block }
  2584. const
  2585.   MCI_ANIM_STATUS_SPEED           = $00004001;
  2586.   MCI_ANIM_STATUS_FORWARD         = $00004002;
  2587.   MCI_ANIM_STATUS_HWND            = $00004003;
  2588.   MCI_ANIM_STATUS_HPAL            = $00004004;
  2589.   MCI_ANIM_STATUS_STRETCH         = $00004005;
  2590.  
  2591. { flags for the dwFlags parameter of MCI_INFO command message }
  2592. const
  2593.   MCI_ANIM_INFO_TEXT              = $00010000;
  2594.  
  2595. { flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block }
  2596. const
  2597.   MCI_ANIM_GETDEVCAPS_CAN_REVERSE = $00004001;
  2598.   MCI_ANIM_GETDEVCAPS_FAST_RATE   = $00004002;
  2599.   MCI_ANIM_GETDEVCAPS_SLOW_RATE   = $00004003;
  2600.   MCI_ANIM_GETDEVCAPS_NORMAL_RATE = $00004004;
  2601.   MCI_ANIM_GETDEVCAPS_PALETTES    = $00004006;
  2602.   MCI_ANIM_GETDEVCAPS_CAN_STRETCH = $00004007;
  2603.   MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = $00004008;
  2604.  
  2605. { flags for the MCI_REALIZE command message }
  2606. const
  2607.   MCI_ANIM_REALIZE_NORM           = $00010000;
  2608.   MCI_ANIM_REALIZE_BKGD           = $00020000;
  2609.  
  2610. { flags for dwFlags parameter of MCI_WINDOW command message }
  2611. const
  2612.   MCI_ANIM_WINDOW_HWND            = $00010000;
  2613.   MCI_ANIM_WINDOW_STATE           = $00040000;
  2614.   MCI_ANIM_WINDOW_TEXT            = $00080000;
  2615.   MCI_ANIM_WINDOW_ENABLE_STRETCH  = $00100000;
  2616.   MCI_ANIM_WINDOW_DISABLE_STRETCH = $00200000;
  2617.  
  2618. { flags for hWnd field of MCI_ANIM_WINDOW_PARMS parameter block }
  2619. { MCI_WINDOW command message, (dwFlags == MCI_ANIM_WINDOW_HWND) }
  2620. const
  2621.   MCI_ANIM_WINDOW_DEFAULT         = $00000000;
  2622.  
  2623. { flags for dwFlags parameter of MCI_PUT command message }
  2624. const
  2625.   MCI_ANIM_RECT                   = $00010000;
  2626.   MCI_ANIM_PUT_SOURCE             = $00020000;
  2627.   MCI_ANIM_PUT_DESTINATION        = $00040000;
  2628.  
  2629. { flags for dwFlags parameter of MCI_WHERE command message }
  2630. const
  2631.   MCI_ANIM_WHERE_SOURCE           = $00020000;
  2632.   MCI_ANIM_WHERE_DESTINATION      = $00040000;
  2633.  
  2634. { flags for dwFlags parameter of MCI_UPDATE command message }
  2635. const
  2636.   MCI_ANIM_UPDATE_HDC             = $00020000;
  2637.  
  2638. { parameter block for MCI_OPEN command message }
  2639. type
  2640.   PMCI_Anim_Open_ParmsA = ^TMCI_Anim_Open_ParmsA;
  2641.   PMCI_Anim_Open_ParmsW = ^TMCI_Anim_Open_ParmsW;
  2642.   PMCI_Anim_Open_Parms = PMCI_Anim_Open_ParmsA;
  2643.   TMCI_Anim_Open_ParmsA = record
  2644.     dwCallback: DWORD;
  2645.     wDeviceID: MCIDEVICEID;
  2646.     lpstrDeviceType: PAnsiChar;
  2647.     lpstrElementName: PAnsiChar;
  2648.     lpstrAlias: PAnsiChar;
  2649.     dwStyle: DWORD;
  2650.     hWndParent: HWND;
  2651.   end;
  2652.   TMCI_Anim_Open_ParmsW = record
  2653.     dwCallback: DWORD;
  2654.     wDeviceID: MCIDEVICEID;
  2655.     lpstrDeviceType: PWideChar;
  2656.     lpstrElementName: PWideChar;
  2657.     lpstrAlias: PWideChar;
  2658.     dwStyle: DWORD;
  2659.     hWndParent: HWND;
  2660.   end;
  2661.   TMCI_Anim_Open_Parms = TMCI_Anim_Open_ParmsA;
  2662.  
  2663. { parameter block for MCI_PLAY command message }
  2664. type
  2665.   PMCI_Anim_Play_Parms = ^TMCI_Anim_Play_Parms;
  2666.   TMCI_Anim_Play_Parms = record
  2667.     dwCallback: DWORD;
  2668.     dwFrom: DWORD;
  2669.     dwTo: DWORD;
  2670.     dwSpeed: DWORD;
  2671.   end;
  2672.  
  2673. { parameter block for MCI_STEP command message }
  2674. type
  2675.   PMCI_Anim_Step_Parms = ^TMCI_Anim_Step_Parms;
  2676.   TMCI_Anim_Step_Parms = record
  2677.     dwCallback: DWORD;
  2678.     dwFrames: DWORD;
  2679.   end;
  2680.  
  2681. { parameter block for MCI_WINDOW command message }
  2682. type
  2683.   PMCI_Anim_Window_ParmsA = ^TMCI_Anim_Window_ParmsA;
  2684.   PMCI_Anim_Window_ParmsW = ^TMCI_Anim_Window_ParmsW;
  2685.   PMCI_Anim_Window_Parms = PMCI_Anim_Window_ParmsA;
  2686.   TMCI_Anim_Window_ParmsA = record
  2687.     dwCallback: DWORD;
  2688.     Wnd: HWND;  { formerly "hWnd" }
  2689.     nCmdShow: UINT;
  2690.     lpstrText: PAnsiChar;
  2691.   end;
  2692.   TMCI_Anim_Window_ParmsW = record
  2693.     dwCallback: DWORD;
  2694.     Wnd: HWND;  { formerly "hWnd" }
  2695.     nCmdShow: UINT;
  2696.     lpstrText: PWideChar;
  2697.   end;
  2698.   TMCI_Anim_Window_Parms = TMCI_Anim_Window_ParmsA;