PageRenderTime 365ms CodeModel.GetById 72ms app.highlight 268ms RepoModel.GetById 1ms app.codeStats 1ms

/binding/win32/mmsystem.d

http://github.com/wilkie/djehuty
D | 3905 lines | 2894 code | 594 blank | 417 comment | 69 complexity | c70baf485c6bd2c12e08c20d5c506953 MD5 | raw file
   1/*
   2 * mmsystem.d
   3 *
   4 * This module binds MMSystem.h to D. The original copyright notice is
   5 * preserved below.
   6 *
   7 * Author: Dave Wilkinson
   8 * Originated: November 25th, 2009
   9 *
  10 */
  11
  12module binding.win32.mmsystem;
  13
  14import binding.win32.windef;
  15import binding.win32.winnt;
  16import binding.win32.winuser;
  17
  18extern(System):
  19
  20/*==========================================================================
  21 *
  22 *  mmsystem.h -- Include file for Multimedia API's
  23 *
  24 *  Version 4.00
  25 *
  26 *  Copyright (C) 1992-1998 Microsoft Corporation.  All Rights Reserved.
  27 *
  28 *--------------------------------------------------------------------------
  29 *
  30 *  Define:         Prevent inclusion of:
  31 *  --------------  --------------------------------------------------------
  32 *  MMNODRV         Installable driver support
  33 *  MMNOSOUND       Sound support
  34 *  MMNOWAVE        Waveform support
  35 *  MMNOMIDI        MIDI support
  36 *  MMNOAUX         Auxiliary audio support
  37 *  MMNOMIXER       Mixer support
  38 *  MMNOTIMER       Timer support
  39 *  MMNOJOY         Joystick support
  40 *  MMNOMCI         MCI support
  41 *  MMNOMMIO        Multimedia file I/O support
  42 *  MMNOMMSYSTEM    General MMSYSTEM functions
  43 *
  44 *==========================================================================
  45 */
  46
  47/****************************************************************************
  48
  49                    General constants and data types
  50
  51****************************************************************************/
  52
  53/* general constants */
  54const auto MAXPNAMELEN       = 32     ; /* max product name length (including NULL) */
  55const auto MAXERRORLENGTH    = 256    ; /* max error text length (including NULL) */
  56const auto MAX_JOYSTICKOEMVXDNAME  = 260 ; /* max oem vxd name length (including NULL) */
  57
  58/*
  59 *  Microsoft Manufacturer and Product ID's (these have been moved to
  60 *  MMREG.H for Windows 4.00 and above).
  61 */
  62
  63const auto MM_MIDI_MAPPER           = 1   ; /* MIDI Mapper */
  64const auto MM_WAVE_MAPPER           = 2   ; /* Wave Mapper */
  65const auto MM_SNDBLST_MIDIOUT       = 3   ; /* Sound Blaster MIDI output port */
  66const auto MM_SNDBLST_MIDIIN        = 4   ; /* Sound Blaster MIDI input port */
  67const auto MM_SNDBLST_SYNTH         = 5   ; /* Sound Blaster internal synthesizer */
  68const auto MM_SNDBLST_WAVEOUT       = 6   ; /* Sound Blaster waveform output */
  69const auto MM_SNDBLST_WAVEIN        = 7   ; /* Sound Blaster waveform input */
  70const auto MM_ADLIB                 = 9   ; /* Ad Lib-compatible synthesizer */
  71const auto MM_MPU401_MIDIOUT       = 10   ; /* MPU401-compatible MIDI output port */
  72const auto MM_MPU401_MIDIIN        = 11   ; /* MPU401-compatible MIDI input port */
  73const auto MM_PC_JOYSTICK          = 12   ; /* Joystick adapter */
  74
  75/* general data types */
  76
  77alias UINT        MMVERSION;  /* major (high byte), minor (low byte) */
  78alias UINT        VERSION;    /* major (high byte), minor (low byte) */
  79alias UINT        MMRESULT;   /* error return code, 0 means no error */
  80                                /* call as if(err=xxxx(...)) Error(err); else */
  81alias UINT   *LPUINT;
  82
  83
  84
  85/* MMTIME data align(2) structure */
  86align(2) struct MMTIME {
  87    UINT            wType;      /* indicates the contents of the align(2) union */
  88    align(2) union _inner_union {
  89        DWORD       ms;         /* milliseconds */
  90        DWORD       sample;     /* samples */
  91        DWORD       cb;         /* byte count */
  92        DWORD       ticks;      /* ticks in MIDI stream */
  93
  94        /* SMPTE */
  95        align(2) struct _inner_struct {
  96            BYTE    hour;       /* hours */
  97            BYTE    min;        /* minutes */
  98            BYTE    sec;        /* seconds */
  99            BYTE    frame;      /* frames  */
 100            BYTE    fps;        /* frames per second */
 101            BYTE    dummy;      /* pad */
 102            BYTE    pad[2];
 103        }
 104		_inner_struct smpte;
 105
 106        /* MIDI */
 107        align(2) struct _inner_struct2 {
 108            DWORD songptrpos;   /* song pointer position */
 109        }
 110		_inner_struct2 midi;
 111    }
 112	_inner_union u;
 113}
 114
 115alias MMTIME* PMMTIME;
 116alias MMTIME *NPMMTIME;
 117alias MMTIME* LPMMTIME;
 118
 119/* types for wType field in MMTIME align(2) struct */
 120const auto TIME_MS          = 0x0001  ; /* time in milliseconds */
 121const auto TIME_SAMPLES     = 0x0002  ; /* number of wave samples */
 122const auto TIME_BYTES       = 0x0004  ; /* current byte offset */
 123const auto TIME_SMPTE       = 0x0008  ; /* SMPTE time */
 124const auto TIME_MIDI        = 0x0010  ; /* MIDI time */
 125const auto TIME_TICKS       = 0x0020  ; /* Ticks within MIDI stream */
 126
 127/*
 128 *
 129 *
 130 */
 131template MAKEFOURCC(char ch0, char ch1, char ch2, char ch3) {
 132	const auto MAKEFOURCC =
 133              	(cast(DWORD)cast(BYTE)(ch0) | (cast(DWORD)cast(BYTE)(ch1) << 8) |
 134                (cast(DWORD)cast(BYTE)(ch2) << 16) | (cast(DWORD)cast(BYTE)(ch3) << 24 ));
 135}
 136
 137
 138
 139
 140/****************************************************************************
 141
 142                    Multimedia Extensions Window Messages
 143
 144****************************************************************************/
 145
 146const auto MM_JOY1MOVE          = 0x3A0           ; /* joystick */
 147const auto MM_JOY2MOVE          = 0x3A1;
 148const auto MM_JOY1ZMOVE         = 0x3A2;
 149const auto MM_JOY2ZMOVE         = 0x3A3;
 150const auto MM_JOY1BUTTONDOWN    = 0x3B5;
 151const auto MM_JOY2BUTTONDOWN    = 0x3B6;
 152const auto MM_JOY1BUTTONUP      = 0x3B7;
 153const auto MM_JOY2BUTTONUP      = 0x3B8;
 154
 155const auto MM_MCINOTIFY         = 0x3B9           ; /* MCI */
 156
 157const auto MM_WOM_OPEN          = 0x3BB           ; /* waveform output */
 158const auto MM_WOM_CLOSE         = 0x3BC;
 159const auto MM_WOM_DONE          = 0x3BD;
 160
 161const auto MM_WIM_OPEN          = 0x3BE           ; /* waveform input */
 162const auto MM_WIM_CLOSE         = 0x3BF;
 163const auto MM_WIM_DATA          = 0x3C0;
 164
 165const auto MM_MIM_OPEN          = 0x3C1           ; /* MIDI input */
 166const auto MM_MIM_CLOSE         = 0x3C2;
 167const auto MM_MIM_DATA          = 0x3C3;
 168const auto MM_MIM_LONGDATA      = 0x3C4;
 169const auto MM_MIM_ERROR         = 0x3C5;
 170const auto MM_MIM_LONGERROR     = 0x3C6;
 171
 172const auto MM_MOM_OPEN          = 0x3C7           ; /* MIDI output */
 173const auto MM_MOM_CLOSE         = 0x3C8;
 174const auto MM_MOM_DONE          = 0x3C9;
 175
 176/* these are also in msvideo.h */
 177const auto MM_DRVM_OPEN       = 0x3D0;           /* installable drivers */
 178const auto MM_DRVM_CLOSE      = 0x3D1;
 179const auto MM_DRVM_DATA       = 0x3D2;
 180const auto MM_DRVM_ERROR      = 0x3D3;
 181
 182/* these are used by msacm.h */
 183const auto MM_STREAM_OPEN       = 0x3D4;
 184const auto MM_STREAM_CLOSE      = 0x3D5;
 185const auto MM_STREAM_DONE       = 0x3D6;
 186const auto MM_STREAM_ERROR      = 0x3D7;
 187
 188const auto MM_MOM_POSITIONCB    = 0x3CA           ; /* Callback for MEVT_POSITIONCB */
 189
 190const auto MM_MCISIGNAL         = 0x3CB;
 191
 192const auto MM_MIM_MOREDATA       = 0x3CC          ; /* MIM_DONE w/ pending events */
 193
 194const auto MM_MIXM_LINE_CHANGE      = 0x3D0       ; /* mixer line change notify */
 195const auto MM_MIXM_CONTROL_CHANGE   = 0x3D1       ; /* mixer control change notify */
 196
 197
 198/****************************************************************************
 199
 200                String resource number bases (internal use)
 201
 202****************************************************************************/
 203
 204const auto MMSYSERR_BASE           = 0;
 205const auto WAVERR_BASE             = 32;
 206const auto MIDIERR_BASE            = 64;
 207const auto TIMERR_BASE             = 96;
 208const auto JOYERR_BASE             = 160;
 209const auto MCIERR_BASE             = 256;
 210const auto MIXERR_BASE             = 1024;
 211
 212const auto MCI_STRING_OFFSET       = 512;
 213const auto MCI_VD_OFFSET           = 1024;
 214const auto MCI_CD_OFFSET           = 1088;
 215const auto MCI_WAVE_OFFSET         = 1152;
 216const auto MCI_SEQ_OFFSET          = 1216;
 217
 218/****************************************************************************
 219
 220                        General error return values
 221
 222****************************************************************************/
 223
 224/* general error return values */
 225const auto MMSYSERR_NOERROR       = 0                    ; /* no error */
 226const auto MMSYSERR_ERROR         = (MMSYSERR_BASE + 1)  ; /* unspecified error */
 227const auto MMSYSERR_BADDEVICEID   = (MMSYSERR_BASE + 2)  ; /* device ID out of range */
 228const auto MMSYSERR_NOTENABLED    = (MMSYSERR_BASE + 3)  ; /* driver failed enable */
 229const auto MMSYSERR_ALLOCATED     = (MMSYSERR_BASE + 4)  ; /* device already allocated */
 230const auto MMSYSERR_INVALHANDLE   = (MMSYSERR_BASE + 5)  ; /* device handle is invalid */
 231const auto MMSYSERR_NODRIVER      = (MMSYSERR_BASE + 6)  ; /* no device driver present */
 232const auto MMSYSERR_NOMEM         = (MMSYSERR_BASE + 7)  ; /* memory allocation error */
 233const auto MMSYSERR_NOTSUPPORTED  = (MMSYSERR_BASE + 8)  ; /* function isn't supported */
 234const auto MMSYSERR_BADERRNUM     = (MMSYSERR_BASE + 9)  ; /* error value out of range */
 235const auto MMSYSERR_INVALFLAG     = (MMSYSERR_BASE + 10) ; /* invalid flag passed */
 236const auto MMSYSERR_INVALPARAM    = (MMSYSERR_BASE + 11) ; /* invalid parameter passed */
 237const auto MMSYSERR_HANDLEBUSY    = (MMSYSERR_BASE + 12) ; /* handle being used */
 238                                                   /* simultaneously on another */
 239                                                   /* thread (eg callback) */
 240const auto MMSYSERR_INVALIDALIAS  = (MMSYSERR_BASE + 13) ; /* specified alias not found */
 241const auto MMSYSERR_BADDB         = (MMSYSERR_BASE + 14) ; /* bad registry database */
 242const auto MMSYSERR_KEYNOTFOUND   = (MMSYSERR_BASE + 15) ; /* registry key not found */
 243const auto MMSYSERR_READERROR     = (MMSYSERR_BASE + 16) ; /* registry read error */
 244const auto MMSYSERR_WRITEERROR    = (MMSYSERR_BASE + 17) ; /* registry write error */
 245const auto MMSYSERR_DELETEERROR   = (MMSYSERR_BASE + 18) ; /* registry delete error */
 246const auto MMSYSERR_VALNOTFOUND   = (MMSYSERR_BASE + 19) ; /* registry value not found */
 247const auto MMSYSERR_NODRIVERCB    = (MMSYSERR_BASE + 20) ; /* driver does not call DriverCallback */
 248const auto MMSYSERR_MOREDATA      = (MMSYSERR_BASE + 21) ; /* more data to be returned */
 249const auto MMSYSERR_LASTERROR     = (MMSYSERR_BASE + 21) ; /* last error in range */
 250
 251alias HANDLE HDRVR;
 252
 253/****************************************************************************
 254
 255                        Installable driver support
 256
 257****************************************************************************/
 258
 259version(MMNODRV) {
 260}
 261else {
 262	align(2) struct DRVCONFIGINFOEX {
 263	    DWORD   dwDCISize;
 264	    LPCWSTR  lpszDCISectionName;
 265	    LPCWSTR  lpszDCIAliasName;
 266	    DWORD    dnDevNode;
 267	}
 268	
 269	alias DRVCONFIGINFOEX* PDRVCONFIGINFOEX;
 270	alias DRVCONFIGINFOEX *NPDRVCONFIGINFOEX;
 271	alias DRVCONFIGINFOEX* LPDRVCONFIGINFOEX;
 272	
 273	/* Driver messages */
 274	const auto DRV_LOAD                 = 0x0001;
 275	const auto DRV_ENABLE               = 0x0002;
 276	const auto DRV_OPEN                 = 0x0003;
 277	const auto DRV_CLOSE                = 0x0004;
 278	const auto DRV_DISABLE              = 0x0005;
 279	const auto DRV_FREE                 = 0x0006;
 280	const auto DRV_CONFIGURE            = 0x0007;
 281	const auto DRV_QUERYCONFIGURE       = 0x0008;
 282	const auto DRV_INSTALL              = 0x0009;
 283	const auto DRV_REMOVE               = 0x000A;
 284	const auto DRV_EXITSESSION          = 0x000B;
 285	const auto DRV_POWER                = 0x000F;
 286	const auto DRV_RESERVED             = 0x0800;
 287	const auto DRV_USER                 = 0x4000;
 288	
 289	/* LPARAM of DRV_CONFIGURE message */
 290	align(2) struct DRVCONFIGINFO {
 291	    DWORD   dwDCISize;
 292	    LPCWSTR  lpszDCISectionName;
 293	    LPCWSTR  lpszDCIAliasName;
 294	}
 295	
 296	alias DRVCONFIGINFO* PDRVCONFIGINFO;
 297	alias DRVCONFIGINFO *NPDRVCONFIGINFO;
 298	alias DRVCONFIGINFO* LPDRVCONFIGINFO;
 299	
 300	/* Supported return values for DRV_CONFIGURE message */
 301	const auto DRVCNF_CANCEL            = 0x0000;
 302	const auto DRVCNF_OK                = 0x0001;
 303	const auto DRVCNF_RESTART           = 0x0002;
 304	
 305	/* installable driver function prototypes */
 306	alias LRESULT function(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM) DRIVERPROC;
 307	
 308	LRESULT   CloseDriver( HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
 309	HDRVR     OpenDriver( LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2);
 310	LRESULT   SendDriverMessage( HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2);
 311	HMODULE   DrvGetModuleHandle( HDRVR hDriver);
 312	HMODULE   GetDriverModuleHandle( HDRVR hDriver);
 313	LRESULT   DefDriverProc( DWORD_PTR dwDriverIdentifier, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
 314	
 315	/* return values from DriverProc() function */
 316	const auto DRV_CANCEL              = DRVCNF_CANCEL;
 317	const auto DRV_OK                  = DRVCNF_OK;
 318	const auto DRV_RESTART             = DRVCNF_RESTART;
 319
 320	const auto DRV_MCI_FIRST           = DRV_RESERVED;
 321	const auto DRV_MCI_LAST            = (DRV_RESERVED + 0xFFF);
 322}
 323
 324/****************************************************************************
 325
 326                          Driver callback support
 327
 328****************************************************************************/
 329
 330/* flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and */
 331/* midiOutOpen() to specify the type of the dwCallback parameter. */
 332
 333const auto CALLBACK_TYPEMASK    = 0x00070000    ; /* callback type mask */
 334const auto CALLBACK_NULL        = 0x00000000    ; /* no callback */
 335const auto CALLBACK_WINDOW      = 0x00010000    ; /* dwCallback is a HWND */
 336const auto CALLBACK_TASK        = 0x00020000    ; /* dwCallback is a HTASK */
 337const auto CALLBACK_FUNCTION    = 0x00030000    ; /* dwCallback is a FARPROC */
 338
 339const auto CALLBACK_THREAD      = (CALLBACK_TASK); /* thread ID replaces 16 bit task */
 340const auto CALLBACK_EVENT       = 0x00050000    ; /* dwCallback is an EVENT Handle */
 341
 342alias void function(HDRVR hdrvr, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DRVCALLBACK;
 343
 344alias DRVCALLBACK *LPDRVCALLBACK;
 345
 346alias DRVCALLBACK     *PDRVCALLBACK;
 347
 348/****************************************************************************
 349
 350                    General MMSYSTEM support
 351
 352****************************************************************************/
 353
 354version(MMNOMMSYSTEM) {
 355}
 356else {
 357	UINT mmsystemGetVersion();
 358}
 359
 360/****************************************************************************
 361
 362                            Sound support
 363
 364****************************************************************************/
 365
 366version(MMNOSOUND) {
 367}
 368else {
 369	BOOL sndPlaySoundA( LPCSTR pszSound, UINT fuSound);
 370	BOOL sndPlaySoundW( LPCWSTR pszSound, UINT fuSound);
 371	
 372	version(UNICODE) {
 373		alias sndPlaySoundW sndPlaySound;
 374	}
 375	else {
 376		alias sndPlaySoundA sndPlaySound;
 377	}
 378	
 379	/*
 380	 *  flag values for fuSound and fdwSound arguments on [snd]PlaySound
 381	 */
 382	const auto SND_SYNC             = 0x0000  ; /* play synchronously (default) */
 383	const auto SND_ASYNC            = 0x0001  ; /* play asynchronously */
 384	const auto SND_NODEFAULT        = 0x0002  ; /* silence (!default) if sound not found */
 385	const auto SND_MEMORY           = 0x0004  ; /* pszSound points to a memory file */
 386	const auto SND_LOOP             = 0x0008  ; /* loop the sound until next sndPlaySound */
 387	const auto SND_NOSTOP           = 0x0010  ; /* don't stop any currently playing sound */
 388	
 389	const auto SND_NOWAIT       = 0x00002000L ; /* don't wait if the driver is busy */
 390	const auto SND_ALIAS        = 0x00010000L ; /* name is a registry alias */
 391	const auto SND_ALIAS_ID     = 0x00110000L ; /* alias is a predefined ID */
 392	const auto SND_FILENAME     = 0x00020000L ; /* name is file name */
 393	const auto SND_RESOURCE     = 0x00040004L ; /* name is resource name or atom */
 394	
 395	const auto SND_PURGE            = 0x0040  ; /* purge non-static events for task */
 396	const auto SND_APPLICATION      = 0x0080  ; /* look for application specific association */
 397	
 398	const auto SND_SENTRY       = 0x00080000L ; /* Generate a SoundSentry event with this sound */
 399	const auto SND_SYSTEM       = 0x00200000L ; /* Treat this as a system sound */
 400	
 401	const auto SND_ALIAS_START  = 0           ; /* alias base */
 402	
 403	template sndAlias(char ch0, char ch1) {
 404		const DWORD sndAlias = (SND_ALIAS_START + cast(DWORD)cast(BYTE)(ch0) | (cast(DWORD)cast(BYTE)(ch1) << 8));
 405	}
 406	
 407	const auto SND_ALIAS_SYSTEMASTERISK         = sndAlias!('S', '*');
 408	const auto SND_ALIAS_SYSTEMQUESTION         = sndAlias!('S', '?');
 409	const auto SND_ALIAS_SYSTEMHAND             = sndAlias!('S', 'H');
 410	const auto SND_ALIAS_SYSTEMEXIT             = sndAlias!('S', 'E');
 411	const auto SND_ALIAS_SYSTEMSTART            = sndAlias!('S', 'S');
 412	const auto SND_ALIAS_SYSTEMWELCOME          = sndAlias!('S', 'W');
 413	const auto SND_ALIAS_SYSTEMEXCLAMATION      = sndAlias!('S', '!');
 414	const auto SND_ALIAS_SYSTEMDEFAULT          = sndAlias!('S', 'D');
 415	
 416	BOOL PlaySoundA( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
 417	BOOL PlaySoundW( LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
 418
 419	version(UNICODE) {
 420		alias PlaySoundW PlaySound;
 421	}
 422	else {
 423		alias PlaySoundA PlaySound;
 424	}
 425}
 426
 427/****************************************************************************
 428
 429                        Waveform audio support
 430
 431****************************************************************************/
 432
 433version(MMNOWAVE) {
 434}
 435else {
 436	/* waveform audio error return values */
 437	const auto WAVERR_BADFORMAT       = (WAVERR_BASE + 0)    ; /* unsupported wave format */
 438	const auto WAVERR_STILLPLAYING    = (WAVERR_BASE + 1)    ; /* still something playing */
 439	const auto WAVERR_UNPREPARED      = (WAVERR_BASE + 2)    ; /* header not prepared */
 440	const auto WAVERR_SYNC            = (WAVERR_BASE + 3)    ; /* device is synchronous */
 441	const auto WAVERR_LASTERROR       = (WAVERR_BASE + 3)    ; /* last error in range */
 442	
 443	/* waveform audio data types */
 444	alias HANDLE HWAVE;
 445	alias HANDLE HWAVEIN;
 446	alias HANDLE HWAVEOUT;
 447	
 448	alias HWAVEIN *LPHWAVEIN;
 449	alias HWAVEOUT *LPHWAVEOUT;
 450	
 451	alias DRVCALLBACK WAVECALLBACK;
 452	alias WAVECALLBACK *LPWAVECALLBACK;
 453	
 454	/* wave callback messages */
 455	const auto WOM_OPEN         = MM_WOM_OPEN;
 456	const auto WOM_CLOSE        = MM_WOM_CLOSE;
 457	const auto WOM_DONE         = MM_WOM_DONE;
 458	const auto WIM_OPEN         = MM_WIM_OPEN;
 459	const auto WIM_CLOSE        = MM_WIM_CLOSE;
 460	const auto WIM_DATA         = MM_WIM_DATA;
 461	
 462	/* device ID for wave device mapper */
 463	const auto WAVE_MAPPER      = (cast(UINT)-1);
 464	
 465	/* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
 466	const auto   WAVE_FORMAT_QUERY         = 0x0001;
 467	const auto   WAVE_ALLOWSYNC            = 0x0002;
 468
 469	const auto   WAVE_MAPPED               = 0x0004;
 470	const auto   WAVE_FORMAT_DIRECT        = 0x0008;
 471	const auto   WAVE_FORMAT_DIRECT_QUERY  = (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT);
 472	
 473	/* wave data block header */
 474	align(2) struct WAVEHDR {
 475	    ubyte*      lpData;                 /* pointer to locked data buffer */
 476	    DWORD       dwBufferLength;         /* length of data buffer */
 477	    DWORD       dwBytesRecorded;        /* used for input only */
 478	    DWORD_PTR   dwUser;                 /* for client's use */
 479	    DWORD       dwFlags;                /* assorted flags (see defines) */
 480	    DWORD       dwLoops;                /* loop control counter */
 481	    WAVEHDR*    lpNext;                 /* reserved for driver */
 482	    DWORD_PTR   reserved;               /* reserved for driver */
 483	}
 484	
 485	alias WAVEHDR* PWAVEHDR;
 486	alias WAVEHDR* NPWAVEHDR;
 487	alias WAVEHDR* LPWAVEHDR;
 488	
 489	/* flags for dwFlags field of WAVEHDR */
 490	const auto WHDR_DONE        = 0x00000001  ; /* done bit */
 491	const auto WHDR_PREPARED    = 0x00000002  ; /* set if this header has been prepared */
 492	const auto WHDR_BEGINLOOP   = 0x00000004  ; /* loop start block */
 493	const auto WHDR_ENDLOOP     = 0x00000008  ; /* loop end block */
 494	const auto WHDR_INQUEUE     = 0x00000010  ; /* reserved for driver */
 495	
 496	/* waveform output device capabilities align(2) structure */
 497	align(2) struct WAVEOUTCAPSA {
 498	    WORD    wMid;                  /* manufacturer ID */
 499	    WORD    wPid;                  /* product ID */
 500	    MMVERSION vDriverVersion;      /* version of the driver */
 501	    CHAR[MAXPNAMELEN] szPname;     /* product name (NULL terminated string) */
 502	    DWORD   dwFormats;             /* formats supported */
 503	    WORD    wChannels;             /* number of sources supported */
 504	    WORD    wReserved1;            /* packing */
 505	    DWORD   dwSupport;             /* functionality supported by driver */
 506	}
 507	
 508	alias WAVEOUTCAPSA* PWAVEOUTCAPSA;
 509	alias WAVEOUTCAPSA* NPWAVEOUTCAPSA;
 510	alias WAVEOUTCAPSA* LPWAVEOUTCAPSA;
 511	align(2) struct WAVEOUTCAPSW {
 512	    WORD    wMid;                  /* manufacturer ID */
 513	    WORD    wPid;                  /* product ID */
 514	    MMVERSION vDriverVersion;      /* version of the driver */
 515	    WCHAR[MAXPNAMELEN]   szPname;  /* product name (NULL terminated string) */
 516	    DWORD   dwFormats;             /* formats supported */
 517	    WORD    wChannels;             /* number of sources supported */
 518	    WORD    wReserved1;            /* packing */
 519	    DWORD   dwSupport;             /* functionality supported by driver */
 520	}
 521	
 522	alias WAVEOUTCAPSW* PWAVEOUTCAPSW;
 523	alias WAVEOUTCAPSW* NPWAVEOUTCAPSW;
 524	alias WAVEOUTCAPSW* LPWAVEOUTCAPSW;
 525	
 526	version(UNICODE) {
 527		alias WAVEOUTCAPSW WAVEOUTCAPS;
 528		alias PWAVEOUTCAPSW PWAVEOUTCAPS;
 529		alias NPWAVEOUTCAPSW NPWAVEOUTCAPS;
 530		alias LPWAVEOUTCAPSW LPWAVEOUTCAPS;
 531	}
 532	else {
 533		alias WAVEOUTCAPSA WAVEOUTCAPS;
 534		alias PWAVEOUTCAPSA PWAVEOUTCAPS;
 535		alias NPWAVEOUTCAPSA NPWAVEOUTCAPS;
 536		alias LPWAVEOUTCAPSA LPWAVEOUTCAPS;
 537	}
 538	align(2) struct WAVEOUTCAPS2A {
 539	    WORD    wMid;                  /* manufacturer ID */
 540	    WORD    wPid;                  /* product ID */
 541	    MMVERSION vDriverVersion;      /* version of the driver */
 542	    CHAR[MAXPNAMELEN]    szPname;  /* product name (NULL terminated string) */
 543	    DWORD   dwFormats;             /* formats supported */
 544	    WORD    wChannels;             /* number of sources supported */
 545	    WORD    wReserved1;            /* packing */
 546	    DWORD   dwSupport;             /* functionality supported by driver */
 547	    GUID    ManufacturerGuid;      /* for extensible MID mapping */
 548	    GUID    ProductGuid;           /* for extensible PID mapping */
 549	    GUID    NameGuid;              /* for name lookup in registry */
 550	}
 551	
 552	alias WAVEOUTCAPS2A* PWAVEOUTCAPS2A;
 553	alias WAVEOUTCAPS2A* NPWAVEOUTCAPS2A;
 554	alias WAVEOUTCAPS2A* LPWAVEOUTCAPS2A;
 555	align(2) struct WAVEOUTCAPS2W {
 556	    WORD    wMid;                  /* manufacturer ID */
 557	    WORD    wPid;                  /* product ID */
 558	    MMVERSION vDriverVersion;      /* version of the driver */
 559	    WCHAR[MAXPNAMELEN]   szPname;  /* product name (NULL terminated string) */
 560	    DWORD   dwFormats;             /* formats supported */
 561	    WORD    wChannels;             /* number of sources supported */
 562	    WORD    wReserved1;            /* packing */
 563	    DWORD   dwSupport;             /* functionality supported by driver */
 564	    GUID    ManufacturerGuid;      /* for extensible MID mapping */
 565	    GUID    ProductGuid;           /* for extensible PID mapping */
 566	    GUID    NameGuid;              /* for name lookup in registry */
 567	}
 568	
 569	alias WAVEOUTCAPS2W* PWAVEOUTCAPS2W;
 570	alias WAVEOUTCAPS2W* NPWAVEOUTCAPS2W;
 571	alias WAVEOUTCAPS2W* LPWAVEOUTCAPS2W;
 572	
 573	version(UNICODE) {
 574		alias WAVEOUTCAPS2W WAVEOUTCAPS2;
 575		alias PWAVEOUTCAPS2W PWAVEOUTCAPS2;
 576		alias NPWAVEOUTCAPS2W NPWAVEOUTCAPS2;
 577		alias LPWAVEOUTCAPS2W LPWAVEOUTCAPS2;
 578	}
 579	else {
 580		alias WAVEOUTCAPS2A WAVEOUTCAPS2;
 581		alias PWAVEOUTCAPS2A PWAVEOUTCAPS2;
 582		alias NPWAVEOUTCAPS2A NPWAVEOUTCAPS2;
 583		alias LPWAVEOUTCAPS2A LPWAVEOUTCAPS2;
 584	}
 585	
 586	/* flags for dwSupport field of WAVEOUTCAPS */
 587	const auto WAVECAPS_PITCH           = 0x0001   ; /* supports pitch control */
 588	const auto WAVECAPS_PLAYBACKRATE    = 0x0002   ; /* supports playback rate control */
 589	const auto WAVECAPS_VOLUME          = 0x0004   ; /* supports volume control */
 590	const auto WAVECAPS_LRVOLUME        = 0x0008   ; /* separate left-right volume control */
 591	const auto WAVECAPS_SYNC            = 0x0010;
 592	const auto WAVECAPS_SAMPLEACCURATE  = 0x0020;
 593	
 594	/* waveform input device capabilities align(2) structure */
 595	align(2) struct WAVEINCAPSA {
 596	    WORD    wMid;                    /* manufacturer ID */
 597	    WORD    wPid;                    /* product ID */
 598	    MMVERSION vDriverVersion;        /* version of the driver */
 599	    CHAR[MAXPNAMELEN]    szPname;    /* product name (NULL terminated string) */
 600	    DWORD   dwFormats;               /* formats supported */
 601	    WORD    wChannels;               /* number of channels supported */
 602	    WORD    wReserved1;              /* align(2) structure packing */
 603	}
 604	
 605	alias WAVEINCAPSA* PWAVEINCAPSA;
 606	alias WAVEINCAPSA* NPWAVEINCAPSA;
 607	alias WAVEINCAPSA* LPWAVEINCAPSA;
 608	align(2) struct WAVEINCAPSW {
 609	    WORD    wMid;                    /* manufacturer ID */
 610	    WORD    wPid;                    /* product ID */
 611	    MMVERSION vDriverVersion;        /* version of the driver */
 612	    WCHAR[MAXPNAMELEN]   szPname;    /* product name (NULL terminated string) */
 613	    DWORD   dwFormats;               /* formats supported */
 614	    WORD    wChannels;               /* number of channels supported */
 615	    WORD    wReserved1;              /* align(2) structure packing */
 616	}
 617	
 618	alias WAVEINCAPSW* PWAVEINCAPSW;
 619	alias WAVEINCAPSW* NPWAVEINCAPSW;
 620	alias WAVEINCAPSW* LPWAVEINCAPSW;
 621	
 622	version(UNICODE) {
 623		alias WAVEINCAPSW WAVEINCAPS;
 624		alias PWAVEINCAPSW PWAVEINCAPS;
 625		alias NPWAVEINCAPSW NPWAVEINCAPS;
 626		alias LPWAVEINCAPSW LPWAVEINCAPS;
 627	}
 628	else {
 629		alias WAVEINCAPSA WAVEINCAPS;
 630		alias PWAVEINCAPSA PWAVEINCAPS;
 631		alias NPWAVEINCAPSA NPWAVEINCAPS;
 632		alias LPWAVEINCAPSA LPWAVEINCAPS;
 633	}
 634	
 635	align(2) struct WAVEINCAPS2A {
 636	    WORD    wMid;                    /* manufacturer ID */
 637	    WORD    wPid;                    /* product ID */
 638	    MMVERSION vDriverVersion;        /* version of the driver */
 639	    CHAR[MAXPNAMELEN]    szPname;    /* product name (NULL terminated string) */
 640	    DWORD   dwFormats;               /* formats supported */
 641	    WORD    wChannels;               /* number of channels supported */
 642	    WORD    wReserved1;              /* align(2) structure packing */
 643	    GUID    ManufacturerGuid;        /* for extensible MID mapping */
 644	    GUID    ProductGuid;             /* for extensible PID mapping */
 645	    GUID    NameGuid;                /* for name lookup in registry */
 646	}
 647	
 648	alias WAVEINCAPS2A* PWAVEINCAPS2A;
 649	alias WAVEINCAPS2A* NPWAVEINCAPS2A;
 650	alias WAVEINCAPS2A* LPWAVEINCAPS2A;
 651	align(2) struct WAVEINCAPS2W {
 652	    WORD    wMid;                    /* manufacturer ID */
 653	    WORD    wPid;                    /* product ID */
 654	    MMVERSION vDriverVersion;        /* version of the driver */
 655	    WCHAR[MAXPNAMELEN]   szPname;    /* product name (NULL terminated string) */
 656	    DWORD   dwFormats;               /* formats supported */
 657	    WORD    wChannels;               /* number of channels supported */
 658	    WORD    wReserved1;              /* align(2) structure packing */
 659	    GUID    ManufacturerGuid;        /* for extensible MID mapping */
 660	    GUID    ProductGuid;             /* for extensible PID mapping */
 661	    GUID    NameGuid;                /* for name lookup in registry */
 662	}
 663	
 664	alias WAVEINCAPS2W* PWAVEINCAPS2W;
 665	alias WAVEINCAPS2W* NPWAVEINCAPS2W;
 666	alias WAVEINCAPS2W* LPWAVEINCAPS2W;
 667	
 668	version(UNICODE) {
 669		alias WAVEINCAPS2W WAVEINCAPS2;
 670		alias PWAVEINCAPS2W PWAVEINCAPS2;
 671		alias NPWAVEINCAPS2W NPWAVEINCAPS2;
 672		alias LPWAVEINCAPS2W LPWAVEINCAPS2;
 673	}
 674	else {
 675		alias WAVEINCAPS2A WAVEINCAPS2;
 676		alias PWAVEINCAPS2A PWAVEINCAPS2;
 677		alias NPWAVEINCAPS2A NPWAVEINCAPS2;
 678		alias LPWAVEINCAPS2A LPWAVEINCAPS2;
 679	}
 680	
 681	/* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
 682	const auto WAVE_INVALIDFORMAT      = 0x00000000       ; /* invalid format */
 683	const auto WAVE_FORMAT_1M08        = 0x00000001       ; /* 11.025 kHz, Mono,   8-bit  */
 684	const auto WAVE_FORMAT_1S08        = 0x00000002       ; /* 11.025 kHz, Stereo, 8-bit  */
 685	const auto WAVE_FORMAT_1M16        = 0x00000004       ; /* 11.025 kHz, Mono,   16-bit */
 686	const auto WAVE_FORMAT_1S16        = 0x00000008       ; /* 11.025 kHz, Stereo, 16-bit */
 687	const auto WAVE_FORMAT_2M08        = 0x00000010       ; /* 22.05  kHz, Mono,   8-bit  */
 688	const auto WAVE_FORMAT_2S08        = 0x00000020       ; /* 22.05  kHz, Stereo, 8-bit  */
 689	const auto WAVE_FORMAT_2M16        = 0x00000040       ; /* 22.05  kHz, Mono,   16-bit */
 690	const auto WAVE_FORMAT_2S16        = 0x00000080       ; /* 22.05  kHz, Stereo, 16-bit */
 691	const auto WAVE_FORMAT_4M08        = 0x00000100       ; /* 44.1   kHz, Mono,   8-bit  */
 692	const auto WAVE_FORMAT_4S08        = 0x00000200       ; /* 44.1   kHz, Stereo, 8-bit  */
 693	const auto WAVE_FORMAT_4M16        = 0x00000400       ; /* 44.1   kHz, Mono,   16-bit */
 694	const auto WAVE_FORMAT_4S16        = 0x00000800       ; /* 44.1   kHz, Stereo, 16-bit */
 695	
 696	const auto WAVE_FORMAT_44M08       = 0x00000100       ; /* 44.1   kHz, Mono,   8-bit  */
 697	const auto WAVE_FORMAT_44S08       = 0x00000200       ; /* 44.1   kHz, Stereo, 8-bit  */
 698	const auto WAVE_FORMAT_44M16       = 0x00000400       ; /* 44.1   kHz, Mono,   16-bit */
 699	const auto WAVE_FORMAT_44S16       = 0x00000800       ; /* 44.1   kHz, Stereo, 16-bit */
 700	const auto WAVE_FORMAT_48M08       = 0x00001000       ; /* 48     kHz, Mono,   8-bit  */
 701	const auto WAVE_FORMAT_48S08       = 0x00002000       ; /* 48     kHz, Stereo, 8-bit  */
 702	const auto WAVE_FORMAT_48M16       = 0x00004000       ; /* 48     kHz, Mono,   16-bit */
 703	const auto WAVE_FORMAT_48S16       = 0x00008000       ; /* 48     kHz, Stereo, 16-bit */
 704	const auto WAVE_FORMAT_96M08       = 0x00010000       ; /* 96     kHz, Mono,   8-bit  */
 705	const auto WAVE_FORMAT_96S08       = 0x00020000       ; /* 96     kHz, Stereo, 8-bit  */
 706	const auto WAVE_FORMAT_96M16       = 0x00040000       ; /* 96     kHz, Mono,   16-bit */
 707	const auto WAVE_FORMAT_96S16       = 0x00080000       ; /* 96     kHz, Stereo, 16-bit */
 708	
 709	/* OLD general waveform format align(2) structure (information common to all formats) */
 710	align(2) struct WAVEFORMAT {
 711	    WORD    wFormatTag;        /* format type */
 712	    WORD    nChannels;         /* number of channels (i.e. mono, stereo, etc.) */
 713	    DWORD   nSamplesPerSec;    /* sample rate */
 714	    DWORD   nAvgBytesPerSec;   /* for buffer estimation */
 715	    WORD    nBlockAlign;       /* block size of data */
 716	}
 717	
 718	alias WAVEFORMAT* PWAVEFORMAT;
 719	alias WAVEFORMAT *NPWAVEFORMAT;
 720	alias WAVEFORMAT* LPWAVEFORMAT;
 721	
 722	/* flags for wFormatTag field of WAVEFORMAT */
 723	const auto WAVE_FORMAT_PCM      = 1;
 724	
 725	/* specific waveform format align(2) structure for PCM data */
 726	align(2) struct PCMWAVEFORMAT {
 727	    WAVEFORMAT  wf;
 728	    WORD        wBitsPerSample;
 729	}
 730
 731	alias PCMWAVEFORMAT* PPCMWAVEFORMAT;
 732	alias PCMWAVEFORMAT *NPPCMWAVEFORMAT;
 733	alias PCMWAVEFORMAT* LPPCMWAVEFORMAT;
 734	
 735	/*
 736	 *  extended waveform format align(2) structure used for all non-PCM formats. this
 737	 *  align(2) structure is common to all non-PCM formats.
 738	 */
 739	align(2) struct WAVEFORMATEX {
 740	    WORD        wFormatTag;         /* format type */
 741	    WORD        nChannels;          /* number of channels (i.e. mono, stereo...) */
 742	    DWORD       nSamplesPerSec;     /* sample rate */
 743	    DWORD       nAvgBytesPerSec;    /* for buffer estimation */
 744	    WORD        nBlockAlign;        /* block size of data */
 745	    WORD        wBitsPerSample;     /* number of bits per sample of mono data */
 746	    WORD        cbSize;             /* the count in bytes of the size of */
 747	                                    /* extra information (after cbSize) */
 748	}
 749	
 750	alias WAVEFORMATEX* PWAVEFORMATEX;
 751	alias WAVEFORMATEX *NPWAVEFORMATEX;
 752	alias WAVEFORMATEX* LPWAVEFORMATEX;
 753	
 754	alias WAVEFORMATEX *LPCWAVEFORMATEX;
 755	
 756	/* waveform audio function prototypes */
 757	UINT waveOutGetNumDevs();
 758	
 759	MMRESULT waveOutGetDevCapsA( UINT_PTR uDeviceID, LPWAVEOUTCAPSA pwoc, UINT cbwoc);
 760	MMRESULT waveOutGetDevCapsW( UINT_PTR uDeviceID, LPWAVEOUTCAPSW pwoc, UINT cbwoc);
 761	
 762	version(UNICODE) {
 763		alias waveOutGetDevCapsW waveOutGetDevCaps;
 764	}
 765	else {
 766		alias waveOutGetDevCapsA waveOutGetDevCaps;
 767	}
 768	
 769	MMRESULT waveOutGetVolume( HWAVEOUT hwo, LPDWORD pdwVolume);
 770	MMRESULT waveOutSetVolume( HWAVEOUT hwo, DWORD dwVolume);
 771
 772	MMRESULT waveOutGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText);
 773	MMRESULT waveOutGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
 774	
 775	version(UNICODE) {
 776		alias waveOutGetErrorTextW waveOutGetErrorText;
 777	}
 778	else {
 779		alias waveOutGetErrorTextA waveOutGetErrorText;
 780	}
 781	
 782	MMRESULT waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID,
 783	    LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
 784	
 785	MMRESULT waveOutClose( HWAVEOUT hwo);
 786	MMRESULT waveOutPrepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh,  UINT cbwh);
 787	MMRESULT waveOutUnprepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
 788	MMRESULT waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
 789	MMRESULT waveOutPause( HWAVEOUT hwo);
 790	MMRESULT waveOutRestart( HWAVEOUT hwo);
 791	MMRESULT waveOutReset( HWAVEOUT hwo);
 792	MMRESULT waveOutBreakLoop( HWAVEOUT hwo);
 793	MMRESULT waveOutGetPosition( HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
 794	MMRESULT waveOutGetPitch( HWAVEOUT hwo, LPDWORD pdwPitch);
 795	MMRESULT waveOutSetPitch( HWAVEOUT hwo, DWORD dwPitch);
 796	MMRESULT waveOutGetPlaybackRate( HWAVEOUT hwo, LPDWORD pdwRate);
 797	MMRESULT waveOutSetPlaybackRate( HWAVEOUT hwo, DWORD dwRate);
 798	MMRESULT waveOutGetID( HWAVEOUT hwo, LPUINT puDeviceID);
 799	
 800	MMRESULT waveOutMessage( HWAVEOUT hwo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
 801	
 802	UINT waveInGetNumDevs();
 803	
 804	MMRESULT waveInGetDevCapsA( UINT_PTR uDeviceID, LPWAVEINCAPSA pwic, UINT cbwic);
 805	MMRESULT waveInGetDevCapsW( UINT_PTR uDeviceID, LPWAVEINCAPSW pwic, UINT cbwic);
 806	
 807	version(UNICODE) {
 808		alias waveInGetDevCapsW waveInGetDevCaps;
 809	}
 810	else {
 811		alias waveInGetDevCapsA waveInGetDevCaps;
 812	}
 813	
 814	MMRESULT waveInGetErrorTextA(MMRESULT mmrError, LPSTR pszText, UINT cchText);
 815	MMRESULT waveInGetErrorTextW(MMRESULT mmrError, LPWSTR pszText, UINT cchText);
 816	
 817	version(UNICODE) {
 818		alias waveInGetErrorTextW waveInGetErrorText;
 819	}
 820	else {
 821		alias waveInGetErrorTextA waveInGetErrorText;
 822	}
 823	
 824	MMRESULT waveInOpen( LPHWAVEIN phwi, UINT uDeviceID,
 825	    LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
 826	
 827	MMRESULT waveInClose( HWAVEIN hwi);
 828	MMRESULT waveInPrepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
 829	MMRESULT waveInUnprepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
 830	MMRESULT waveInAddBuffer( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
 831	MMRESULT waveInStart( HWAVEIN hwi);
 832	MMRESULT waveInStop( HWAVEIN hwi);
 833	MMRESULT waveInReset( HWAVEIN hwi);
 834	MMRESULT waveInGetPosition( HWAVEIN hwi, LPMMTIME pmmt, UINT cbmmt);
 835	MMRESULT waveInGetID( HWAVEIN hwi, LPUINT puDeviceID);
 836
 837	MMRESULT waveInMessage( HWAVEIN hwi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
 838
 839}
 840
 841/****************************************************************************
 842
 843                            MIDI audio support
 844
 845****************************************************************************/
 846version(MMNOMIDI) {
 847}
 848else {
 849	/* MIDI error return values */
 850	const auto MIDIERR_UNPREPARED     = (MIDIERR_BASE + 0)   ; /* header not prepared */
 851	const auto MIDIERR_STILLPLAYING   = (MIDIERR_BASE + 1)   ; /* still something playing */
 852	const auto MIDIERR_NOMAP          = (MIDIERR_BASE + 2)   ; /* no configured instruments */
 853	const auto MIDIERR_NOTREADY       = (MIDIERR_BASE + 3)   ; /* hardware is still busy */
 854	const auto MIDIERR_NODEVICE       = (MIDIERR_BASE + 4)   ; /* port no longer connected */
 855	const auto MIDIERR_INVALIDSETUP   = (MIDIERR_BASE + 5)   ; /* invalid MIF */
 856	const auto MIDIERR_BADOPENMODE    = (MIDIERR_BASE + 6)   ; /* operation unsupported w/ open mode */
 857	const auto MIDIERR_DONT_CONTINUE  = (MIDIERR_BASE + 7)   ; /* thru device 'eating' a message */
 858	const auto MIDIERR_LASTERROR      = (MIDIERR_BASE + 7)   ; /* last error in range */
 859	
 860	/* MIDI audio data types */
 861	alias HANDLE HMIDI;
 862	alias HANDLE HMIDIIN;
 863	alias HANDLE HMIDIOUT;
 864	alias HANDLE HMIDISTRM;
 865	
 866	alias HMIDI *LPHMIDI;
 867	alias HMIDIIN *LPHMIDIIN;
 868	alias HMIDIOUT *LPHMIDIOUT;
 869	alias HMIDISTRM *LPHMIDISTRM;
 870	
 871	alias DRVCALLBACK MIDICALLBACK;
 872	alias MIDICALLBACK *LPMIDICALLBACK;
 873	
 874	const auto MIDIPATCHSIZE    = 128;
 875	
 876	alias WORD[MIDIPATCHSIZE] PATCHARRAY;
 877	alias WORD *LPPATCHARRAY;
 878	alias WORD[MIDIPATCHSIZE] KEYARRAY;
 879	alias WORD *LPKEYARRAY;
 880	
 881	/* MIDI callback messages */
 882	const auto MIM_OPEN         = MM_MIM_OPEN;
 883	const auto MIM_CLOSE        = MM_MIM_CLOSE;
 884	const auto MIM_DATA         = MM_MIM_DATA;
 885	const auto MIM_LONGDATA     = MM_MIM_LONGDATA;
 886	const auto MIM_ERROR        = MM_MIM_ERROR;
 887	const auto MIM_LONGERROR    = MM_MIM_LONGERROR;
 888	const auto MOM_OPEN         = MM_MOM_OPEN;
 889	const auto MOM_CLOSE        = MM_MOM_CLOSE;
 890	const auto MOM_DONE         = MM_MOM_DONE;
 891	
 892	const auto MIM_MOREDATA       = MM_MIM_MOREDATA;
 893	const auto MOM_POSITIONCB     = MM_MOM_POSITIONCB;
 894	
 895	/* device ID for MIDI mapper */
 896	const auto MIDIMAPPER      = (cast(UINT)-1);
 897	const auto MIDI_MAPPER     = (cast(UINT)-1);
 898	
 899	/* flags for dwFlags parm of midiInOpen() */
 900	const auto MIDI_IO_STATUS       = 0x00000020L;
 901	
 902	/* flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() */
 903	const auto MIDI_CACHE_ALL       = 1;
 904	const auto MIDI_CACHE_BESTFIT   = 2;
 905	const auto MIDI_CACHE_QUERY     = 3;
 906	const auto MIDI_UNCACHE         = 4;
 907	
 908	/* MIDI output device capabilities align(2) structure */
 909	align(2) struct MIDIOUTCAPSA {
 910	    WORD    wMid;                  /* manufacturer ID */
 911	    WORD    wPid;                  /* product ID */
 912	    MMVERSION vDriverVersion;      /* version of the driver */
 913	    CHAR[MAXPNAMELEN]    szPname;  /* product name (NULL terminated string) */
 914	    WORD    wTechnology;           /* type of device */
 915	    WORD    wVoices;               /* # of voices (internal synth only) */
 916	    WORD    wNotes;                /* max # of notes (internal synth only) */
 917	    WORD    wChannelMask;          /* channels used (internal synth only) */
 918	    DWORD   dwSupport;             /* functionality supported by driver */
 919	}
 920	
 921	alias MIDIOUTCAPSA* PMIDIOUTCAPSA;
 922	alias MIDIOUTCAPSA* NPMIDIOUTCAPSA;
 923	alias MIDIOUTCAPSA* LPMIDIOUTCAPSA;
 924	
 925	align(2) struct MIDIOUTCAPSW {
 926	    WORD    wMid;                  /* manufacturer ID */
 927	    WORD    wPid;                  /* product ID */
 928	    MMVERSION vDriverVersion;      /* version of the driver */
 929	    WCHAR[MAXPNAMELEN]   szPname;  /* product name (NULL terminated string) */
 930	    WORD    wTechnology;           /* type of device */
 931	    WORD    wVoices;               /* # of voices (internal synth only) */
 932	    WORD    wNotes;                /* max # of notes (internal synth only) */
 933	    WORD    wChannelMask;          /* channels used (internal synth only) */
 934	    DWORD   dwSupport;             /* functionality supported by driver */
 935	}
 936	
 937	alias MIDIOUTCAPSW* PMIDIOUTCAPSW;
 938	alias MIDIOUTCAPSW* NPMIDIOUTCAPSW;
 939	alias MIDIOUTCAPSW* LPMIDIOUTCAPSW;
 940	
 941	version(UNICODE) {
 942		alias MIDIOUTCAPSW MIDIOUTCAPS;
 943		alias PMIDIOUTCAPSW PMIDIOUTCAPS;
 944		alias NPMIDIOUTCAPSW NPMIDIOUTCAPS;
 945		alias LPMIDIOUTCAPSW LPMIDIOUTCAPS;
 946	}
 947	else {
 948		alias MIDIOUTCAPSA MIDIOUTCAPS;
 949		alias PMIDIOUTCAPSA PMIDIOUTCAPS;
 950		alias NPMIDIOUTCAPSA NPMIDIOUTCAPS;
 951		alias LPMIDIOUTCAPSA LPMIDIOUTCAPS;
 952	}
 953	
 954	align(2) struct MIDIOUTCAPS2A {
 955	    WORD    wMid;                  /* manufacturer ID */
 956	    WORD    wPid;                  /* product ID */
 957	    MMVERSION vDriverVersion;      /* version of the driver */
 958	    CHAR[MAXPNAMELEN]    szPname;  /* product name (NULL terminated string) */
 959	    WORD    wTechnology;           /* type of device */
 960	    WORD    wVoices;               /* # of voices (internal synth only) */
 961	    WORD    wNotes;                /* max # of notes (internal synth only) */
 962	    WORD    wChannelMask;          /* channels used (internal synth only) */
 963	    DWORD   dwSupport;             /* functionality supported by driver */
 964	    GUID    ManufacturerGuid;      /* for extensible MID mapping */
 965	    GUID    ProductGuid;           /* for extensible PID mapping */
 966	    GUID    NameGuid;              /* for name lookup in registry */
 967	}
 968	
 969	alias MIDIOUTCAPS2A* PMIDIOUTCAPS2A;
 970	alias MIDIOUTCAPS2A* NPMIDIOUTCAPS2A;
 971	alias MIDIOUTCAPS2A* LPMIDIOUTCAPS2A;
 972	
 973	align(2) struct MIDIOUTCAPS2W {
 974	    WORD    wMid;                  /* manufacturer ID */
 975	    WORD    wPid;                  /* product ID */
 976	    MMVERSION vDriverVersion;      /* version of the driver */
 977	    WCHAR[MAXPNAMELEN]   szPname;  /* product name (NULL terminated string) */
 978	    WORD    wTechnology;           /* type of device */
 979	    WORD    wVoices;               /* # of voices (internal synth only) */
 980	    WORD    wNotes;                /* max # of notes (internal synth only) */
 981	    WORD    wChannelMask;          /* channels used (internal synth only) */
 982	    DWORD   dwSupport;             /* functionality supported by driver */
 983	    GUID    ManufacturerGuid;      /* for extensible MID mapping */
 984	    GUID    ProductGuid;           /* for extensible PID mapping */
 985	    GUID    NameGuid;              /* for name lookup in registry */
 986	}
 987	
 988	alias MIDIOUTCAPS2W* PMIDIOUTCAPS2W;
 989	alias MIDIOUTCAPS2W* NPMIDIOUTCAPS2W;
 990	alias MIDIOUTCAPS2W* LPMIDIOUTCAPS2W;
 991	
 992	version(UNICODE) {
 993		alias MIDIOUTCAPS2W MIDIOUTCAPS2;
 994		alias PMIDIOUTCAPS2W PMIDIOUTCAPS2;
 995		alias NPMIDIOUTCAPS2W NPMIDIOUTCAPS2;
 996		alias LPMIDIOUTCAPS2W LPMIDIOUTCAPS2;
 997	}
 998	else {
 999		alias MIDIOUTCAPS2A MIDIOUTCAPS2;
1000		alias PMIDIOUTCAPS2A PMIDIOUTCAPS2;
1001		alias NPMIDIOUTCAPS2A NPMIDIOUTCAPS2;
1002		alias LPMIDIOUTCAPS2A LPMIDIOUTCAPS2;
1003	}
1004	
1005	/* flags for wTechnology field of MIDIOUTCAPS align(2) structure */
1006	const auto MOD_MIDIPORT     = 1  ; /* output port */
1007	const auto MOD_SYNTH        = 2  ; /* generic internal synth */
1008	const auto MOD_SQSYNTH      = 3  ; /* square wave internal synth */
1009	const auto MOD_FMSYNTH      = 4  ; /* FM internal synth */
1010	const auto MOD_MAPPER       = 5  ; /* MIDI mapper */
1011	const auto MOD_WAVETABLE    = 6  ; /* hardware wavetable synth */
1012	const auto MOD_SWSYNTH      = 7  ; /* software synth */
1013	
1014	/* flags for dwSupport field of MIDIOUTCAPS align(2) structure */
1015	const auto MIDICAPS_VOLUME           = 0x0001  ; /* supports volume control */
1016	const auto MIDICAPS_LRVOLUME         = 0x0002  ; /* separate left-right volume control */
1017	const auto MIDICAPS_CACHE            = 0x0004;
1018	
1019	const auto MIDICAPS_STREAM           = 0x0008  ; /* driver supports midiStreamOut directly */
1020	
1021	/* MIDI input device capabilities align(2) structure */
1022	align(2) struct MIDIINCAPSA {
1023	    WORD        wMid;                   /* manufacturer ID */
1024	    WORD        wPid;                   /* product ID */
1025	    MMVERSION   vDriverVersion;         /* version of the driver */
1026	    CHAR        szPname[MAXPNAMELEN];   /* product name (NULL terminated string) */
1027	    DWORD   dwSupport;             /* functionality supported by driver */
1028	}
1029	
1030	alias MIDIINCAPSA* PMIDIINCAPSA;
1031	alias MIDIINCAPSA* NPMIDIINCAPSA;
1032	alias MIDIINCAPSA* LPMIDIINCAPSA;
1033	
1034	align(2) struct MIDIINCAPSW {
1035	    WORD        wMid;                   /* manufacturer ID */
1036	    WORD        wPid;                   /* product ID */
1037	    MMVERSION   vDriverVersion;         /* version of the driver */
1038	    WCHAR       szPname[MAXPNAMELEN];   /* product name (NULL terminated string) */
1039	    DWORD   dwSupport;             /* functionality supported by driver */
1040	}
1041	
1042	alias MIDIINCAPSW* PMIDIINCAPSW;
1043	alias MIDIINCAPSW* NPMIDIINCAPSW;
1044	alias MIDIINCAPSW* LPMIDIINCAPSW;
1045	
1046	version(UNICODE) {
1047		alias MIDIINCAPSW MIDIINCAPS;
1048		alias PMIDIINCAPSW PMIDIINCAPS;
1049		alias NPMIDIINCAPSW NPMIDIINCAPS;
1050		alias LPMIDIINCAPSW LPMIDIINCAPS;
1051	}
1052	else {
1053		alias MIDIINCAPSA MIDIINCAPS;
1054		alias PMIDIINCAPSA PMIDIINCAPS;
1055		alias NPMIDIINCAPSA NPMIDIINCAPS;
1056		alias LPMIDIINCAPSA LPMIDIINCAPS;
1057	}
1058	
1059	align(2) struct MIDIINCAPS2A {
1060	    WORD        wMid;                   /* manufacturer ID */
1061	    WORD        wPid;                   /* product ID */
1062	    MMVERSION   vDriverVersion;         /* version of the driver */
1063	    CHAR[MAXPNAMELEN]        szPname;   /* product name (NULL terminated string) */
1064	    DWORD       dwSupport;              /* functionality supported by driver */
1065	    GUID        ManufacturerGuid;       /* for extensible MID mapping */
1066	    GUID        ProductGuid;            /* for extensible PID mapping */
1067	    GUID        NameGuid;               /* for name lookup in registry */
1068	}
1069	
1070	alias MIDIINCAPS2A* PMIDIINCAPS2A;
1071	alias MIDIINCAPS2A* NPMIDIINCAPS2A;
1072	alias MIDIINCAPS2A* LPMIDIINCAPS2A;
1073	
1074	align(2) struct MIDIINCAPS2W {
1075	    WORD        wMid;                   /* manufacturer ID */
1076	    WORD        wPid;                   /* product ID */
1077	    MMVERSION   vDriverVersion;         /* version of the driver */
1078	    WCHAR[MAXPNAMELEN]       szPname;   /* product name (NULL terminated string) */
1079	    DWORD       dwSupport;              /* functionality supported by driver */
1080	    GUID        ManufacturerGuid;       /* for extensible MID mapping */
1081	    GUID        ProductGuid;            /* for extensible PID mapping */
1082	    GUID        NameGuid;               /* for name lookup in registry */
1083	}
1084	
1085	alias MIDIINCAPS2W* PMIDIINCAPS2W;
1086	alias MIDIINCAPS2W* NPMIDIINCAPS2W;
1087	alias MIDIINCAPS2W* LPMIDIINCAPS2W;
1088	
1089	version(UNICODE) {
1090		alias MIDIINCAPS2W MIDIINCAPS2;
1091		alias PMIDIINCAPS2W PMIDIINCAPS2;
1092		alias NPMIDIINCAPS2W NPMIDIINCAPS2;
1093		alias LPMIDIINCAPS2W LPMIDIINCAPS2;
1094	}
1095	else {
1096		alias MIDIINCAPS2A MIDIINCAPS2;
1097		alias PMIDIINCAPS2A PMIDIINCAPS2;
1098		alias NPMIDIINCAPS2A NPMIDIINCAPS2;
1099		alias LPMIDIINCAPS2A LPMIDIINCAPS2;
1100	}
1101	
1102	/* MIDI data block header */
1103	align(2) struct MIDIHDR {
1104	    LPSTR       lpData;               /* pointer to locked data block */
1105	    DWORD       dwBufferLength;       /* length of data in data block */
1106	    DWORD       dwBytesRecorded;      /* used for input only */
1107	    DWORD_PTR   dwUser;               /* for client's use */
1108	    DWORD       dwFlags;              /* assorted flags (see defines) */
1109	    MIDIHDR* lpNext;                  /* reserved for driver */
1110	    DWORD_PTR   reserved;             /* reserved for driver */
1111	    DWORD       dwOffset;             /* Callback offset into buffer */
1112	    DWORD_PTR[8]   dwReserved;        /* Reserved for MMSYSTEM */
1113	}
1114	
1115	alias MIDIHDR* PMIDIHDR;
1116	alias MIDIHDR *NPMIDIHDR;
1117	alias MIDIHDR* LPMIDIHDR;
1118	
1119	align(2) struct MIDIEVENT {
1120	    DWORD       dwDeltaTime;          /* Ticks since last event */
1121	    DWORD       dwStreamID;           /* Reserved; must be zero */
1122	    DWORD       dwEvent;              /* Event type and parameters */
1123	    DWORD[1]    dwParms;              /* Parameters if this is a long event */
1124	}
1125	
1126	align(2) struct MIDISTRMBUFFVER {
1127	    DWORD       dwVersion;                  /* Stream buffer format version */
1128	    DWORD       dwMid;                      /* Manufacturer ID as defined in MMREG.H */
1129	    DWORD       dwOEMVersion;               /* Manufacturer version for custom ext */
1130	}
1131	
1132	/* flags for dwFlags field of MIDIHDR align(2) structure */
1133	const auto MHDR_DONE        = 0x00000001       ; /* done bit */
1134	const auto MHDR_PREPARED    = 0x00000002       ; /* set if header prepared */
1135	const auto MHDR_INQUEUE     = 0x00000004       ; /* reserved for driver */
1136	const auto MHDR_ISSTRM      = 0x00000008       ; /* Buffer is stream buffer */
1137	
1138	/* */
1139	/* Type codes which go in the high byte of the event DWORD of a stream buffer */
1140	/* */
1141	/* Type codes 00-7F contain parameters within the low 24 bits */
1142	/* Type codes 80-FF contain a length of their parameter in the low 24 */
1143	/* bits, followed by their parameter data in the buffer. The event */
1144	/* DWORD contains the exact byte length; the parm data itself must be */
1145	/* padded to be an even multiple of 4 bytes long. */
1146	/* */
1147	
1148	const auto MEVT_F_SHORT         = 0x00000000L;
1149	const auto MEVT_F_LONG          = 0x80000000L;
1150	const auto MEVT_F_CALLBACK      = 0x40000000L;
1151	
1152	template MEVT_EVENTTYPE(DWORD x) {
1153		const auto MEVT_EVENTTYPE    = (cast(BYTE)(((x)>>24)&0xFF));
1154	}
1155	template MEVT_EVENTPARM(DWORD x) {
1156		const auto MEVT_EVENTPARM    = (cast(DWORD)((x)&0x00FFFFFFL));
1157	}
1158
1159	const auto MEVT_SHORTMSG        = (cast(BYTE)0x00)    ; /* parm = shortmsg for midiOutShortMsg */
1160	const auto MEVT_TEMPO           = (cast(BYTE)0x01)    ; /* parm = new tempo in microsec/qn     */
1161	const auto MEVT_NOP             = (cast(BYTE)0x02)    ; /* parm = unused; does nothing         */
1162
1163	/* 0x04-0x7F reserved */
1164
1165	const auto MEVT_LONGMSG         = (cast(BYTE)0x80)    ; /* parm = bytes to send verbatim       */
1166	const auto MEVT_COMMENT         = (cast(BYTE)0x82)    ; /* parm = comment data                 */
1167	const auto MEVT_VERSION         = (cast(BYTE)0x84)    ; /* parm = MIDISTRMBUFFVER align(2) struct       */
1168	
1169	/* 0x81-0xFF reserved */
1170	
1171	const auto MIDISTRM_ERROR       = (-2);
1172	
1173	/* */
1174	/* Structures and defines for midiStreamProperty */
1175	/* */
1176	const auto MIDIPROP_SET         = 0x80000000L;
1177	const auto MIDIPROP_GET         = 0x40000000L;
1178	
1179	/* These are intentionally both non-zero so the app cannot accidentally */
1180	/* leave the operation off and happen to appear to work due to default */
1181	/* action. */
1182	
1183	const auto MIDIPROP_TIMEDIV     = 0x00000001L;
1184	const auto MIDIPROP_TEMPO       = 0x00000002L;
1185	
1186	align(2) struct MIDIPROPTIMEDIV {
1187	    DWORD       cbStruct;
1188	    DWORD       dwTimeDiv;
1189	}
1190	
1191	alias MIDIPROPTIMEDIV* LPMIDIPROPTIMEDIV;
1192	
1193	align(2) struct MIDIPROPTEMPO {
1194	    DWORD       cbStruct;
1195	    DWORD       dwTempo;
1196	}
1197
1198	alias MIDIPROPTEMPO* LPMIDIPROPTEMPO;
1199	
1200	/* MIDI function prototypes */
1201	UINT midiOutGetNumDevs();
1202	
1203	MMRESULT midiStreamOpen( LPHMIDISTRM phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
1204	MMRESULT midiStreamClose( HMIDISTRM hms);
1205	
1206	MMRESULT midiStreamProperty( HMIDISTRM hms, LPBYTE lppropdata, DWORD dwProperty);
1207	MMRESULT midiStreamPosition( HMIDISTRM hms, LPMMTIME lpmmt, UINT cbmmt);
1208	
1209	MMRESULT midiStreamOut( HMIDISTRM hms, LPMIDIHDR pmh, UINT cbmh);
1210	MMRESULT midiStreamPause( HMIDISTRM hms);
1211	MMRESULT midiStreamRestart( HMIDISTRM hms);
1212	MMRESULT midiStreamStop( HMIDISTRM hms);
1213	
1214	MMRESULT midiConnect( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved);
1215	MMRESULT midiDisconnect( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved);
1216	
1217	MMRESULT midiOutGetDevCapsA( UINT_PTR uDeviceID, LPMIDIOUTCAPSA pmoc, UINT cbmoc);
1218	MMRESULT midiOutGetDevCapsW( UINT_PTR uDeviceID, LPMIDIOUTCAPSW pmoc, UINT cbmoc);
1219	
1220	version(UNICODE) {
1221		alias midiOutGetDevCapsW midiOutGetDevCaps;
1222	}
1223	else {
1224		alias midiOutGetDevCapsA midiOutGetDevCaps;
1225	}
1226	
1227	MMRESULT midiOutGetVolume( HMIDIOUT hmo, LPDWORD pdwVolume);
1228	MMRESULT midiOutSetVolume( HMIDIOUT hmo, DWORD dwVolume);
1229	
1230	MMRESULT midiOutGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText);
1231	MMRESULT midiOutGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
1232	
1233	version(UNICODE) {
1234		alias midiOutGetErrorTextW midiOutGetErrorText;
1235	}
1236	else {
1237		alias midiOutGetErrorTextA midiOutGetErrorText;
1238	}
1239	
1240	MMRESULT midiOutOpen( LPHMIDIOUT phmo, UINT uDeviceID,
1241	    DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
1242	MMRESULT midiOutClose( HMIDIOUT hmo);
1243	MMRESULT midiOutPrepareHeader( HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
1244	MMRESULT midiOutUnprepareHeader(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
1245	MMRESULT midiOutShortMsg( HMIDIOUT hmo, DWORD dwMsg);
1246	MMRESULT midiOutLongMsg(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
1247	MMRESULT midiOutReset( HMIDIOUT hmo);
1248	MMRESULT midiOutCachePatches( HMIDIOUT hmo, UINT uBank, LPWORD pwpa, UINT fuCache);
1249	MMRESULT midiOutCacheDrumPatches( HMIDIOUT hmo, UINT uPatch, LPWORD pwkya, UINT fuCache);
1250	MMRESULT midiOutGetID( HMIDIOUT hmo, LPUINT puDeviceID);
1251	
1252	MMRESULT midiOutMessage( HMIDIOUT hmo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
1253	
1254	UINT midiInGetNumDevs();
1255	
1256	MMRESULT midiInGetDevCapsA( UINT_PTR uDeviceID, LPMIDIINCAPSA pmic, UINT cbmic);
1257	MMRESULT midiInGetDevCapsW( UINT_PTR uDeviceID, LPMIDIINCAPSW pmic, UINT cbmic);
1258	
1259	version(UNICODE) {
1260		alias midiInGetDevCapsW midiInGetDevCaps;
1261	}
1262	else {
1263		alias midiInGetDevCapsA midiInGetDevCaps;
1264	}
1265	
1266	MMRESULT midiInGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText);
1267	MMRESULT midiInGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
1268	
1269	version(UNICODE) {
1270		alias midiInGetErrorTextW midiInGetErrorText;
1271	}
1272	else {
1273		alias midiInGetErrorTextA midiInGetErrorText;
1274	}
1275	
1276	MMRESULT midiInOpen( LPHMIDIIN phmi, UINT uDeviceID,
1277	        DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
1278	MMRESULT midiInClose( HMIDIIN hmi);
1279	MMRESULT midiInPrepareHeader( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
1280	MMRESULT midiInUnprepareHeader( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
1281	MMRESULT midiInAddBuffer( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
1282	MMRESULT midiInStart( HMIDIIN hmi);
1283	MMRESULT midiInStop( HMIDIIN hmi);
1284	MMRESULT midiInReset( HMIDIIN hmi);
1285	MMRESULT midiInGetID( HMIDIIN hmi, LPUINT puDeviceID);
1286	
1287	MMRESULT midiInMessage( HMIDIIN hmi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
1288}
1289
1290/****************************************************************************
1291
1292                        Auxiliary audio support
1293
1294****************************************************************************/
1295version(MMNOAUX) {
1296}
1297else {
1298	/* device ID for aux device mapper */
1299	const auto AUX_MAPPER      = (cast(UINT)-1);
1300	
1301	/* Auxiliary audio device capabilities align(2) structure */
1302	align(2) struct AUXCAPSA {
1303	    WORD        wMid;                /* manufacturer ID */
1304	    WORD        wPid;                /* product ID */
1305	    MMVERSION   vDriverVersion;      /* version of the driver */
1306	    CHAR[MAXPNAMELEN]        szPname;/* product name (NULL terminated string) */
1307	    WORD        wTechnology;         /* type of device */
1308	    WORD        wReserved1;          /* padding */
1309	    DWORD       dwSupport;           /* functionality supported by driver */
1310	}
1311	
1312	alias AUXCAPSA* PAUXCAPSA;
1313	alias AUXCAPSA* NPAUXCAPSA;
1314	alias AUXCAPSA* LPAUXCAPSA;
1315	
1316	align(2) struct AUXCAPSW {
1317	    WORD        wMid;                /* manufacturer ID */
1318	    WORD        wPid;                /* product ID */
1319	    MMVERSION   vDriverVersion;      /* version of the driver */
1320	    WCHAR[MAXPNAMELEN]       szPname;/* product name (NULL terminated string) */
1321	    WORD        wTechnology;         /* type of device */
1322	    WORD        wReserved1;          /* padding */
1323	    DWORD       dwSupport;           /* functionality supported by driver */
1324	}
1325	
1326	alias AUXCAPSW* PAUXCAPSW;
1327	alias AUXCAPSW* NPAUXCAPSW;
1328	alias AUXCAPSW* LPAUXCAPSW;
1329	
1330	version(UNICODE) {
1331		alias AUXCAPSW AUXCAPS;
1332		alias PAUXCAPSW PAUXCAPS;
1333		alias NPAUXCAPSW NPAUXCAPS;
1334		alias LPAUXCAPSW LPAUXCAPS;
1335	}
1336	else {
1337		alias AUXCAPSA AUXCAPS;
1338		alias PAUXCAPSA PAUXCAPS;
1339		alias NPAUXCAPSA NPAUXCAPS;
1340		alias LPAUXCAPSA LPAUXCAPS;
1341	}
1342	
1343	align(2) struct AUXCAPS2A {
1344	    WORD        wMid;                /* manufacturer ID */
1345	    WORD        wPid;                /* product ID */
1346	    MMVERSION   vDriverVersion;      /* version of the driver */
1347	    CHAR[MAXPNAMELEN]        szPname;/* product name (NULL terminated string) */
1348	    WORD        wTechnology;         /* type of device */
1349	    WORD        wReserved1;          /* padding */
1350	    DWORD       dwSupport;           /* functionality supported by driver */
1351	    GUID        ManufacturerGuid;    /* for extensible MID mapping */
1352	    GUID        ProductGuid;         /* for extensible PID mapping */
1353	    GUID        NameGuid;            /* for name lookup in registry */
1354	}
1355	
1356	alias AUXCAPS2A* PAUXCAPS2A;
1357	alias AUXCAPS2A* NPAUXCAPS2A;
1358	alias AUXCAPS2A* LPAUXCAPS2A;
1359	
1360	align(2) struct AUXCAPS2W {
1361	    WORD        wMid;                /* manufacturer ID */
1362	    WORD        wPid;                /* product ID */
1363	    MMVERSION   vDriverVersion;      /* version of the driver */
1364	    WCHAR[MAXPNAMELEN]       szPname;/* product name (NULL terminated string) */
1365	    WORD        wTechnology;         /* type of device */
1366	    WORD        wReserved1;          /* padding */
1367	    DWORD       dwSupport;           /* functionality supported by driver */
1368	    GUID        ManufacturerGuid;    /* for extensible MID mapping */
1369	    GUID        ProductGuid;         /* for extensible PID mapping */
1370	    GUID        NameGuid;            /* for name lookup in registry */
1371	}
1372	
1373	alias AUXCAPS2W* PAUXCAPS2W;
1374	alias AUXCAPS2W* NPAUXCAPS2W;
1375	alias AUXCAPS2W* LPAUXCAPS2W;
1376	
1377	version(UNICODE) {
1378		alias AUXCAPS2W AUXCAPS2;
1379		alias PAUXCAPS2W PAUXCAPS2;
1380		alias NPAUXCAPS2W NPAUXCAPS2;
1381		alias LPAUXCAPS2W LPAUXCAPS2;
1382	}
1383	else {
1384		alias AUXCAPS2A AUXCAPS2;
1385		alias PAUXCAPS2A PAUXCAPS2;
1386		alias NPAUXCAPS2A NPAUXCAPS2;
1387		alias LPAUXCAPS2A LPAUXCAPS2;
1388	}
1389	
1390	/* flags for wTechnology field in AUXCAPS align(2) structure */
1391	const auto AUXCAPS_CDAUDIO     = 1       ; /* audio from internal CD-ROM drive */
1392	const auto AUXCAPS_AUXIN       = 2       ; /* audio from auxiliary input jacks */
1393	
1394	/* flags for dwSupport field in AUXCAPS align(2) structure */
1395	const auto AUXCAPS_VOLUME           = 0x0001  ; /* supports volume control */
1396	const auto AUXCAPS_LRVOLUME         = 0x0002  ; /* separate left-right volume control */
1397	
1398	/* auxiliary audio function prototypes */
1399	UINT auxGetNumDevs();
1400	
1401	MMRESULT auxGetDevCapsA( UINT_PTR uDeviceID, LPAUXCAPSA pac, UINT cbac);
1402	MMRESULT auxGetDevCapsW( UINT_PTR uDeviceID, LPAUXCAPSW pac, UINT cbac);
1403	
1404	version(UNICODE) {
1405		alias auxGetDevCapsW auxGetDevCaps;
1406	}
1407	else {
1408		alias auxGetDevCapsA auxGetDevCaps;
1409	}
1410	
1411	MMRESULT auxSetVolume( UINT uDeviceID, DWORD dwVolume);
1412	MMRESULT auxGetVolume( UINT uDeviceID, LPDWORD pdwVolume);
1413
1414	MMRESULT auxOutMessage( UINT uDeviceID, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
1415}
1416
1417/****************************************************************************
1418
1419                            Mixer Support
1420
1421****************************************************************************/
1422version(MMNOMIXER) {
1423}
1424else {
1425	alias HANDLE HMIXEROBJ;
1426	alias HMIXEROBJ *LPHMIXEROBJ;
1427	
1428	alias HANDLE HMIXER;
1429	alias HMIXER     *LPHMIXER;
1430	
1431	const auto MIXER_SHORT_NAME_CHARS    = 16;
1432	const auto MIXER_LONG_NAME_CHARS     = 64;
1433	
1434	/* */
1435	/*  MMRESULT error return values specific to the mixer API */
1436	/* */
1437	/* */
1438	const auto MIXERR_INVALLINE             = (MIXERR_BASE + 0);
1439	const auto MIXERR_INVALCONTROL          = (MIXERR_BASE + 1);
1440	const auto MIXERR_INVALVALUE            = (MIXERR_BASE + 2);
1441	const auto MIXERR_LASTERROR             = (MIXERR_BASE + 2);
1442	
1443	
1444	const auto MIXER_OBJECTF_HANDLE     = 0x80000000L;
1445	const auto MIXER_OBJECTF_MIXER      = 0x00000000L;
1446	const auto MIXER_OBJECTF_HMIXER     = (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIXER);
1447	const auto MIXER_OBJECTF_WAVEOUT    = 0x10000000L;
1448	const auto MIXER_OBJECTF_HWAVEOUT   = (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEOUT);
1449	const auto MIXER_OBJECTF_WAVEIN     = 0x20000000L;
1450	const auto MIXER_OBJECTF_HWAVEIN    = (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEIN);
1451	const auto MIXER_OBJECTF_MIDIOUT    = 0x30000000L;
1452	const auto MIXER_OBJECTF_HMIDIOUT   = (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIOUT);
1453	const auto MIXER_OBJECTF_MIDIIN     = 0x40000000L;
1454	const auto MIXER_OBJECTF_HMIDIIN    = (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIIN);
1455	const auto MIXER_OBJECTF_AUX        = 0x50000000L;
1456	
1457	
1458	UINT mixerGetNumDevs();
1459	
1460	align(2) struct MIXERCAPSA {
1461	    WORD            wMid;                   /* manufacturer id */
1462	    WORD            wPid;                   /* product id */
1463	    MMVERSION       vDriverVersion;         /* version of the driver */
1464	    CHAR[MAXPNAMELEN]            szPname;   /* product name */
1465	    DWORD           fdwSupport;             /* misc. support bits */
1466	    DWORD           cDestinations;          /* count of destinations */
1467	}
1468	
1469	alias MIXERCAPSA* PMIXERCAPSA;
1470	alias MIXERCAPSA* LPMIXERCAPSA;
1471	align(2) struct MIXERCAPSW {
1472	    WORD            wMid;                   /* manufacturer id */
1473	    WORD            wPid;                   /* product id */
1474	    MMVERSION       vDriverVersion;         /* version of the driver */
1475	    WCHAR[MAXPNAMELEN]           szPname;   /* product name */
1476	    DWORD           fdwSupport;             /* misc. support bits */
1477	    DWORD           cDestinations;          /* count of destinations */
1478	}
1479	
1480	alias MIXERCAPSW* PMIXERCAPSW;
1481	alias MIXERCAPSW* LPMIXERCAPSW;
1482	
1483	version(UNICODE) {
1484		alias MIXERCAPSW MIXERCAPS;
1485		alias PMIXERCAPSW PMIXERCAPS;
1486		alias LPMIXERCAPSW LPMIXERCAPS;
1487	}
1488	else {
1489		alias MIXERCAPSA MIXERCAPS;
1490		alias PMIXERCAPSA PMIXERCAPS;
1491		alias LPMIXERCAPSA LPMIXERCAPS;
1492	}
1493	align(2) struct MIXERCAPS2A {
1494	    WORD            wMid;                   /* manufacturer id */
1495	    WORD            wPid;                   /* product id */
1496	    MMVERSION       vDriverVersion;         /* version of the driver */
1497	    CHAR[MAXPNAMELEN]            szPname;   /* product name */
1498	    DWORD           fdwSupport;             /* misc. support bits */
1499	    DWORD           cDestinations;          /* count of destinations */
1500	    GUID            ManufacturerGuid;       /* for extensible MID mapping */
1501	    GUID            ProductGuid;            /* for extensible PID mapping */
1502	    GUID            NameGuid;               /* for name lookup in registry */
1503	}
1504	
1505	alias MIXERCAPS2A* PMIXERCAPS2A;
1506	alias MIXERCAPS2A* LPMIXERCAPS2A;
1507	align(2) struct MIXERCAPS2W {
1508	    WORD            wMid;                   /* manufacturer id */
1509	    WORD            wPid;                   /* product id */
1510	    MMVERSION       vDriverVersion;         /* version of the driver */
1511	    WCHAR[MAXPNAMELEN]           szPname;   /* product name */
1512	    DWORD           fdwSupport;             /* misc. support bits */
1513	    DWORD           cDestinations;          /* count of destinations */
1514	    GUID            ManufacturerGuid;       /* for extensible MID mapping */
1515	    GUID            ProductGuid;            /* for extensible PID mapping */
1516	    GUID            NameGuid;               /* for name lookup in registry */
1517	}
1518	
1519	alias MIXERCAPS2W* PMIXERCAPS2W;
1520	alias MIXERCAPS2W* LPMIXERCAPS2W;
1521	
1522	version(UNICODE) {
1523		alias MIXERCAPS2W MIXERCAPS2;
1524		alias PMIXERCAPS2W PMIXERCAPS2;
1525		alias LPMIXERCAPS2W LPMIXERCAPS2;
1526	}
1527	else {
1528		alias MIXERCAPS2A MIXERCAPS2;
1529		alias PMIXERCAPS2A PMIXERCAPS2;
1530		alias LPMIXERCAPS2A LPMIXERCAPS2;
1531	}
1532	
1533	MMRESULT mixerGetDevCapsA( UINT_PTR uMxId, LPMIXERCAPSA pmxcaps, UINT cbmxcaps);
1534	MMRESULT mixerGetDevCapsW( UINT_PTR uMxId, LPMIXERCAPSW pmxcaps, UINT cbmxcaps);
1535	
1536	version(UNICODE) {
1537		alias mixerGetDevCapsW mixerGetDevCaps;
1538	}
1539	else {
1540		alias mixerGetDevCapsA mixerGetDevCaps;
1541	}
1542	
1543	MMRESULT mixerOpen( LPHMIXER phmx, UINT uMxId, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
1544	MMRESULT mixerClose( HMIXER hmx);
1545	
1546	DWORD mixerMessage( HMIXER hmx, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
1547	
1548	align(2) struct MIXERLINEA {
1549	    DWORD       cbStruct;               /* size of MIXERLINE align(2) structure */
1550	    DWORD       dwDestination;          /* zero based destination index */
1551	    DWORD       dwSource;               /* zero based source index (if source) */
1552	    DWORD       dwLineID;               /* unique line id for mixer device */
1553	    DWORD       fdwLine;                /* state/information about line */
1554	    DWORD_PTR   dwUser;                 /* driver specific information */
1555	    DWORD       dwComponentType;        /* component type line connects to */
1556	    DWORD       cChannels;              /* number of channels line supports */
1557	    DWORD       cConnections;           /* number of connections [possible] */
1558	    DWORD       cControls;              /* number of controls at this line */
1559	    CHAR[MIXER_SHORT_NAME_CHARS]        szShortName;
1560	    CHAR[MIXER_LONG_NAME_CHARS]        szName;
1561	    align(2) struct _inner_struct {
1562	        DWORD       dwType;                 /* MIXERLINE_TARGETTYPE_xxxx */
1563	        DWORD       dwDeviceID;             /* target device ID of device type */
1564	        WORD        wMid;                   /* of target device */
1565	        WORD        wPid;                   /*      " */
1566	        MMVERSION   vDriverVersion;         /*      " */
1567	        CHAR[MAXPNAMELEN]        szPname;   /*      " */
1568	    }
1569		_inner_struct Target;
1570	}
1571	
1572	alias MIXERLINEA* PMIXERLINEA;
1573	alias MIXERLINEA* LPMIXERLINEA;
1574	align(2) struct MIXERLINEW {
1575	    DWORD       cbStruct;               /* size of MIXERLINE align(2) structure */
1576	    DWORD       dwDestination;          /* zero based destination index */
1577	    DWORD       dwSource;               /* zero based source index (if source) */
1578	    DWORD       dwLineID;               /* unique line id for mixer device */
1579	    DWORD       fdwLine;                /* state/information about line */
1580	    DWORD_PTR   dwUser;                 /* driver specific information */
1581	    DWORD       dwComponentType;        /* component type line connects to */
1582	    DWORD       cChannels;              /* number of channels line supports */
1583	    DWORD       cConnections;           /* number of connections [possible] */
1584	    DWORD       cControls;              /* number of controls at this line */
1585	    WCHAR[MIXER_SHORT_NAME_CHARS]       szShortName;
1586	    WCHAR[MIXER_LONG_NAME_CHARS]       szName;
1587	    align(2) struct _inner_struct {
1588	        DWORD       dwType;                 /* MIXERLINE_TARGETTYPE_xxxx */
1589	        DWORD       dwDeviceID;             /* target device ID of device type */
1590	        WORD        wMid;                   /* of target device */
1591	        WORD        wPid;                   /*      " */
1592	        MMVERSION   vDriverVersion;         /*      " */
1593	        WCHAR[MAXPNAMELEN]       szPname;   /*      " */
1594	    }
1595		_inner_struct Target;
1596	}
1597	
1598	alias MIXERLINEW* PMIXERLINEW;
1599	alias MIXERLINEW* LPMIXERLINEW;
1600	
1601	version(UNICODE) {
1602		alias MIXERLINEW MIXERLINE;
1603		alias PMIXERLINEW PMIXERLINE;
1604		alias LPMIXERLINEW LPMIXERLINE;
1605	}
1606	else {
1607		alias MIXERLINEA MIXERLINE;
1608		alias PMIXERLINEA PMIXERLINE;
1609		alias LPMIXERLINEA LPMIXERLINE;
1610	}
1611	
1612	/* */
1613	/*  MIXERLINE.fdwLine */
1614	/* */
1615	/* */
1616	const auto MIXERLINE_LINEF_ACTIVE               = 0x00000001L;
1617	const auto MIXERLINE_LINEF_DISCONNECTED         = 0x00008000L;
1618	const auto MIXERLINE_LINEF_SOURCE               = 0x80000000L;
1619	
1620	
1621	/* */
1622	/*  MIXERLINE.dwComponentType */
1623	/* */
1624	/*  component types for destinations and sources */
1625	/* */
1626	/* */
1627	const auto MIXERLINE_COMPONENTTYPE_DST_FIRST        = 0x00000000L;
1628	const auto MIXERLINE_COMPONENTTYPE_DST_UNDEFINED    = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0);
1629	const auto MIXERLINE_COMPONENTTYPE_DST_DIGITAL      = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1);
1630	const auto MIXERLINE_COMPONENTTYPE_DST_LINE         = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2);
1631	const auto MIXERLINE_COMPONENTTYPE_DST_MONITOR      = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3);
1632	const auto MIXERLINE_COMPONENTTYPE_DST_SPEAKERS     = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4);
1633	const auto MIXERLINE_COMPONENTTYPE_DST_HEADPHONES   = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5);
1634	const auto MIXERLINE_COMPONENTTYPE_DST_TELEPHONE    = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6);
1635	const auto MIXERLINE_COMPONENTTYPE_DST_WAVEIN       = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7);
1636	const auto MIXERLINE_COMPONENTTYPE_DST_VOICEIN      = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
1637	const auto MIXERLINE_COMPONENTTYPE_DST_LAST         = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
1638	
1639	const auto MIXERLINE_COMPONENTTYPE_SRC_FIRST        = 0x00001000L;
1640	const auto MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED    = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0);
1641	const auto MIXERLINE_COMPONENTTYPE_SRC_DIGITAL      = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1);
1642	const auto MIXERLINE_COMPONENTTYPE_SRC_LINE         = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2);
1643	const auto MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE   = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3);
1644	const auto MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER  = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4);
1645	const auto MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC  = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5);
1646	const auto MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE    = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6);
1647	const auto MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER    = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7);
1648	const auto MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT      = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8);
1649	const auto MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY    = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9);
1650	const auto MIXERLINE_COMPONENTTYPE_SRC_ANALOG       = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
1651	const auto MIXERLINE_COMPONENTTYPE_SRC_LAST         = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
1652	
1653	
1654	/* */
1655	/*  MIXERLINE.Target.dwType */
1656	/* */
1657	/* */
1658	const auto MIXERLINE_TARGETTYPE_UNDEFINED       = 0;
1659	const auto MIXERLINE_TARGETTYPE_WAVEOUT         = 1;
1660	const auto MIXERLINE_TARGETTYPE_WAVEIN          = 2;
1661	const auto MIXERLINE_TARGETTYPE_MIDIOUT         = 3;
1662	const auto MIXERLINE_TARGETTYPE_MIDIIN          = 4;
1663	const auto MIXERLINE_TARGETTYPE_AUX             = 5;
1664	
1665	MMRESULT mixerGetLineInfoA( HMIXEROBJ hmxobj, LPMIXERLINEA pmxl, DWORD fdwInfo);
1666	MMRESULT mixerGetLineInfoW( HMIXEROBJ hmxobj, LPMIXERLINEW pmxl, DWORD fdwInfo);
1667	
1668	version(UNICODE) {
1669		alias mixerGetLineInfoW mixerGetLineInfo;
1670	}
1671	else {
1672		alias mixerGetLineInfoA mixerGetLineInfo;
1673	}
1674	
1675	const auto MIXER_GETLINEINFOF_DESTINATION       = 0x00000000L;
1676	const auto MIXER_GETLINEINFOF_SOURCE            = 0x00000001L;
1677	const auto MIXER_GETLINEINFOF_LINEID            = 0x00000002L;
1678	const auto MIXER_GETLINEINFOF_COMPONENTTYPE     = 0x00000003L;
1679	const auto MIXER_GETLINEINFOF_TARGETTYPE        = 0x00000004L;
1680	
1681	const auto MIXER_GETLINEINFOF_QUERYMASK         = 0x0000000FL;
1682	
1683	MMRESULT mixerGetID( HMIXEROBJ hmxobj, UINT *puMxId, DWORD fdwId);
1684	
1685	
1686	/* */
1687	/*  MIXERCONTROL */
1688	/* */
1689	/* */
1690	align(2) struct MIXERCONTROLA {
1691	    DWORD           cbStruct;           /* size in bytes of MIXERCONTROL */
1692	    DWORD           dwControlID;        /* unique control id for mixer device */
1693	    DWORD           dwControlType;      /* MIXERCONTROL_CONTROLTYPE_xxx */
1694	    DWORD           fdwControl;         /* MIXERCONTROL_CONTROLF_xxx */
1695	    DWORD           cMultipleItems;     /* if MIXERCONTROL_CONTROLF_MULTIPLE set */
1696	    CHAR[MIXER_SHORT_NAME_CHARS]            szShortName;
1697	    CHAR[MIXER_LONG_NAME_CHARS]            szName;
1698	    align(2) union _inner_union {
1699	        align(2) struct _inner_struct {
1700	            LONG    lMinimum;           /* signed minimum for this control */
1701	            LONG    lMaximum;           /* signed maximum for this control */
1702	        }
1703	        _inner_struct Signed;
1704	        align(2) struct _inner_struct2 {
1705	            DWORD   dwMinimum;          /* unsigned minimum for this control */
1706	            DWORD   dwMaximum;          /* unsigned maximum for this control */
1707	        }
1708	        _inner_struct2 Unsigned;
1709	        DWORD       dwReserved[6];
1710	    }
1711		_inner_union Bounds;
1712	    align(2) union _inner_union2 {
1713	        DWORD       cSteps;             /* # of steps between min & max */
1714	        DWORD       cbCustomData;       /* size in bytes of custom data */
1715	        DWORD[6]    dwReserved;         /* !!! needed? we have cbStruct.... */
1716	    }
1717		_inner_union2 Metrics;
1718	}
1719	
1720	alias MIXERCONTROLA* PMIXERCONTROLA;
1721	alias MIXERCONTROLA* LPMIXERCONTROLA;
1722	align(2) struct MIXERCONTROLW {
1723	    DWORD           cbStruct;           /* size in bytes of MIXERCONTROL */
1724	    DWORD           dwControlID;        /* unique control id for mixer device */
1725	    DWORD           dwControlType;      /* MIXERCONTROL_CONTROLTYPE_xxx */
1726	    DWORD           fdwControl;         /* MIXERCONTROL_CONTROLF_xxx */
1727	    DWORD           cMultipleItems;     /* if MIXERCONTROL_CONTROLF_MULTIPLE set */
1728	    WCHAR           szShortName[MIXER_SHORT_NAME_CHARS];
1729	    WCHAR           szName[MIXER_LONG_NAME_CHARS];
1730	    align(2) union _inner_union {
1731	        align(2) struct _inner_struct {
1732	            LONG    lMinimum;           /* signed minimum for this control */
1733	            LONG    lMaximum;           /* signed maximum for this control */
1734	        }
1735	        _inner_struct Signed;
1736	        align(2) struct _inner_struct2 {
1737	            DWORD   dwMinimum;          /* unsigned minimum for this control */
1738	            DWORD   dwMaximum;          /* unsigned maximum for this control */
1739	        }
1740	        _inner_struct2 Unsigned;
1741	        DWORD[6]       dwReserved;
1742	    }
1743		_inner_union Bounds;
1744	    align(2) union _inner_union2 {
1745	        DWORD       cSteps;             /* # of steps between min & max */
1746	        DWORD       cbCustomData;       /* size in bytes of custom data */
1747	        DWORD[6]       dwReserved;      /* !!! needed? we have cbStruct.... */
1748	    }
1749		_inner_union2 Metrics;
1750	}
1751	
1752	alias MIXERCONTROLW* PMIXERCONTROLW;
1753	alias MIXERCONTROLW* LPMIXERCONTROLW;
1754	
1755	version(UNICODE) {
1756		alias MIXERCONTROLW MIXERCONTROL;
1757		alias PMIXERCONTROLW PMIXERCONTROL;
1758		alias LPMIXERCONTROLW LPMIXERCONTROL;
1759	}
1760	else {
1761		alias MIXERCONTROLA MIXERCONTROL;
1762		alias PMIXERCONTROLA PMIXERCONTROL;
1763		alias LPMIXERCONTROLA LPMIXERCONTROL;
1764	}
1765	
1766	/* */
1767	/*  MIXERCONTROL.fdwControl */
1768	/* */
1769	/* */
1770	const auto MIXERCONTROL_CONTROLF_UNIFORM    = 0x00000001L;
1771	const auto MIXERCONTROL_CONTROLF_MULTIPLE   = 0x00000002L;
1772	const auto MIXERCONTROL_CONTROLF_DISABLED   = 0x80000000L;
1773	
1774	
1775	/* */
1776	/*  MIXERCONTROL_CONTROLTYPE_xxx building block defines */
1777	/* */
1778	/* */
1779	const auto MIXERCONTROL_CT_CLASS_MASK           = 0xF0000000L;
1780	const auto MIXERCONTROL_CT_CLASS_CUSTOM         = 0x00000000L;
1781	const auto MIXERCONTROL_CT_CLASS_METER          = 0x10000000L;
1782	const auto MIXERCONTROL_CT_CLASS_SWITCH         = 0x20000000L;
1783	const auto MIXERCONTROL_CT_CLASS_NUMBER         = 0x30000000L;
1784	const auto MIXERCONTROL_CT_CLASS_SLIDER         = 0x40000000L;
1785	const auto MIXERCONTROL_CT_CLASS_FADER          = 0x50000000L;
1786	const auto MIXERCONTROL_CT_CLASS_TIME           = 0x60000000L;
1787	const auto MIXERCONTROL_CT_CLASS_LIST           = 0x70000000L;
1788	
1789	
1790	const auto MIXERCONTROL_CT_SUBCLASS_MASK        = 0x0F000000L;
1791	
1792	const auto MIXERCONTROL_CT_SC_SWITCH_BOOLEAN    = 0x00000000L;
1793	const auto MIXERCONTROL_CT_SC_SWITCH_BUTTON     = 0x01000000L;
1794	
1795	const auto MIXERCONTROL_CT_SC_METER_POLLED      = 0x00000000L;
1796	
1797	const auto MIXERCONTROL_CT_SC_TIME_MICROSECS    = 0x00000000L;
1798	const auto MIXERCONTROL_CT_SC_TIME_MILLISECS    = 0x01000000L;
1799	
1800	const auto MIXERCONTROL_CT_SC_LIST_SINGLE       = 0x00000000L;
1801	const auto MIXERCONTROL_CT_SC_LIST_MULTIPLE     = 0x01000000L;
1802	
1803	
1804	const auto MIXERCONTROL_CT_UNITS_MASK           = 0x00FF0000L;
1805	const auto MIXERCONTROL_CT_UNITS_CUSTOM         = 0x00000000L;
1806	const auto MIXERCONTROL_CT_UNITS_BOOLEAN        = 0x00010000L;
1807	const auto MIXERCONTROL_CT_UNITS_SIGNED         = 0x00020000L;
1808	const auto MIXERCONTROL_CT_UNITS_UNSIGNED       = 0x00030000L;
1809	const auto MIXERCONTROL_CT_UNITS_DECIBELS       = 0x00040000L ; /* in 10ths */
1810	const auto MIXERCONTROL_CT_UNITS_PERCENT        = 0x00050000L ; /* in 10ths */
1811	
1812	
1813	/* */
1814	/*  Commonly used control types for specifying MIXERCONTROL.dwControlType */
1815	/* */
1816	
1817	const auto MIXERCONTROL_CONTROLTYPE_CUSTOM          = (MIXERCONTROL_CT_CLASS_CUSTOM | MIXERCONTROL_CT_UNITS_CUSTOM);
1818	const auto MIXERCONTROL_CONTROLTYPE_BOOLEANMETER    = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_BOOLEAN);
1819	const auto MIXERCONTROL_CONTROLTYPE_SIGNEDMETER     = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_SIGNED);
1820	const auto MIXERCONTROL_CONTROLTYPE_PEAKMETER       = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1);
1821	const auto MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER   = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_UNSIGNED);
1822	const auto MIXERCONTROL_CONTROLTYPE_BOOLEAN         = (MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BOOLEAN | MIXERCONTROL_CT_UNITS_BOOLEAN);
1823	const auto MIXERCONTROL_CONTROLTYPE_ONOFF           = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1);
1824	const auto MIXERCONTROL_CONTROLTYPE_MUTE            = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2);
1825	const auto MIXERCONTROL_CONTROLTYPE_MONO            = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3);
1826	const auto MIXERCONTROL_CONTROLTYPE_LOUDNESS        = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4);
1827	const auto MIXERCONTROL_CONTROLTYPE_STEREOENH       = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5);
1828	const auto MIXERCONTROL_CONTROLTYPE_BASS_BOOST      = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 0x00002277);
1829	const auto MIXERCONTROL_CONTROLTYPE_BUTTON          = (MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BUTTON | MIXERCONTROL_CT_UNITS_BOOLEAN);
1830	const auto MIXERCONTROL_CONTROLTYPE_DECIBELS        = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_DECIBELS);
1831	const auto MIXERCONTROL_CONTROLTYPE_SIGNED          = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_SIGNED);
1832	const auto MIXERCONTROL_CONTROLTYPE_UNSIGNED        = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_UNSIGNED);
1833	const auto MIXERCONTROL_CONTROLTYPE_PERCENT         = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_PERCENT);
1834	const auto MIXERCONTROL_CONTROLTYPE_SLIDER          = (MIXERCONTROL_CT_CLASS_SLIDER | MIXERCONTROL_CT_UNITS_SIGNED);
1835	const auto MIXERCONTROL_CONTROLTYPE_PAN             = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1);
1836	const auto MIXERCONTROL_CONTROLTYPE_QSOUNDPAN       = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2);
1837	const auto MIXERCONTROL_CONTROLTYPE_FADER           = (MIXERCONTROL_CT_CLASS_FADER | MIXERCONTROL_CT_UNITS_UNSIGNED);
1838	const auto MIXERCONTROL_CONTROLTYPE_VOLUME          = (MIXERCONTROL_CONTROLTYPE_FADER + 1);
1839	const auto MIXERCONTROL_CONTROLTYPE_BASS            = (MIXERCONTROL_CONTROLTYPE_FADER + 2);
1840	const auto MIXERCONTROL_CONTROLTYPE_TREBLE          = (MIXERCONTROL_CONTROLTYPE_FADER + 3);
1841	const auto MIXERCONTROL_CONTROLTYPE_EQUALIZER       = (MIXERCONTROL_CONTROLTYPE_FADER + 4);
1842	const auto MIXERCONTROL_CONTROLTYPE_SINGLESELECT    = (MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_SINGLE | MIXERCONTROL_CT_UNITS_BOOLEAN);
1843	const auto MIXERCONTROL_CONTROLTYPE_MUX             = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1);
1844	const auto MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT  = (MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_MULTIPLE | MIXERCONTROL_CT_UNITS_BOOLEAN);
1845	const auto MIXERCONTROL_CONTROLTYPE_MIXER           = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1);
1846	const auto MIXERCONTROL_CONTROLTYPE_MICROTIME       = (MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MICROSECS | MIXERCONTROL_CT_UNITS_UNSIGNED);
1847	const auto MIXERCONTROL_CONTROLTYPE_MILLITIME       = (MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MILLISECS | MIXERCONTROL_CT_UNITS_UNSIGNED);
1848	
1849	/* */
1850	/*  MIXERLINECONTROLS */
1851	/* */
1852	align(2) struct MIXERLINECONTROLSA {
1853	    DWORD           cbStruct;       /* size in bytes of MIXERLINECONTROLS */
1854	    DWORD           dwLineID;       /* line id (from MIXERLINE.dwLineID) */
1855	    align(2) union _inner_union {
1856	        DWORD       dwControlID;    /* MIXER_GETLINECONTROLSF_ONEBYID */
1857	        DWORD       dwControlType;  /* MIXER_GETLINECONTROLSF_ONEBYTYPE */
1858	    }
1859	    _inner_union fields;
1860	    DWORD           cControls;      /* count of controls pmxctrl points to */
1861	    DWORD           cbmxctrl;       /* size in bytes of _one_ MIXERCONTROL */
1862	    LPMIXERCONTROLA pamxctrl;       /* pointer to first MIXERCONTROL array */
1863	}
1864	
1865	alias MIXERLINECONTROLSA* PMIXERLINECONTROLSA;
1866	alias MIXERLINECONTROLSA* LPMIXERLINECONTROLSA;
1867	align(2) struct MIXERLINECONTROLSW {
1868	    DWORD           cbStruct;       /* size in bytes of MIXERLINECONTROLS */
1869	    DWORD           dwLineID;       /* line id (from MIXERLINE.dwLineID) */
1870	    align(2) union _inner_union {
1871	        DWORD       dwControlID;    /* MIXER_GETLINECONTROLSF_ONEBYID */
1872	        DWORD       dwControlType;  /* MIXER_GETLINECONTROLSF_ONEBYTYPE */
1873	    }
1874	    _inner_union fields;
1875	    DWORD           cControls;      /* count of controls pmxctrl points to */
1876	    DWORD           cbmxctrl;       /* size in bytes of _one_ MIXERCONTROL */
1877	    LPMIXERCONTROLW pamxctrl;       /* pointer to first MIXERCONTROL array */
1878	}
1879	
1880	alias MIXERLINECONTROLSW* PMIXERLINECONTROLSW;
1881	alias MIXERLINECONTROLSW* LPMIXERLINECONTROLSW;
1882	
1883	version(UNICODE) {
1884		alias MIXERLINECONTROLSW MIXERLINECONTROLS;
1885		alias PMIXERLINECONTROLSW PMIXERLINECONTROLS;
1886		alias LPMIXERLINECONTROLSW LPMIXERLINECONTROLS;
1887	}
1888	else {
1889		alias MIXERLINECONTROLSA MIXERLINECONTROLS;
1890		alias PMIXERLINECONTROLSA PMIXERLINECONTROLS;
1891		alias LPMIXERLINECONTROLSA LPMIXERLINECONTROLS;
1892	}
1893	
1894	/* */
1895	/* */
1896	/* */
1897	MMRESULT mixerGetLineControlsA( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSA pmxlc, DWORD fdwControls);
1898	MMRESULT mixerGetLineControlsW( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSW pmxlc, DWORD fdwControls);
1899	
1900	version(UNICODE) {
1901		alias mixerGetLineControlsW mixerGetLineControls;
1902	}
1903	else {
1904		alias mixerGetLineControlsA mixerGetLineControls;
1905	}
1906	
1907	const auto MIXER_GETLINECONTROLSF_ALL           = 0x00000000L;
1908	const auto MIXER_GETLINECONTROLSF_ONEBYID       = 0x00000001L;
1909	const auto MIXER_GETLINECONTROLSF_ONEBYTYPE     = 0x00000002L;
1910	
1911	const auto MIXER_GETLINECONTROLSF_QUERYMASK     = 0x0000000FL;
1912	
1913	align(2) struct MIXERCONTROLDETAILS {
1914	    DWORD           cbStruct;       /* size in bytes of MIXERCONTROLDETAILS */
1915	    DWORD           dwControlID;    /* control id to get/set details on */
1916	    DWORD           cChannels;      /* number of channels in paDetails array */
1917	    align(2) union _inner_union {
1918	        HWND        hwndOwner;      /* for MIXER_SETCONTROLDETAILSF_CUSTOM */
1919	        DWORD       cMultipleItems; /* if _MULTIPLE, the number of items per channel */
1920	    }
1921	    _inner_union fields;
1922	    DWORD           cbDetails;      /* size of _one_ details_XX align(2) struct */
1923	    LPVOID          paDetails;      /* pointer to array of details_XX align(2) structs */
1924	}
1925	
1926	alias MIXERCONTROLDETAILS* PMIXERCONTROLDETAILS;
1927	alias MIXERCONTROLDETAILS* LPMIXERCONTROLDETAILS;
1928	
1929	
1930	/* */
1931	/*  MIXER_GETCONTROLDETAILSF_LISTTEXT */
1932	/* */
1933	/* */
1934	align(2) struct MIXERCONTROLDETAILS_LISTTEXTA {
1935	    DWORD           dwParam1;
1936	    DWORD           dwParam2;
1937	    CHAR[MIXER_LONG_NAME_CHARS]            szName;
1938	}
1939	
1940	alias MIXERCONTROLDETAILS_LISTTEXTA* PMIXERCONTROLDETAILS_LISTTEXTA;
1941	alias MIXERCONTROLDETAILS_LISTTEXTA* LPMIXERCONTROLDETAILS_LISTTEXTA;
1942	align(2) struct MIXERCONTROLDETAILS_LISTTEXTW {
1943	    DWORD           dwParam1;
1944	    DWORD           dwParam2;
1945	    WCHAR[MIXER_LONG_NAME_CHARS]           szName;
1946	}
1947	
1948	alias MIXERCONTROLDETAILS_LISTTEXTW* PMIXERCONTROLDETAILS_LISTTEXTW;
1949	alias MIXERCONTROLDETAILS_LISTTEXTW* LPMIXERCONTROLDETAILS_LISTTEXTW;
1950	
1951	version(UNICODE) {
1952		alias MIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXT;
1953		alias PMIXERCONTROLDETAILS_LISTTEXTW PMIXERCONTROLDETAILS_LISTTEXT;
1954		alias LPMIXERCONTROLDETAILS_LISTTEXTW LPMIXERCONTROLDETAILS_LISTTEXT;
1955	}
1956	else {
1957		alias MIXERCONTROLDETAILS_LISTTEXTA MIXERCONTROLDETAILS_LISTTEXT;
1958		alias PMIXERCONTROLDETAILS_LISTTEXTA PMIXERCONTROLDETAILS_LISTTEXT;
1959		alias LPMIXERCONTROLDETAILS_LISTTEXTA LPMIXERCONTROLDETAILS_LISTTEXT;
1960	}
1961	
1962	/* */
1963	/*  MIXER_GETCONTROLDETAILSF_VALUE */
1964	/* */
1965	/* */
1966	align(2) struct MIXERCONTROLDETAILS_BOOLEAN {
1967	    LONG            fValue;
1968	}
1969	
1970	alias MIXERCONTROLDETAILS_BOOLEAN* PMIXERCONTROLDETAILS_BOOLEAN;
1971	alias MIXERCONTROLDETAILS_BOOLEAN* LPMIXERCONTROLDETAILS_BOOLEAN;
1972	
1973	align(2) struct MIXERCONTROLDETAILS_SIGNED {
1974	    LONG            lValue;
1975	}
1976	
1977	alias MIXERCONTROLDETAILS_SIGNED* PMIXERCONTROLDETAILS_SIGNED;
1978	alias MIXERCONTROLDETAILS_SIGNED* LPMIXERCONTROLDETAILS_SIGNED;
1979	
1980	
1981	align(2) struct MIXERCONTROLDETAILS_UNSIGNED {
1982	    DWORD           dwValue;
1983	}
1984	
1985	alias MIXERCONTROLDETAILS_UNSIGNED* PMIXERCONTROLDETAILS_UNSIGNED;
1986	alias MIXERCONTROLDETAILS_UNSIGNED* LPMIXERCONTROLDETAILS_UNSIGNED;
1987	
1988	
1989	MMRESULT mixerGetControlDetailsA( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
1990	MMRESULT mixerGetControlDetailsW( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
1991	
1992	version(UNICODE) {
1993		alias mixerGetControlDetailsW mixerGetControlDetails;
1994	}
1995	else {
1996		alias mixerGetControlDetailsA mixerGetControlDetails;
1997	}
1998	
1999	const auto MIXER_GETCONTROLDETAILSF_VALUE       = 0x00000000L;
2000	const auto MIXER_GETCONTROLDETAILSF_LISTTEXT    = 0x00000001L;
2001	
2002	const auto MIXER_GETCONTROLDETAILSF_QUERYMASK   = 0x0000000FL;
2003	
2004	
2005	MMRESULT mixerSetControlDetails( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
2006	
2007	const auto MIXER_SETCONTROLDETAILSF_VALUE       = 0x00000000L;
2008	const auto MIXER_SETCONTROLDETAILSF_CUSTOM      = 0x00000001L;
2009	
2010	const auto MIXER_SETCONTROLDETAILSF_QUERYMASK   = 0x0000000FL;
2011}
2012
2013/****************************************************************************
2014
2015                            Timer support
2016
2017****************************************************************************/
2018version(MMNOTIMER) {
2019}
2020else {
2021	/* timer error return values */
2022	const auto TIMERR_NOERROR         = (0)                  ; /* no error */
2023	const auto TIMERR_NOCANDO         = (TIMERR_BASE+1)      ; /* request not completed */
2024	const auto TIMERR_STRUCT          = (TIMERR_BASE+33)     ; /* time align(2) struct size */
2025	
2026	/* timer data types */
2027	alias void function(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) TIMECALLBACK;
2028	alias TIMECALLBACK *LPTIMECALLBACK;
2029	
2030	/* flags for fuEvent parameter of timeSetEvent() function */
2031	const auto TIME_ONESHOT     = 0x0000   ; /* program timer for single event */
2032	const auto TIME_PERIODIC    = 0x0001   ; /* program for continuous periodic event */
2033	
2034	const auto TIME_CALLBACK_FUNCTION       = 0x0000  ; /* callback is function */
2035	const auto TIME_CALLBACK_EVENT_SET      = 0x0010  ; /* callback is event - use SetEvent */
2036	const auto TIME_CALLBACK_EVENT_PULSE    = 0x0020  ; /* callback is event - use PulseEvent */
2037	
2038	const auto TIME_KILL_SYNCHRONOUS    = 0x0100  ; /* This flag prevents the event from occurring */
2039	                                        /* after the user calls timeKillEvent() to */
2040	                                        /* destroy it. */
2041	
2042	/* timer device capabilities data align(2) structure */
2043	align(2) struct TIMECAPS {
2044	    UINT    wPeriodMin;     /* minimum period supported  */
2045	    UINT    wPeriodMax;     /* maximum period supported  */
2046	}
2047	
2048	alias TIMECAPS* PTIMECAPS;
2049	alias TIMECAPS *NPTIMECAPS;
2050	alias TIMECAPS* LPTIMECAPS;
2051	
2052	/* timer function prototypes */
2053	MMRESULT timeGetSystemTime( LPMMTIME pmmt, UINT cbmmt);
2054	DWORD timeGetTime();
2055	MMRESULT timeSetEvent( UINT uDelay, UINT uResolution,
2056	    LPTIMECALLBACK fptc, DWORD_PTR dwUser, UINT fuEvent);
2057	MMRESULT timeKillEvent( UINT uTimerID);
2058	MMRESULT timeGetDevCaps( LPTIMECAPS ptc, UINT cbtc);
2059	MMRESULT timeBeginPeriod( UINT uPeriod);
2060	MMRESULT timeEndPeriod( UINT uPeriod);
2061}
2062
2063/****************************************************************************
2064
2065                            Joystick support
2066
2067****************************************************************************/
2068version(MMNOJOY) {
2069}
2070else {
2071	/* joystick error return values */
2072	const auto JOYERR_NOERROR         = (0)                  ; /* no error */
2073	const auto JOYERR_PARMS           = (JOYERR_BASE+5)      ; /* bad parameters */
2074	const auto JOYERR_NOCANDO         = (JOYERR_BASE+6)      ; /* request not completed */
2075	const auto JOYERR_UNPLUGGED       = (JOYERR_BASE+7)      ; /* joystick is unplugged */
2076	
2077	/* constants used with JOYINFO and JOYINFOEX align(2) structures and MM_JOY* messages */
2078	const auto JOY_BUTTON1          = 0x0001;
2079	const auto JOY_BUTTON2          = 0x0002;
2080	const auto JOY_BUTTON3          = 0x0004;
2081	const auto JOY_BUTTON4          = 0x0008;
2082	const auto JOY_BUTTON1CHG       = 0x0100;
2083	const auto JOY_BUTTON2CHG       = 0x0200;
2084	const auto JOY_BUTTON3CHG       = 0x0400;
2085	const auto JOY_BUTTON4CHG       = 0x0800;
2086
2087	/* constants used with JOYINFOEX */
2088	const auto JOY_BUTTON5          = 0x00000010;
2089	const auto JOY_BUTTON6          = 0x00000020;
2090	const auto JOY_BUTTON7          = 0x00000040;
2091	const auto JOY_BUTTON8          = 0x00000080;
2092	const auto JOY_BUTTON9          = 0x00000100;
2093	const auto JOY_BUTTON10         = 0x00000200;
2094	const auto JOY_BUTTON11         = 0x00000400;
2095	const auto JOY_BUTTON12         = 0x00000800;
2096	const auto JOY_BUTTON13         = 0x00001000;
2097	const auto JOY_BUTTON14         = 0x00002000;
2098	const auto JOY_BUTTON15         = 0x00004000;
2099	const auto JOY_BUTTON16         = 0x00008000;
2100	const auto JOY_BUTTON17         = 0x00010000;
2101	const auto JOY_BUTTON18         = 0x00020000;
2102	const auto JOY_BUTTON19         = 0x00040000;
2103	const auto JOY_BUTTON20         = 0x00080000;
2104	const auto JOY_BUTTON21         = 0x00100000;
2105	const auto JOY_BUTTON22         = 0x00200000;
2106	const auto JOY_BUTTON23         = 0x00400000;
2107	const auto JOY_BUTTON24         = 0x00800000;
2108	const auto JOY_BUTTON25         = 0x01000000;
2109	const auto JOY_BUTTON26         = 0x02000000;
2110	const auto JOY_BUTTON27         = 0x04000000;
2111	const auto JOY_BUTTON28         = 0x08000000;
2112	const auto JOY_BUTTON29         = 0x10000000;
2113	const auto JOY_BUTTON30         = 0x20000000;
2114	const auto JOY_BUTTON31         = 0x40000000;
2115	const auto JOY_BUTTON32         = 0x80000000;
2116
2117	/* constants used with JOYINFOEX align(2) structure */
2118	const auto JOY_POVCENTERED          = cast(WORD) -1;
2119	const auto JOY_POVFORWARD           = 0;
2120	const auto JOY_POVRIGHT             = 9000;
2121	const auto JOY_POVBACKWARD          = 18000;
2122	const auto JOY_POVLEFT              = 27000;
2123
2124	const auto JOY_RETURNX              = 0x00000001;
2125	const auto JOY_RETURNY              = 0x00000002;
2126	const auto JOY_RETURNZ              = 0x00000004;
2127	const auto JOY_RETURNR              = 0x00000008;
2128	const auto JOY_RETURNU              = 0x00000010     ; /* axis 5 */
2129	const auto JOY_RETURNV              = 0x00000020     ; /* axis 6 */
2130	const auto JOY_RETURNPOV            = 0x00000040;
2131	const auto JOY_RETURNBUTTONS        = 0x00000080;
2132	const auto JOY_RETURNRAWDATA        = 0x00000100;
2133	const auto JOY_RETURNPOVCTS         = 0x00000200;
2134	const auto JOY_RETURNCENTERED       = 0x00000400;
2135	const auto JOY_USEDEADZONE          = 0x00000800;
2136	const auto JOY_RETURNALL            = (JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ |
2137	                                 JOY_RETURNR | JOY_RETURNU | JOY_RETURNV |
2138	                                 JOY_RETURNPOV | JOY_RETURNBUTTONS);
2139	const auto JOY_CAL_READALWAYS       = 0x00010000;
2140	const auto JOY_CAL_READXYONLY       = 0x00020000;
2141	const auto JOY_CAL_READ3            = 0x00040000;
2142	const auto JOY_CAL_READ4            = 0x00080000;
2143	const auto JOY_CAL_READXONLY        = 0x00100000;
2144	const auto JOY_CAL_READYONLY        = 0x00200000;
2145	const auto JOY_CAL_READ5            = 0x00400000;
2146	const auto JOY_CAL_READ6            = 0x00800000;
2147	const auto JOY_CAL_READZONLY        = 0x01000000;
2148	const auto JOY_CAL_READRONLY        = 0x02000000;
2149	const auto JOY_CAL_READUONLY        = 0x04000000;
2150	const auto JOY_CAL_READVONLY        = 0x08000000;
2151
2152	/* joystick ID constants */
2153	const auto JOYSTICKID1          = 0;
2154	const auto JOYSTICKID2          = 1;
2155	
2156	/* joystick driver capabilites */
2157	const auto JOYCAPS_HASZ             = 0x0001;
2158	const auto JOYCAPS_HASR             = 0x0002;
2159	const auto JOYCAPS_HASU             = 0x0004;
2160	const auto JOYCAPS_HASV             = 0x0008;
2161	const auto JOYCAPS_HASPOV           = 0x0010;
2162	const auto JOYCAPS_POV4DIR          = 0x0020;
2163	const auto JOYCAPS_POVCTS           = 0x0040;
2164	
2165	
2166	
2167	/* joystick device capabilities data align(2) structure */
2168	align(2) struct JOYCAPSA {
2169	    WORD    wMid;                /* manufacturer ID */
2170	    WORD    wPid;                /* product ID */
2171	    CHAR[MAXPNAMELEN]    szPname;/* product name (NULL terminated string) */
2172	    UINT    wXmin;               /* minimum x position value */
2173	    UINT    wXmax;               /* maximum x position value */
2174	    UINT    wYmin;               /* minimum y position value */
2175	    UINT    wYmax;               /* maximum y position value */
2176	    UINT    wZmin;               /* minimum z position value */
2177	    UINT    wZmax;               /* maximum z position value */
2178	    UINT    wNumButtons;         /* number of buttons */
2179	    UINT    wPeriodMin;          /* minimum message period when captured */
2180	    UINT    wPeriodMax;          /* maximum message period when captured */
2181
2182	    UINT    wRmin;               /* minimum r position value */
2183	    UINT    wRmax;               /* maximum r position value */
2184	    UINT    wUmin;               /* minimum u (5th axis) position value */
2185	    UINT    wUmax;               /* maximum u (5th axis) position value */
2186	    UINT    wVmin;               /* minimum v (6th axis) position value */
2187	    UINT    wVmax;               /* maximum v (6th axis) position value */
2188	    UINT    wCaps;               /* joystick capabilites */
2189	    UINT    wMaxAxes;            /* maximum number of axes supported */
2190	    UINT    wNumAxes;            /* number of axes in use */
2191	    UINT    wMaxButtons;         /* maximum number of buttons supported */
2192	    CHAR[MAXPNAMELEN]    szRegKey;/* registry key */
2193	    CHAR[MAX_JOYSTICKOEMVXDNAME]    szOEMVxD; /* OEM VxD in use */
2194	}
2195	
2196	alias JOYCAPSA* PJOYCAPSA;
2197	alias JOYCAPSA* NPJOYCAPSA;
2198	alias JOYCAPSA* LPJOYCAPSA;
2199	align(2) struct JOYCAPSW {
2200	    WORD    wMid;                /* manufacturer ID */
2201	    WORD    wPid;                /* product ID */
2202	    WCHAR[MAXPNAMELEN]   szPname;/* product name (NULL terminated string) */
2203	    UINT    wXmin;               /* minimum x position value */
2204	    UINT    wXmax;               /* maximum x position value */
2205	    UINT    wYmin;               /* minimum y position value */
2206	    UINT    wYmax;               /* maximum y position value */
2207	    UINT    wZmin;               /* minimum z position value */
2208	    UINT    wZmax;               /* maximum z position value */
2209	    UINT    wNumButtons;         /* number of buttons */
2210	    UINT    wPeriodMin;          /* minimum message period when captured */
2211	    UINT    wPeriodMax;          /* maximum message period when captured */
2212	
2213	    UINT    wRmin;               /* minimum r position value */
2214	    UINT    wRmax;               /* maximum r position value */
2215	    UINT    wUmin;               /* minimum u (5th axis) position value */
2216	    UINT    wUmax;               /* maximum u (5th axis) position value */
2217	    UINT    wVmin;               /* minimum v (6th axis) position value */
2218	    UINT    wVmax;               /* maximum v (6th axis) position value */
2219	    UINT    wCaps;               /* joystick capabilites */
2220	    UINT    wMaxAxes;            /* maximum number of axes supported */
2221	    UINT    wNumAxes;            /* number of axes in use */
2222	    UINT    wMaxButtons;         /* maximum number of buttons supported */
2223	    WCHAR[MAXPNAMELEN]   szRegKey;/* registry key */
2224	    WCHAR[MAX_JOYSTICKOEMVXDNAME]   szOEMVxD; /* OEM VxD in use */
2225	}
2226	
2227	alias JOYCAPSW* PJOYCAPSW;
2228	alias JOYCAPSW* NPJOYCAPSW;
2229	alias JOYCAPSW* LPJOYCAPSW;
2230	
2231	version(UNICODE) {
2232		alias JOYCAPSW JOYCAPS;
2233		alias PJOYCAPSW PJOYCAPS;
2234		alias NPJOYCAPSW NPJOYCAPS;
2235		alias LPJOYCAPSW LPJOYCAPS;
2236	}
2237	else {
2238		alias JOYCAPSA JOYCAPS;
2239		alias PJOYCAPSA PJOYCAPS;
2240		alias NPJOYCAPSA NPJOYCAPS;
2241		alias LPJOYCAPSA LPJOYCAPS;
2242	}
2243	
2244	align(2) struct JOYCAPS2A {
2245	    WORD    wMid;                /* manufacturer ID */
2246	    WORD    wPid;                /* product ID */
2247	    CHAR[MAXPNAMELEN]    szPname;/* product name (NULL terminated string) */
2248	    UINT    wXmin;               /* minimum x position value */
2249	    UINT    wXmax;               /* maximum x position value */
2250	    UINT    wYmin;               /* minimum y position value */
2251	    UINT    wYmax;               /* maximum y position value */
2252	    UINT    wZmin;               /* minimum z position value */
2253	    UINT    wZmax;               /* maximum z position value */
2254	    UINT    wNumButtons;         /* number of buttons */
2255	    UINT    wPeriodMin;          /* minimum message period when captured */
2256	    UINT    wPeriodMax;          /* maximum message period when captured */
2257	    UINT    wRmin;               /* minimum r position value */
2258	    UINT    wRmax;               /* maximum r position value */
2259	    UINT    wUmin;               /* minimum u (5th axis) position value */
2260	    UINT    wUmax;               /* maximum u (5th axis) position value */
2261	    UINT    wVmin;               /* minimum v (6th axis) position value */
2262	    UINT    wVmax;               /* maximum v (6th axis) position value */
2263	    UINT    wCaps;               /* joystick capabilites */
2264	    UINT    wMaxAxes;            /* maximum number of axes supported */
2265	    UINT    wNumAxes;            /* number of axes in use */
2266	    UINT    wMaxButtons;         /* maximum number of buttons supported */
2267	    CHAR[MAXPNAMELEN]    szRegKey;/* registry key */
2268	    CHAR[MAX_JOYSTICKOEMVXDNAME]    szOEMVxD; /* OEM VxD in use */
2269	    GUID    ManufacturerGuid;    /* for extensible MID mapping */
2270	    GUID    ProductGuid;         /* for extensible PID mapping */
2271	    GUID    NameGuid;            /* for name lookup in registry */
2272	}
2273	
2274	alias JOYCAPS2A* PJOYCAPS2A;
2275	alias JOYCAPS2A* NPJOYCAPS2A;
2276	alias JOYCAPS2A* LPJOYCAPS2A;
2277	align(2) struct JOYCAPS2W {
2278	    WORD    wMid;                /* manufacturer ID */
2279	    WORD    wPid;                /* product ID */
2280	    WCHAR[MAXPNAMELEN]   szPname;/* product name (NULL terminated string) */
2281	    UINT    wXmin;               /* minimum x position value */
2282	    UINT    wXmax;               /* maximum x position value */
2283	    UINT    wYmin;               /* minimum y position value */
2284	    UINT    wYmax;               /* maximum y position value */
2285	    UINT    wZmin;               /* minimum z position value */
2286	    UINT    wZmax;               /* maximum z position value */
2287	    UINT    wNumButtons;         /* number of buttons */
2288	    UINT    wPeriodMin;          /* minimum message period when captured */
2289	    UINT    wPeriodMax;          /* maximum message period when captured */
2290	    UINT    wRmin;               /* minimum r position value */
2291	    UINT    wRmax;               /* maximum r position value */
2292	    UINT    wUmin;               /* minimum u (5th axis) position value */
2293	    UINT    wUmax;               /* maximum u (5th axis) position value */
2294	    UINT    wVmin;               /* minimum v (6th axis) position value */
2295	    UINT    wVmax;               /* maximum v (6th axis) position value */
2296	    UINT    wCaps;               /* joystick capabilites */
2297	    UINT    wMaxAxes;            /* maximum number of axes supported */
2298	    UINT    wNumAxes;            /* number of axes in use */
2299	    UINT    wMaxButtons;         /* maximum number of buttons supported */
2300	    WCHAR[MAXPNAMELEN]   szRegKey;/* registry key */
2301	    WCHAR[MAX_JOYSTICKOEMVXDNAME]   szOEMVxD; /* OEM VxD in use */
2302	    GUID    ManufacturerGuid;    /* for extensible MID mapping */
2303	    GUID    ProductGuid;         /* for extensible PID mapping */
2304	    GUID    NameGuid;            /* for name lookup in registry */
2305	}
2306	
2307	alias JOYCAPS2W* PJOYCAPS2W;
2308	alias JOYCAPS2W* NPJOYCAPS2W;
2309	alias JOYCAPS2W* LPJOYCAPS2W;
2310	
2311	version(UNICODE) {
2312		alias JOYCAPS2W JOYCAPS2;
2313		alias PJOYCAPS2W PJOYCAPS2;
2314		alias NPJOYCAPS2W NPJOYCAPS2;
2315		alias LPJOYCAPS2W LPJOYCAPS2;
2316	}
2317	else {
2318		alias JOYCAPS2A JOYCAPS2;
2319		alias PJOYCAPS2A PJOYCAPS2;
2320		alias NPJOYCAPS2A NPJOYCAPS2;
2321		alias LPJOYCAPS2A LPJOYCAPS2;
2322	}
2323	
2324	/* joystick information data align(2) structure */
2325	align(2) struct JOYINFO {
2326	    UINT wXpos;                 /* x position */
2327	    UINT wYpos;                 /* y position */
2328	    UINT wZpos;                 /* z position */
2329	    UINT wButtons;              /* button states */
2330	}
2331	
2332	alias JOYINFO* PJOYINFO;
2333	alias JOYINFO *NPJOYINFO;
2334	alias JOYINFO* LPJOYINFO;
2335	
2336	align(2) struct JOYINFOEX {
2337	    DWORD dwSize;                /* size of align(2) structure */
2338	    DWORD dwFlags;               /* flags to indicate what to return */
2339	    DWORD dwXpos;                /* x position */
2340	    DWORD dwYpos;                /* y position */
2341	    DWORD dwZpos;                /* z position */
2342	    DWORD dwRpos;                /* rudder/4th axis position */
2343	    DWORD dwUpos;                /* 5th axis position */
2344	    DWORD dwVpos;                /* 6th axis position */
2345	    DWORD dwButtons;             /* button states */
2346	    DWORD dwButtonNumber;        /* current button number pressed */
2347	    DWORD dwPOV;                 /* point of view state */
2348	    DWORD dwReserved1;           /* reserved for communication between winmm & driver */
2349	    DWORD dwReserved2;           /* reserved for future expansion */
2350	}
2351	
2352	alias JOYINFOEX* PJOYINFOEX;
2353	alias JOYINFOEX *NPJOYINFOEX;
2354	alias JOYINFOEX* LPJOYINFOEX;
2355	
2356	/* joystick function prototypes */
2357	UINT joyGetNumDevs();
2358	
2359	MMRESULT joyGetDevCapsA( UINT_PTR uJoyID, LPJOYCAPSA pjc, UINT cbjc);
2360	MMRESULT joyGetDevCapsW( UINT_PTR uJoyID, LPJOYCAPSW pjc, UINT cbjc);
2361	
2362	version(UNICODE) {
2363		alias joyGetDevCapsW joyGetDevCaps;
2364	}
2365	else {
2366		alias joyGetDevCapsA joyGetDevCaps;
2367	}
2368
2369	MMRESULT joyGetPosEx( UINT uJoyID, LPJOYINFOEX pji);
2370
2371	MMRESULT joyGetThreshold( UINT uJoyID, LPUINT puThreshold);
2372	MMRESULT joyReleaseCapture( UINT uJoyID);
2373	MMRESULT joySetCapture( HWND hwnd, UINT uJoyID, UINT uPeriod,
2374	    BOOL fChanged);
2375	MMRESULT joySetThreshold( UINT uJoyID, UINT uThreshold);
2376}
2377
2378/****************************************************************************
2379
2380                        Multimedia File I/O support
2381
2382****************************************************************************/
2383version(MMNOMMIO) {
2384}
2385else {
2386	/* MMIO error return values */
2387	const auto MMIOERR_BASE                 = 256;
2388	const auto MMIOERR_FILENOTFOUND         = (MMIOERR_BASE + 1)  ; /* file not found */
2389	const auto MMIOERR_OUTOFMEMORY          = (MMIOERR_BASE + 2)  ; /* out of memory */
2390	const auto MMIOERR_CANNOTOPEN           = (MMIOERR_BASE + 3)  ; /* cannot open */
2391	const auto MMIOERR_CANNOTCLOSE          = (MMIOERR_BASE + 4)  ; /* cannot close */
2392	const auto MMIOERR_CANNOTREAD           = (MMIOERR_BASE + 5)  ; /* cannot read */
2393	const auto MMIOERR_CANNOTWRITE          = (MMIOERR_BASE + 6)  ; /* cannot write */
2394	const auto MMIOERR_CANNOTSEEK           = (MMIOERR_BASE + 7)  ; /* cannot seek */
2395	const auto MMIOERR_CANNOTEXPAND         = (MMIOERR_BASE + 8)  ; /* cannot expand file */
2396	const auto MMIOERR_CHUNKNOTFOUND        = (MMIOERR_BASE + 9)  ; /* chunk not found */
2397	const auto MMIOERR_UNBUFFERED           = (MMIOERR_BASE + 10) ; /*  */
2398	const auto MMIOERR_PATHNOTFOUND         = (MMIOERR_BASE + 11) ; /* path incorrect */
2399	const auto MMIOERR_ACCESSDENIED         = (MMIOERR_BASE + 12) ; /* file was protected */
2400	const auto MMIOERR_SHARINGVIOLATION     = (MMIOERR_BASE + 13) ; /* file in use */
2401	const auto MMIOERR_NETWORKERROR         = (MMIOERR_BASE + 14) ; /* network not responding */
2402	const auto MMIOERR_TOOMANYOPENFILES     = (MMIOERR_BASE + 15) ; /* no more file handles  */
2403	const auto MMIOERR_INVALIDFILE          = (MMIOERR_BASE + 16) ; /* default error file error */
2404	
2405	/* MMIO constants */
2406	const auto CFSEPCHAR        = '+'             ; /* compound file name separator char. */
2407	
2408	/* MMIO data types */
2409	alias DWORD           FOURCC;         /* a four character code */
2410	alias char*    HPSTR;                 /* a huge version of LPSTR */
2411	alias HANDLE HMMIO;                   /* a handle to an open file */
2412	
2413	alias LRESULT function(LPSTR lpmmioinfo, UINT uMsg,
2414	            LPARAM lParam1, LPARAM lParam2) MMIOPROC;
2415	alias MMIOPROC *LPMMIOPROC;
2416
2417	/* general MMIO information data align(2) structure */
2418	align(2) struct MMIOINFO {
2419	        /* general fields */
2420	        DWORD           dwFlags;        /* general status flags */
2421	        FOURCC          fccIOProc;      /* pointer to I/O procedure */
2422	        LPMMIOPROC      pIOProc;        /* pointer to I/O procedure */
2423	        UINT            wErrorRet;      /* place for error to be returned */
2424	        HTASK           htask;          /* alternate local task */
2425	
2426	        /* fields maintained by MMIO functions during buffered I/O */
2427	        LONG            cchBuffer;      /* size of I/O buffer (or 0L) */
2428	        HPSTR           pchBuffer;      /* start of I/O buffer (or NULL) */
2429	        HPSTR           pchNext;        /* pointer to next byte to read/write */
2430	        HPSTR           pchEndRead;     /* pointer to last valid byte to read */
2431	        HPSTR           pchEndWrite;    /* pointer to last byte to write */
2432	        LONG            lBufOffset;     /* disk offset of start of buffer */
2433	
2434	        /* fields maintained by I/O procedure */
2435	        LONG            lDiskOffset;    /* disk offset of next read or write */
2436	        DWORD[3]           adwInfo;     /* data specific to type of MMIOPROC */
2437	
2438	        /* other fields maintained by MMIO */
2439	        DWORD           dwReserved1;    /* reserved for MMIO use */
2440	        DWORD           dwReserved2;    /* reserved for MMIO use */
2441	        HMMIO           hmmio;          /* handle to open file */
2442	}
2443	
2444	alias MMIOINFO* PMMIOINFO;
2445	alias MMIOINFO *NPMMIOINFO;
2446	alias MMIOINFO* LPMMIOINFO;
2447	alias MMIOINFO *LPCMMIOINFO;
2448	
2449	/* RIFF chunk information data align(2) structure */
2450	align(2) struct MMCKINFO {
2451	        FOURCC          ckid;           /* chunk ID */
2452	        DWORD           cksize;         /* chunk size */
2453	        FOURCC          fccType;        /* form type or list type */
2454	        DWORD           dwDataOffset;   /* offset of data portion of chunk */
2455	        DWORD           dwFlags;        /* flags used by MMIO functions */
2456	}
2457	
2458	alias MMCKINFO* PMMCKINFO;
2459	alias MMCKINFO *NPMMCKINFO;
2460	alias MMCKINFO* LPMMCKINFO;
2461	alias MMCKINFO *LPCMMCKINFO;
2462	
2463	/* bit field masks */
2464	const auto MMIO_RWMODE      = 0x00000003      ; /* open file for reading/writing/both */
2465	const auto MMIO_SHAREMODE   = 0x00000070      ; /* file sharing mode number */
2466	
2467	/* constants for dwFlags field of MMIOINFO */
2468	const auto MMIO_CREATE      = 0x00001000      ; /* create new file (or truncate file) */
2469	const auto MMIO_PARSE       = 0x00000100      ; /* parse new file returning path */
2470	const auto MMIO_DELETE      = 0x00000200      ; /* create new file (or truncate file) */
2471	const auto MMIO_EXIST       = 0x00004000      ; /* checks for existence of file */
2472	const auto MMIO_ALLOCBUF    = 0x00010000      ; /* mmioOpen() should allocate a buffer */
2473	const auto MMIO_GETTEMP     = 0x00020000      ; /* mmioOpen() should retrieve temp name */
2474	
2475	const auto MMIO_DIRTY       = 0x10000000      ; /* I/O buffer is dirty */
2476	
2477	
2478	/* read/write mode numbers (bit field MMIO_RWMODE) */
2479	const auto MMIO_READ        = 0x00000000      ; /* open file for reading only */
2480	const auto MMIO_WRITE       = 0x00000001      ; /* open file for writing only */
2481	const auto MMIO_READWRITE   = 0x00000002      ; /* open file for reading and writing */
2482	
2483	/* share mode numbers (bit field MMIO_SHAREMODE) */
2484	const auto MMIO_COMPAT      = 0x00000000      ; /* compatibility mode */
2485	const auto MMIO_EXCLUSIVE   = 0x00000010      ; /* exclusive-access mode */
2486	const auto MMIO_DENYWRITE   = 0x00000020      ; /* deny writing to other processes */
2487	const auto MMIO_DENYREAD    = 0x00000030      ; /* deny reading to other processes */
2488	const auto MMIO_DENYNONE    = 0x00000040      ; /* deny nothing to other processes */
2489	
2490	/* various MMIO flags */
2491	const auto MMIO_FHOPEN              = 0x0010  ; /* mmioClose: keep file handle open */
2492	const auto MMIO_EMPTYBUF            = 0x0010  ; /* mmioFlush: empty the I/O buffer */
2493	const auto MMIO_TOUPPER             = 0x0010  ; /* mmioStringToFOURCC: to u-case */
2494	const auto MMIO_INSTALLPROC     = 0x00010000  ; /* mmioInstallIOProc: install MMIOProc */
2495	const auto MMIO_GLOBALPROC      = 0x10000000  ; /* mmioInstallIOProc: install globally */
2496	const auto MMIO_REMOVEPROC      = 0x00020000  ; /* mmioInstallIOProc: remove MMIOProc */
2497	const auto MMIO_UNICODEPROC     = 0x01000000  ; /* mmioInstallIOProc: Unicode MMIOProc */
2498	const auto MMIO_FINDPROC        = 0x00040000  ; /* mmioInstallIOProc: find an MMIOProc */
2499	const auto MMIO_FINDCHUNK           = 0x0010  ; /* mmioDescend: find a chunk by ID */
2500	const auto MMIO_FINDRIFF            = 0x0020  ; /* mmioDescend: find a LIST chunk */
2501	const auto MMIO_FINDLIST            = 0x0040  ; /* mmioDescend: find a RIFF chunk */
2502	const auto MMIO_CREATERIFF          = 0x0020  ; /* mmioCreateChunk: make a LIST chunk */
2503	const auto MMIO_CREATELIST          = 0x0040  ; /* mmioCreateChunk: make a RIFF chunk */
2504	
2505	
2506	/* message numbers for MMIOPROC I/O procedure functions */
2507	const auto MMIOM_READ       = MMIO_READ       ; /* read */
2508	const auto MMIOM_WRITE     = MMIO_WRITE       ; /* write */
2509	const auto MMIOM_SEEK               = 2       ; /* seek to a new position in file */
2510	const auto MMIOM_OPEN               = 3       ; /* open file */
2511	const auto MMIOM_CLOSE              = 4       ; /* close file */
2512	const auto MMIOM_WRITEFLUSH         = 5       ; /* write and flush */
2513	
2514	const auto MMIOM_RENAME             = 6       ; /* rename specified file */
2515	
2516	const auto MMIOM_USER          = 0x8000       ; /* beginning of user-defined messages */
2517	
2518	/* MMIO macros */
2519	template mmioFOURCC(char ch0, char ch1, char ch2, char ch3) {
2520		const auto mmioFOURCC = MAKEFOURCC!(ch0,ch1,ch2,ch3);
2521	}
2522	
2523	/* standard four character codes */
2524	const auto FOURCC_RIFF      = mmioFOURCC!('R', 'I', 'F', 'F');
2525	const auto FOURCC_LIST      = mmioFOURCC!('L', 'I', 'S', 'T');
2526
2527	/* four character codes used to identify standard built-in I/O procedures */
2528	const auto FOURCC_DOS       = mmioFOURCC!('D', 'O', 'S', ' ');
2529	const auto FOURCC_MEM       = mmioFOURCC!('M', 'E', 'M', ' ');
2530	
2531	/* flags for mmioSeek() */
2532	const auto SEEK_SET         = 0               ; /* seek to an absolute position */
2533	const auto SEEK_CUR         = 1               ; /* seek relative to current position */
2534	const auto SEEK_END         = 2               ; /* seek relative to end of file */
2535	
2536	/* other constants */
2537	const auto MMIO_DEFAULTBUFFER       = 8192    ; /* default buffer size */
2538
2539	/* MMIO function prototypes */
2540	FOURCC mmioStringToFOURCCA( LPCSTR sz, UINT uFlags);
2541	FOURCC mmioStringToFOURCCW( LPCWSTR sz, UINT uFlags);
2542	
2543	version(UNICODE) {
2544		alias mmioStringToFOURCCW mmioStringToFOURCC;
2545	}
2546	else {
2547		alias mmioStringToFOURCCA mmioStringToFOURCC;
2548	}
2549	
2550	LPMMIOPROC mmioInstallIOProcA( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags);
2551	LPMMIOPROC mmioInstallIOProcW( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags);
2552	
2553	version(UNICODE) {
2554		alias mmioInstallIOProcW mmioInstallIOProc;
2555	}
2556	else {
2557		alias mmioInstallIOProcA mmioInstallIOProc;
2558	}
2559	
2560	HMMIO mmioOpenA( LPSTR pszFileName,  LPMMIOINFO pmmioinfo,  DWORD fdwOpen);
2561	HMMIO mmioOpenW( LPWSTR pszFileName,  LPMMIOINFO pmmioinfo,  DWORD fdwOpen);
2562	
2563	version(UNICODE) {
2564		alias mmioOpenW mmioOpen;
2565	}
2566	else {
2567		alias mmioOpenA mmioOpen;
2568	}
2569	MMRESULT mmioRenameA( LPCSTR pszFileName, LPCSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename);
2570	MMRESULT mmioRenameW( LPCWSTR pszFileName, LPCWSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename);
2571	
2572	version(UNICODE) {
2573		alias mmioRenameW mmioRename;
2574	}
2575	else {
2576		alias mmioRenameA mmioRename;
2577	}
2578	
2579	MMRESULT mmioClose( HMMIO hmmio, UINT fuClose);
2580	LONG mmioRead( HMMIO hmmio, HPSTR pch, LONG cch);
2581	LONG mmioWrite( HMMIO hmmio, char* pch, LONG cch);
2582	LONG mmioSeek( HMMIO hmmio, LONG lOffset, int iOrigin);
2583	MMRESULT mmioGetInfo( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuInfo);
2584	MMRESULT mmioSetInfo( HMMIO hmmio, LPCMMIOINFO pmmioinfo, UINT fuInfo);
2585	MMRESULT mmioSetBuffer( HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer,
2586	    UINT fuBuffer);
2587	MMRESULT mmioFlush( HMMIO hmmio, UINT fuFlush);
2588	MMRESULT mmioAdvance( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuAdvance);
2589	LRESULT mmioSendMessage( HMMIO hmmio, UINT uMsg,
2590	    LPARAM lParam1, LPARAM lParam2);
2591	MMRESULT mmioDescend( HMMIO hmmio, LPMMCKINFO pmmcki,
2592	    MMCKINFO* pmmckiParent, UINT fuDescend);
2593	MMRESULT mmioAscend( HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuAscend);
2594	MMRESULT mmioCreateChunk(HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuCreate);
2595}
2596
2597/****************************************************************************
2598
2599                            MCI support
2600
2601****************************************************************************/
2602version(MMNOMCI) {
2603}
2604else {
2605	alias DWORD   MCIERROR;       /* error return code, 0 means no error */
2606	alias UINT    MCIDEVICEID;    /* MCI device ID type */
2607	
2608	alias UINT function(MCIDEVICEID mciId, DWORD dwYieldData) YIELDPROC;
2609	
2610	/* MCI function prototypes */
2611	MCIERROR mciSendCommandA( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
2612	MCIERROR mciSendCommandW( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
2613	
2614	version(UNICODE) {
2615		alias mciSendCommandW mciSendCommand;
2616	}
2617	else {
2618		alias mciSendCommandA mciSendCommand;
2619	}
2620	
2621	MCIERROR  mciSendStringA( LPCSTR lpstrCommand, LPSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback);
2622	MCIERROR  mciSendStringW( LPCWSTR lpstrCommand, LPWSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback);
2623	
2624	version(UNICODE) {
2625		alias mciSendStringW mciSendString;
2626	}
2627	else {
2628		alias mciSendStringA mciSendString;
2629	}
2630	
2631	MCIDEVICEID mciGetDeviceIDA( LPCSTR pszDevice);
2632	MCIDEVICEID mciGetDeviceIDW( LPCWSTR pszDevice);
2633	
2634	version(UNICODE) {
2635		alias mciGetDeviceIDW mciGetDeviceID;
2636	}
2637	else {
2638		alias mciGetDeviceIDA mciGetDeviceID;
2639	}
2640	
2641	MCIDEVICEID mciGetDeviceIDFromElementIDA( DWORD dwElementID, LPCSTR lpstrType );
2642	MCIDEVICEID mciGetDeviceIDFromElementIDW( DWORD dwElementID, LPCWSTR lpstrType );
2643	
2644	version(UNICODE) {
2645		alias mciGetDeviceIDFromElementIDW mciGetDeviceIDFromElementID;
2646	}
2647	else {
2648		alias mciGetDeviceIDFromElementIDA mciGetDeviceIDFromElementID;
2649	}
2650	
2651	BOOL mciGetErrorStringA( MCIERROR mcierr, LPSTR pszText, UINT cchText);
2652	BOOL mciGetErrorStringW( MCIERROR mcierr, LPWSTR pszText, UINT cchText);
2653	
2654	version(UNICODE) {
2655		alias mciGetErrorStringW mciGetErrorString;
2656	}
2657	else {
2658		alias mciGetErrorStringA mciGetErrorString;
2659	}
2660	
2661	BOOL mciSetYieldProc( MCIDEVICEID mciId, YIELDPROC fpYieldProc,
2662	    DWORD dwYieldData);
2663	
2664	HTASK mciGetCreatorTask( MCIDEVICEID mciId);
2665	YIELDPROC mciGetYieldProc( MCIDEVICEID mciId, LPDWORD pdwYieldData);
2666	
2667	BOOL mciExecute(LPCSTR pszCommand);
2668	
2669	/* MCI error return values */
2670	const auto MCIERR_INVALID_DEVICE_ID         = (MCIERR_BASE + 1);
2671	const auto MCIERR_UNRECOGNIZED_KEYWORD      = (MCIERR_BASE + 3);
2672	const auto MCIERR_UNRECOGNIZED_COMMAND      = (MCIERR_BASE + 5);
2673	const auto MCIERR_HARDWARE                  = (MCIERR_BASE + 6);
2674	const auto MCIERR_INVALID_DEVICE_NAME       = (MCIERR_BASE + 7);
2675	const auto MCIERR_OUT_OF_MEMORY             = (MCIERR_BASE + 8);
2676	const auto MCIERR_DEVICE_OPEN               = (MCIERR_BASE + 9);
2677	const auto MCIERR_CANNOT_LOAD_DRIVER        = (MCIERR_BASE + 10);
2678	const auto MCIERR_MISSING_COMMAND_STRING    = (MCIERR_BASE + 11);
2679	const auto MCIERR_PARAM_OVERFLOW            = (MCIERR_BASE + 12);
2680	const auto MCIERR_MISSING_STRING_ARGUMENT   = (MCIERR_BASE + 13);
2681	const auto MCIERR_BAD_INTEGER               = (MCIERR_BASE + 14);
2682	const auto MCIERR_PARSER_INTERNAL           = (MCIERR_BASE + 15);
2683	const auto MCIERR_DRIVER_INTERNAL           = (MCIERR_BASE + 16);
2684	const auto MCIERR_MISSING_PARAMETER         = (MCIERR_BASE + 17);
2685	const auto MCIERR_UNSUPPORTED_FUNCTION      = (MCIERR_BASE + 18);
2686	const auto MCIERR_FILE_NOT_FOUND            = (MCIERR_BASE + 19);
2687	const auto MCIERR_DEVICE_NOT_READY          = (MCIERR_BASE + 20);
2688	const auto MCIERR_INTERNAL                  = (MCIERR_BASE + 21);
2689	const auto MCIERR_DRIVER                    = (MCIERR_BASE + 22);
2690	const auto MCIERR_CANNOT_USE_ALL            = (MCIERR_BASE + 23);
2691	const auto MCIERR_MULTIPLE                  = (MCIERR_BASE + 24);
2692	const auto MCIERR_EXTENSION_NOT_FOUND       = (MCIERR_BASE + 25);
2693	const auto MCIERR_OUTOFRANGE                = (MCIERR_BASE + 26);
2694	const auto MCIERR_FLAGS_NOT_COMPATIBLE      = (MCIERR_BASE + 28);
2695	const auto MCIERR_FILE_NOT_SAVED            = (MCIERR_BASE + 30);
2696	const auto MCIERR_DEVICE_TYPE_REQUIRED      = (MCIERR_BASE + 31);
2697	const auto MCIERR_DEVICE_LOCKED             = (MCIERR_BASE + 32);
2698	const auto MCIERR_DUPLICATE_ALIAS           = (MCIERR_BASE + 33);
2699	const auto MCIERR_BAD_CONSTANT              = (MCIERR_BASE + 34);
2700	const auto MCIERR_MUST_USE_SHAREABLE        = (MCIERR_BASE + 35);
2701	const auto MCIERR_MISSING_DEVICE_NAME       = (MCIERR_BASE + 36);
2702	const auto MCIERR_BAD_TIME_FORMAT           = (MCIERR_BASE + 37);
2703	const auto MCIERR_NO_CLOSING_QUOTE          = (MCIERR_BASE + 38);
2704	const auto MCIERR_DUPLICATE_FLAGS           = (MCIERR_BASE + 39);
2705	const auto MCIERR_INVALID_FILE              = (MCIERR_BASE + 40);
2706	const auto MCIERR_NULL_PARAMETER_BLOCK      = (MCIERR_BASE + 41);
2707	const auto MCIERR_UNNAMED_RESOURCE          = (MCIERR_BASE + 42);
2708	const auto MCIERR_NEW_REQUIRES_ALIAS        = (MCIERR_BASE + 43);
2709	const auto MCIERR_NOTIFY_ON_AUTO_OPEN       = (MCIERR_BASE + 44);
2710	const auto MCIERR_NO_ELEMENT_ALLOWED        = (MCIERR_BASE + 45);
2711	const auto MCIERR_NONAPPLICABLE_FUNCTION    = (MCIERR_BASE + 46);
2712	const auto MCIERR_ILLEGAL_FOR_AUTO_OPEN     = (MCIERR_BASE + 47);
2713	const auto MCIERR_FILENAME_REQUIRED         = (MCIERR_BASE + 48);
2714	const auto MCIERR_EXTRA_CHARACTERS          = (MCIERR_BASE + 49);
2715	const auto MCIERR_DEVICE_NOT_INSTALLED      = (MCIERR_BASE + 50);
2716	const auto MCIERR_GET_CD                    = (MCIERR_BASE + 51);
2717	const auto MCIERR_SET_CD                    = (MCIERR_BASE + 52);
2718	const auto MCIERR_SET_DRIVE                 = (MCIERR_BASE + 53);
2719	const auto MCIERR_DEVICE_LENGTH             = (MCIERR_BASE + 54);
2720	const auto MCIERR_DEVICE_ORD_LENGTH         = (MCIERR_BASE + 55);
2721	const auto MCIERR_NO_INTEGER                = (MCIERR_BASE + 56);
2722	
2723	const auto MCIERR_WAVE_OUTPUTSINUSE         = (MCIERR_BASE + 64);
2724	const auto MCIERR_WAVE_SETOUTPUTINUSE       = (MCIERR_BASE + 65);
2725	const auto MCIERR_WAVE_INPUTSINUSE          = (MCIERR_BASE + 66);
2726	const auto MCIERR_WAVE_SETINPUTINUSE        = (MCIERR_BASE + 67);
2727	const auto MCIERR_WAVE_OUTPUTUNSPECIFIED    = (MCIERR_BASE + 68);
2728	const auto MCIERR_WAVE_INPUTUNSPECIFIED     = (MCIERR_BASE + 69);
2729	const auto MCIERR_WAVE_OUTPUTSUNSUITABLE    = (MCIERR_BASE + 70);
2730	const auto MCIERR_WAVE_SETOUTPUTUNSUITABLE  = (MCIERR_BASE + 71);
2731	const auto MCIERR_WAVE_INPUTSUNSUITABLE     = (MCIERR_BASE + 72);
2732	const auto MCIERR_WAVE_SETINPUTUNSUITABLE   = (MCIERR_BASE + 73);
2733	
2734	const auto MCIERR_SEQ_DIV_INCOMPATIBLE      = (MCIERR_BASE + 80);
2735	const auto MCIERR_SEQ_PORT_INUSE            = (MCIERR_BASE + 81);
2736	const auto MCIERR_SEQ_PORT_NONEXISTENT      = (MCIERR_BASE + 82);
2737	const auto MCIERR_SEQ_PORT_MAPNODEVICE      = (MCIERR_BASE + 83);
2738	const auto MCIERR_SEQ_PORT_MISCERROR        = (MCIERR_BASE + 84);
2739	const auto MCIERR_SEQ_TIMER                 = (MCIERR_BASE + 85);
2740	const auto MCIERR_SEQ_PORTUNSPECIFIED       = (MCIERR_BASE + 86);
2741	const auto MCIERR_SEQ_NOMIDIPRESENT         = (MCIERR_BASE + 87);
2742	
2743	const auto MCIERR_NO_WINDOW                 = (MCIERR_BASE + 90);
2744	const auto MCIERR_CREATEWINDOW              = (MCIERR_BASE + 91);
2745	const auto MCIERR_FILE_READ                 = (MCIERR_BASE + 92);
2746	const auto MCIERR_FILE_WRITE                = (MCIERR_BASE + 93);
2747	
2748	const auto MCIERR_NO_IDENTITY               = (MCIERR_BASE + 94);
2749	
2750	/* all custom device driver errors must be >= than this value */
2751	const auto MCIERR_CUSTOM_DRIVER_BASE        = (MCIERR_BASE + 256);
2752
2753	const auto MCI_FIRST                        = DRV_MCI_FIRST   ; /* 0x0800 */
2754	/* MCI command message identifiers */
2755	const auto MCI_OPEN                         = 0x0803;
2756	const auto MCI_CLOSE                        = 0x0804;
2757	const auto MCI_ESCAPE                       = 0x0805;
2758	const auto MCI_PLAY                         = 0x0806;
2759	const auto MCI_SEEK                         = 0x0807;
2760	const auto MCI_STOP                         = 0x0808;
2761	const auto MCI_PAUSE                        = 0x0809;
2762	const auto MCI_INFO                         = 0x080A;
2763	const auto MCI_GETDEVCAPS                   = 0x080B;
2764	const auto MCI_SPIN                         = 0x080C;
2765	const auto MCI_SET                          = 0x080D;
2766	const auto MCI_STEP                         = 0x080E;
2767	const auto MCI_RECORD                       = 0x080F;
2768	const auto MCI_SYSINFO                      = 0x0810;
2769	const auto MCI_BREAK                        = 0x0811;
2770	const auto MCI_SAVE                         = 0x0813;
2771	const auto MCI_STATUS                       = 0x0814;
2772	const auto MCI_CUE                          = 0x0830;
2773	const auto MCI_REALIZE                      = 0x0840;
2774	const auto MCI_WINDOW                       = 0x0841;
2775	const auto MCI_PUT                          = 0x0842;
2776	const auto MCI_WHERE                        = 0x0843;
2777	const auto MCI_FREEZE                       = 0x0844;
2778	const auto MCI_UNFREEZE                     = 0x0845;
2779	const auto MCI_LOAD                         = 0x0850;
2780	const auto MCI_CUT                          = 0x0851;
2781	const auto MCI_COPY                         = 0x0852;
2782	const auto MCI_PASTE                        = 0x0853;
2783	const auto MCI_UPDATE                       = 0x0854;
2784	const auto MCI_RESUME                       = 0x0855;
2785	const auto MCI_DELETE                       = 0x0856;
2786	
2787	/* all custom MCI command messages must be >= than this value */
2788	const auto MCI_USER_MESSAGES                = (DRV_MCI_FIRST + 0x400);
2789	const auto MCI_LAST                         = 0x0FFF;
2790	
2791	
2792	/* device ID for "all devices" */
2793	const auto MCI_ALL_DEVICE_ID                = (cast(MCIDEVICEID)-1);
2794	
2795	/* constants for predefined MCI device types */
2796	const auto MCI_DEVTYPE_VCR                  = 513 ; /* (MCI_STRING_OFFSET + 1) */
2797	const auto MCI_DEVTYPE_VIDEODISC            = 514 ; /* (MCI_STRING_OFFSET + 2) */
2798	const auto MCI_DEVTYPE_OVERLAY              = 515 ; /* (MCI_STRING_OFFSET + 3) */
2799	const auto MCI_DEVTYPE_CD_AUDIO             = 516 ; /* (MCI_STRING_OFFSET + 4) */
2800	const auto MCI_DEVTYPE_DAT                  = 517 ; /* (MCI_STRING_OFFSET + 5) */
2801	const auto MCI_DEVTYPE_SCANNER              = 518 ; /* (MCI_STRING_OFFSET + 6) */
2802	const auto MCI_DEVTYPE_ANIMATION            = 519 ; /* (MCI_STRING_OFFSET + 7) */
2803	const auto MCI_DEVTYPE_DIGITAL_VIDEO        = 520 ; /* (MCI_STRING_OFFSET + 8) */
2804	const auto MCI_DEVTYPE_OTHER                = 521 ; /* (MCI_STRING_OFFSET + 9) */
2805	const auto MCI_DEVTYPE_WAVEFORM_AUDIO       = 522 ; /* (MCI_STRING_OFFSET + 10) */
2806	const auto MCI_DEVTYPE_SEQUENCER            = 523 ; /* (MCI_STRING_OFFSET + 11) */
2807	
2808	const auto MCI_DEVTYPE_FIRST                = MCI_DEVTYPE_VCR;
2809	const auto MCI_DEVTYPE_LAST                 = MCI_DEVTYPE_SEQUENCER;
2810	
2811	const auto MCI_DEVTYPE_FIRST_USER           = 0x1000;
2812	/* return values for 'status mode' command */
2813	const auto MCI_MODE_NOT_READY               = (MCI_STRING_OFFSET + 12);
2814	const auto MCI_MODE_STOP                    = (MCI_STRING_OFFSET + 13);
2815	const auto MCI_MODE_PLAY                    = (MCI_STRING_OFFSET + 14);
2816	const auto MCI_MODE_RECORD                  = (MCI_STRING_OFFSET + 15);
2817	const auto MCI_MODE_SEEK                    = (MCI_STRING_OFFSET + 16);
2818	const auto MCI_MODE_PAUSE                   = (MCI_STRING_OFFSET + 17);
2819	const auto MCI_MODE_OPEN                    = (MCI_STRING_OFFSET + 18);
2820	
2821	/* constants used in 'set time format' and 'status time format' commands */
2822	const auto MCI_FORMAT_MILLISECONDS          = 0;
2823	const auto MCI_FORMAT_HMS                   = 1;
2824	const auto MCI_FORMAT_MSF                   = 2;
2825	const auto MCI_FORMAT_FRAMES                = 3;
2826	const auto MCI_FORMAT_SMPTE_24              = 4;
2827	const auto MCI_FORMAT_SMPTE_25              = 5;
2828	const auto MCI_FORMAT_SMPTE_30              = 6;
2829	const auto MCI_FORMAT_SMPTE_30DROP          = 7;
2830	const auto MCI_FORMAT_BYTES                 = 8;
2831	const auto MCI_FORMAT_SAMPLES               = 9;
2832	const auto MCI_FORMAT_TMSF                  = 10;
2833	
2834	/* MCI time format conversion macros */
2835	template MCI_MSF_MINUTE(T) {
2836		BYTE MCI_MSF_MINUTE(T msf) {
2837			return cast(BYTE)(msf);
2838		}
2839	}
2840	template MCI_MSF_SECOND(T) {
2841		BYTE MCI_MSF_SECOND(T msf) {
2842			return (cast(BYTE)((cast(WORD)(msf)) >> 8));
2843		}
2844	}
2845	template MCI_MSF_FRAME(T) {
2846		BYTE MCI_MSF_FRAME(T msf) {
2847			return (cast(BYTE)(msf >> 16));
2848		}
2849	}
2850
2851	template MCI_MAKE_MSF(T, R, S) {
2852		DWORD MCI_MAKE_MSF(T m, R s, S f) {
2853			return (cast(DWORD)((cast(BYTE)(m) |
2854	                       (cast(WORD)(s)<<8)) |
2855	                       ((cast(DWORD)cast(BYTE)(f))<<16)));
2856		}
2857	}
2858	
2859	template MCI_TMSF_TRACK(T) {
2860		BYTE MCI_TMSF_TRACK(T tmsf) {
2861			return cast(BYTE)tmsf;
2862		}
2863	}
2864	template MCI_TMSF_MINUTE(T) {
2865		BYTE MCI_TMSF_MINUTE(T tmsf) {
2866			return (cast(BYTE)((cast(WORD)(tmsf)) >> 8));
2867		}
2868	}
2869	template MCI_TMSF_SECOND(T) {
2870		BYTE MCI_TMSF_SECOND(T tmsf) {
2871			return (cast(BYTE)(tmsf >> 16));
2872		}
2873	}
2874	template MCI_TMSF_FRAME(T) {
2875		BYTE MCI_TMSF_FRAME(T tmsf) {
2876			return (cast(BYTE)(tmsf >> 24));
2877		}
2878	}
2879	
2880	template MCI_MAKE_TMSF(T, R, S, Q) {
2881		DWORD MCI_MAKE_TMSF(T t, R m, S s, Q f) {
2882			return (cast(DWORD)((cast(BYTE)(t) |
2883	                       (cast(WORD)(m)<<8)) |
2884	                ((cast(DWORD)cast(BYTE)(s) |
2885	                (cast(WORD)(f)<<8))<<16)));
2886		}
2887	}
2888
2889	template MCI_HMS_HOUR(T) {
2890		BYTE MCI_HMS_HOUR(T tmsf) {
2891			return cast(BYTE)hms;
2892		}
2893	}
2894	template MCI_HMS_MINUTE(T) {
2895		BYTE MCI_HMS_MINUTE(T hms) {
2896			return (cast(BYTE)((cast(WORD)(tmsf)) >> 8));
2897		}
2898	}
2899	template MCI_HMS_SECOND(T) {
2900		BYTE MCI_HMS_SECOND(T hms) {
2901			return (cast(BYTE)(tmsf >> 16));
2902		}
2903	}
2904
2905	template MCI_MAKE_HMS(T, R, S) {
2906		DWORD MCI_MAKE_HMS(T h, R m, S s) {
2907			return MCI_MAKE_MSF(h,m,s);
2908		}
2909	}
2910	
2911	/* flags for wParam of MM_MCINOTIFY message */
2912	const auto MCI_NOTIFY_SUCCESSFUL            = 0x0001;
2913	const auto MCI_NOTIFY_SUPERSEDED            = 0x0002;
2914	const auto MCI_NOTIFY_ABORTED               = 0x0004;
2915	const auto MCI_NOTIFY_FAILURE               = 0x0008;
2916	
2917	
2918	/* common flags for dwFlags parameter of MCI command messages */
2919	const auto MCI_NOTIFY                       = 0x00000001L;
2920	const auto MCI_WAIT                         = 0x00000002L;
2921	const auto MCI_FROM                         = 0x00000004L;
2922	const auto MCI_TO                           = 0x00000008L;
2923	const auto MCI_TRACK                        = 0x00000010L;
2924	
2925	/* flags for dwFlags parameter of MCI_OPEN command message */
2926	const auto MCI_OPEN_SHAREABLE               = 0x00000100L;
2927	const auto MCI_OPEN_ELEMENT                 = 0x00000200L;
2928	const auto MCI_OPEN_ALIAS                   = 0x00000400L;
2929	const auto MCI_OPEN_ELEMENT_ID              = 0x00000800L;
2930	const auto MCI_OPEN_TYPE_ID                 = 0x00001000L;
2931	const auto MCI_OPEN_TYPE                    = 0x00002000L;
2932	
2933	/* flags for dwFlags parameter of MCI_SEEK command message */
2934	const auto MCI_SEEK_TO_START                = 0x00000100L;
2935	const auto MCI_SEEK_TO_END                  = 0x00000200L;
2936	
2937	/* flags for dwFlags parameter of MCI_STATUS command message */
2938	const auto MCI_STATUS_ITEM                  = 0x00000100L;
2939	const auto MCI_STATUS_START                 = 0x00000200L;
2940	
2941	/* flags for dwItem field of the MCI_STATUS_PARMS parameter block */
2942	const auto MCI_STATUS_LENGTH                = 0x00000001L;
2943	const auto MCI_STATUS_POSITION              = 0x00000002L;
2944	const auto MCI_STATUS_NUMBER_OF_TRACKS      = 0x00000003L;
2945	const auto MCI_STATUS_MODE                  = 0x00000004L;
2946	const auto MCI_STATUS_MEDIA_PRESENT         = 0x00000005L;
2947	const auto MCI_STATUS_TIME_FORMAT           = 0x00000006L;
2948	const auto MCI_STATUS_READY                 = 0x00000007L;
2949	const auto MCI_STATUS_CURRENT_TRACK         = 0x00000008L;
2950	
2951	/* flags for dwFlags parameter of MCI_INFO command message */
2952	const auto MCI_INFO_PRODUCT                 = 0x00000100L;
2953	const auto MCI_INFO_FILE                    = 0x00000200L;
2954	const auto MCI_INFO_MEDIA_UPC               = 0x00000400L;
2955	const auto MCI_INFO_MEDIA_IDENTITY          = 0x00000800L;
2956	const auto MCI_INFO_NAME                    = 0x00001000L;
2957	const auto MCI_INFO_COPYRIGHT               = 0x00002000L;
2958	
2959	/* flags for dwFlags parameter of MCI_GETDEVCAPS command message */
2960	const auto MCI_GETDEVCAPS_ITEM              = 0x00000100L;
2961	
2962	/* flags for dwItem field of the MCI_GETDEVCAPS_PARMS parameter block */
2963	const auto MCI_GETDEVCAPS_CAN_RECORD        = 0x00000001L;
2964	const auto MCI_GETDEVCAPS_HAS_AUDIO         = 0x00000002L;
2965	const auto MCI_GETDEVCAPS_HAS_VIDEO         = 0x00000003L;
2966	const auto MCI_GETDEVCAPS_DEVICE_TYPE       = 0x00000004L;
2967	const auto MCI_GETDEVCAPS_USES_FILES        = 0x00000005L;
2968	const auto MCI_GETDEVCAPS_COMPOUND_DEVICE   = 0x00000006L;
2969	const auto MCI_GETDEVCAPS_CAN_EJECT         = 0x00000007L;
2970	const auto MCI_GETDEVCAPS_CAN_PLAY          = 0x00000008L;
2971	const auto MCI_GETDEVCAPS_CAN_SAVE          = 0x00000009L;
2972	
2973	/* flags for dwFlags parameter of MCI_SYSINFO command message */
2974	const auto MCI_SYSINFO_QUANTITY             = 0x00000100L;
2975	const auto MCI_SYSINFO_OPEN                 = 0x00000200L;
2976	const auto MCI_SYSINFO_NAME                 = 0x00000400L;
2977	const auto MCI_SYSINFO_INSTALLNAME          = 0x00000800L;
2978	
2979	/* flags for dwFlags parameter of MCI_SET command message */
2980	const auto MCI_SET_DOOR_OPEN                = 0x00000100L;
2981	const auto MCI_SET_DOOR_CLOSED              = 0x00000200L;
2982	const auto MCI_SET_TIME_FORMAT              = 0x00000400L;
2983	const auto MCI_SET_AUDIO                    = 0x00000800L;
2984	const auto MCI_SET_VIDEO                    = 0x00001000L;
2985	const auto MCI_SET_ON                       = 0x00002000L;
2986	const auto MCI_SET_OFF                      = 0x00004000L;
2987	
2988	/* flags for dwAudio field of MCI_SET_PARMS or MCI_SEQ_SET_PARMS */
2989	const auto MCI_SET_AUDIO_ALL                = 0x00000000L;
2990	const auto MCI_SET_AUDIO_LEFT               = 0x00000001L;
2991	const auto MCI_SET_AUDIO_RIGHT              = 0x00000002L;
2992	
2993	/* flags for dwFlags parameter of MCI_BREAK command message */
2994	const auto MCI_BREAK_KEY                    = 0x00000100L;
2995	const auto MCI_BREAK_HWND                   = 0x00000200L;
2996	const auto MCI_BREAK_OFF                    = 0x00000400L;
2997
2998	/* flags for dwFlags parameter of MCI_RECORD command message */
2999	const auto MCI_RECORD_INSERT                = 0x00000100L;
3000	const auto MCI_RECORD_OVERWRITE             = 0x00000200L;
3001	
3002	/* flags for dwFlags parameter of MCI_SAVE command message */
3003	const auto MCI_SAVE_FILE                    = 0x00000100L;
3004	
3005	/* flags for dwFlags parameter of MCI_LOAD command message */
3006	const auto MCI_LOAD_FILE                    = 0x00000100L;
3007	
3008	
3009	/* generic parameter block for MCI command messages with no special parameters */
3010	align(2) struct MCI_GENERIC_PARMS {
3011	    DWORD_PTR   dwCallback;
3012	}
3013	
3014	alias MCI_GENERIC_PARMS* PMCI_GENERIC_PARMS;
3015	alias MCI_GENERIC_PARMS* LPMCI_GENERIC_PARMS;
3016	
3017	
3018	/* parameter block for MCI_OPEN command message */
3019	align(2) struct MCI_OPEN_PARMSA {
3020	    DWORD_PTR   dwCallback;
3021	    MCIDEVICEID wDeviceID;
3022	    LPCSTR     lpstrDeviceType;
3023	    LPCSTR     lpstrElementName;
3024	    LPCSTR     lpstrAlias;
3025	}
3026	
3027	alias MCI_OPEN_PARMSA* PMCI_OPEN_PARMSA;
3028	alias MCI_OPEN_PARMSA* LPMCI_OPEN_PARMSA;
3029	align(2) struct MCI_OPEN_PARMSW {
3030	    DWORD_PTR   dwCallback;
3031	    MCIDEVICEID wDeviceID;
3032	    LPCWSTR    lpstrDeviceType;
3033	    LPCWSTR    lpstrElementName;
3034	    LPCWSTR    lpstrAlias;
3035	}
3036	
3037	alias MCI_OPEN_PARMSW* PMCI_OPEN_PARMSW;
3038	alias MCI_OPEN_PARMSW* LPMCI_OPEN_PARMSW;
3039	
3040	version(UNICODE) {
3041		alias MCI_OPEN_PARMSW MCI_OPEN_PARMS;
3042		alias PMCI_OPEN_PARMSW PMCI_OPEN_PARMS;
3043		alias LPMCI_OPEN_PARMSW LPMCI_OPEN_PARMS;
3044	}
3045	else {
3046		alias MCI_OPEN_PARMSA MCI_OPEN_PARMS;
3047		alias PMCI_OPEN_PARMSA PMCI_OPEN_PARMS;
3048		alias LPMCI_OPEN_PARMSA LPMCI_OPEN_PARMS;
3049	}
3050	
3051	/* parameter block for MCI_PLAY command message */
3052	align(2) struct MCI_PLAY_PARMS {
3053	    DWORD_PTR   dwCallback;
3054	    DWORD       dwFrom;
3055	    DWORD       dwTo;
3056	}
3057	
3058	alias MCI_PLAY_PARMS* PMCI_PLAY_PARMS;
3059	alias MCI_PLAY_PARMS* LPMCI_PLAY_PARMS;
3060	
3061	
3062	/* parameter block for MCI_SEEK command message */
3063	align(2) struct MCI_SEEK_PARMS {
3064	    DWORD_PTR   dwCallback;
3065	    DWORD       dwTo;
3066	}
3067	
3068	alias MCI_SEEK_PARMS* PMCI_SEEK_PARMS;
3069	alias MCI_SEEK_PARMS* LPMCI_SEEK_PARMS;
3070	
3071	
3072	/* parameter block for MCI_STATUS command message */
3073	align(2) struct MCI_STATUS_PARMS {
3074	    DWORD_PTR   dwCallback;
3075	    DWORD_PTR   dwReturn;
3076	    DWORD       dwItem;
3077	    DWORD       dwTrack;
3078	}
3079	
3080	alias MCI_STATUS_PARMS* PMCI_STATUS_PARMS;
3081	alias MCI_STATUS_PARMS*  LPMCI_STATUS_PARMS;
3082	
3083	
3084	/* parameter block for MCI_INFO command message */
3085	align(2) struct MCI_INFO_PARMSA {
3086	    DWORD_PTR dwCallback;
3087	    LPSTR     lpstrReturn;
3088	    DWORD     dwRetSize;
3089	}
3090	
3091	alias MCI_INFO_PARMSA*  LPMCI_INFO_PARMSA;
3092	align(2) struct MCI_INFO_PARMSW {
3093	    DWORD_PTR dwCallback;
3094	    LPWSTR    lpstrReturn;
3095	    DWORD     dwRetSize;
3096	}
3097	
3098	alias MCI_INFO_PARMSW*  LPMCI_INFO_PARMSW;
3099	
3100	version(UNICODE) {
3101		alias MCI_INFO_PARMSW MCI_INFO_PARMS;
3102		alias LPMCI_INFO_PARMSW LPMCI_INFO_PARMS;
3103	}
3104	else {
3105		alias MCI_INFO_PARMSA MCI_INFO_PARMS;
3106		alias LPMCI_INFO_PARMSA LPMCI_INFO_PARMS;
3107	}
3108	
3109	/* parameter block for MCI_GETDEVCAPS command message */
3110	align(2) struct MCI_GETDEVCAPS_PARMS {
3111	    DWORD_PTR   dwCallback;
3112	    DWORD       dwReturn;
3113	    DWORD       dwItem;
3114	}
3115	
3116	alias MCI_GETDEVCAPS_PARMS* PMCI_GETDEVCAPS_PARMS;
3117	alias MCI_GETDEVCAPS_PARMS*  LPMCI_GETDEVCAPS_PARMS;
3118	
3119	/* parameter block for MCI_SYSINFO command message */
3120	align(2) struct MCI_SYSINFO_PARMSA {
3121	    DWORD_PTR   dwCallback;
3122	    LPSTR       lpstrReturn;
3123	    DWORD       dwRetSize;
3124	    DWORD       dwNumber;
3125	    UINT        wDeviceType;
3126	}
3127	
3128	alias MCI_SYSINFO_PARMSA* PMCI_SYSINFO_PARMSA;
3129	alias MCI_SYSINFO_PARMSA*  LPMCI_SYSINFO_PARMSA;
3130	align(2) struct MCI_SYSINFO_PARMSW {
3131	    DWORD_PTR   dwCallback;
3132	    LPWSTR      lpstrReturn;
3133	    DWORD       dwRetSize;
3134	    DWORD       dwNumber;
3135	    UINT        wDeviceType;
3136	}
3137	
3138	alias MCI_SYSINFO_PARMSW* PMCI_SYSINFO_PARMSW;
3139	alias MCI_SYSINFO_PARMSW*  LPMCI_SYSINFO_PARMSW;
3140	
3141	version(UNICODE) {
3142		alias MCI_SYSINFO_PARMSW MCI_SYSINFO_PARMS;
3143		alias PMCI_SYSINFO_PARMSW PMCI_SYSINFO_PARMS;
3144		alias LPMCI_SYSINFO_PARMSW LPMCI_SYSINFO_PARMS;
3145	}
3146	else {
3147		alias MCI_SYSINFO_PARMSA MCI_SYSINFO_PARMS;
3148		alias PMCI_SYSINFO_PARMSA PMCI_SYSINFO_PARMS;
3149		alias LPMCI_SYSINFO_PARMSA LPMCI_SYSINFO_PARMS;
3150	}
3151	
3152	/* parameter block for MCI_SET command message */
3153	align(2) struct MCI_SET_PARMS {
3154	    DWORD_PTR   dwCallback;
3155	    DWORD       dwTimeFormat;
3156	    DWORD       dwAudio;
3157	}
3158	
3159	alias MCI_SET_PARMS* PMCI_SET_PARMS;
3160	alias MCI_SET_PARMS* LPMCI_SET_PARMS;
3161	
3162	
3163	/* parameter block for MCI_BREAK command message */
3164	align(2) struct MCI_BREAK_PARMS {
3165	    DWORD_PTR   dwCallback;
3166	    int         nVirtKey;
3167	    HWND        hwndBreak;
3168	}
3169	
3170	alias MCI_BREAK_PARMS* PMCI_BREAK_PARMS;
3171	alias MCI_BREAK_PARMS*  LPMCI_BREAK_PARMS;
3172	
3173	
3174	/* parameter block for MCI_SAVE command message */
3175	
3176	align(2) struct MCI_SAVE_PARMSA {
3177	    DWORD_PTR    dwCallback;
3178	    LPCSTR       lpfilename;
3179	}
3180	
3181	alias MCI_SAVE_PARMSA* PMCI_SAVE_PARMSA;
3182	alias MCI_SAVE_PARMSA*  LPMCI_SAVE_PARMSA;
3183	align(2) struct MCI_SAVE_PARMSW {
3184	    DWORD_PTR    dwCallback;
3185	    LPCWSTR      lpfilename;
3186	}
3187	
3188	alias MCI_SAVE_PARMSW* PMCI_SAVE_PARMSW;
3189	alias MCI_SAVE_PARMSW*  LPMCI_SAVE_PARMSW;
3190	
3191	version(UNICODE) {
3192		alias MCI_SAVE_PARMSW MCI_SAVE_PARMS;
3193		alias PMCI_SAVE_PARMSW PMCI_SAVE_PARMS;
3194		alias LPMCI_SAVE_PARMSW LPMCI_SAVE_PARMS;
3195	}
3196	else {
3197		alias MCI_SAVE_PARMSA MCI_SAVE_PARMS;
3198		alias PMCI_SAVE_PARMSA PMCI_SAVE_PARMS;
3199		alias LPMCI_SAVE_PARMSA LPMCI_SAVE_PARMS;
3200	}
3201	
3202	/* parameter block for MCI_LOAD command message */
3203	align(2) struct MCI_LOAD_PARMSA {
3204	    DWORD_PTR    dwCallback;
3205	    LPCSTR       lpfilename;
3206	}
3207	
3208	alias MCI_LOAD_PARMSA* PMCI_LOAD_PARMSA;
3209	alias MCI_LOAD_PARMSA*  LPMCI_LOAD_PARMSA;
3210	align(2) struct MCI_LOAD_PARMSW {
3211	    DWORD_PTR    dwCallback;
3212	    LPCWSTR      lpfilename;
3213	}
3214	
3215	alias MCI_LOAD_PARMSW* PMCI_LOAD_PARMSW;
3216	alias MCI_LOAD_PARMSW*  LPMCI_LOAD_PARMSW;
3217	
3218	version(UNICODE) {
3219		alias MCI_LOAD_PARMSW MCI_LOAD_PARMS;
3220		alias PMCI_LOAD_PARMSW PMCI_LOAD_PARMS;
3221		alias LPMCI_LOAD_PARMSW LPMCI_LOAD_PARMS;
3222	}
3223	else {
3224		alias MCI_LOAD_PARMSA MCI_LOAD_PARMS;
3225		alias PMCI_LOAD_PARMSA PMCI_LOAD_PARMS;
3226		alias LPMCI_LOAD_PARMSA LPMCI_LOAD_PARMS;
3227	}
3228	
3229	/* parameter block for MCI_RECORD command message */
3230	align(2) struct MCI_RECORD_PARMS {
3231	    DWORD_PTR   dwCallback;
3232	    DWORD       dwFrom;
3233	    DWORD       dwTo;
3234	}
3235	
3236	alias MCI_RECORD_PARMS* LPMCI_RECORD_PARMS;
3237	
3238	
3239	/* MCI extensions for videodisc devices */
3240	
3241	/* flag for dwReturn field of MCI_STATUS_PARMS */
3242	/* MCI_STATUS command, (dwItem == MCI_STATUS_MODE) */
3243	const auto MCI_VD_MODE_PARK                 = (MCI_VD_OFFSET + 1);
3244	
3245	/* flag for dwReturn field of MCI_STATUS_PARMS */
3246	/* MCI_STATUS command, (dwItem == MCI_VD_STATUS_MEDIA_TYPE) */
3247	const auto MCI_VD_MEDIA_CLV                 = (MCI_VD_OFFSET + 2);
3248	const auto MCI_VD_MEDIA_CAV                 = (MCI_VD_OFFSET + 3);
3249	const auto MCI_VD_MEDIA_OTHER               = (MCI_VD_OFFSET + 4);
3250	
3251	const auto MCI_VD_FORMAT_TRACK              = 0x4001;
3252	
3253	/* flags for dwFlags parameter of MCI_PLAY command message */
3254	const auto MCI_VD_PLAY_REVERSE              = 0x00010000L;
3255	const auto MCI_VD_PLAY_FAST                 = 0x00020000L;
3256	const auto MCI_VD_PLAY_SPEED                = 0x00040000L;
3257	const auto MCI_VD_PLAY_SCAN                 = 0x00080000L;
3258	const auto MCI_VD_PLAY_SLOW                 = 0x00100000L;
3259	
3260	/* flag for dwFlags parameter of MCI_SEEK command message */
3261	const auto MCI_VD_SEEK_REVERSE              = 0x00010000L;
3262	
3263	/* flags for dwItem field of MCI_STATUS_PARMS parameter block */
3264	const auto MCI_VD_STATUS_SPEED              = 0x00004002L;
3265	const auto MCI_VD_STATUS_FORWARD            = 0x00004003L;
3266	const auto MCI_VD_STATUS_MEDIA_TYPE         = 0x00004004L;
3267	const auto MCI_VD_STATUS_SIDE               = 0x00004005L;
3268	const auto MCI_VD_STATUS_DISC_SIZE          = 0x00004006L;
3269	
3270	/* flags for dwFlags parameter of MCI_GETDEVCAPS command message */
3271	const auto MCI_VD_GETDEVCAPS_CLV            = 0x00010000L;
3272	const auto MCI_VD_GETDEVCAPS_CAV            = 0x00020000L;
3273	
3274	const auto MCI_VD_SPIN_UP                   = 0x00010000L;
3275	const auto MCI_VD_SPIN_DOWN                 = 0x00020000L;
3276	
3277	/* flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block */
3278	const auto MCI_VD_GETDEVCAPS_CAN_REVERSE    = 0x00004002L;
3279	const auto MCI_VD_GETDEVCAPS_FAST_RATE      = 0x00004003L;
3280	const auto MCI_VD_GETDEVCAPS_SLOW_RATE      = 0x00004004L;
3281	const auto MCI_VD_GETDEVCAPS_NORMAL_RATE    = 0x00004005L;
3282	
3283	/* flags for the dwFlags parameter of MCI_STEP command message */
3284	const auto MCI_VD_STEP_FRAMES               = 0x00010000L;
3285	const auto MCI_VD_STEP_REVERSE              = 0x00020000L;
3286	
3287	/* flag for the MCI_ESCAPE command message */
3288	const auto MCI_VD_ESCAPE_STRING             = 0x00000100L;
3289	
3290	
3291	/* parameter block for MCI_PLAY command message */
3292	align(2) struct MCI_VD_PLAY_PARMS {
3293	    DWORD_PTR   dwCallback;
3294	    DWORD       dwFrom;
3295	    DWORD       dwTo;
3296	    DWORD       dwSpeed;
3297	}
3298	
3299	alias MCI_VD_PLAY_PARMS* PMCI_VD_PLAY_PARMS;
3300	alias MCI_VD_PLAY_PARMS* LPMCI_VD_PLAY_PARMS;
3301	
3302	
3303	/* parameter block for MCI_STEP command message */
3304	align(2) struct MCI_VD_STEP_PARMS {
3305	    DWORD_PTR   dwCallback;
3306	    DWORD       dwFrames;
3307	}
3308	
3309	alias MCI_VD_STEP_PARMS* PMCI_VD_STEP_PARMS;
3310	alias MCI_VD_STEP_PARMS* LPMCI_VD_STEP_PARMS;
3311	
3312	
3313	/* parameter block for MCI_ESCAPE command message */
3314	align(2) struct MCI_VD_ESCAPE_PARMSA {
3315	    DWORD_PTR   dwCallback;
3316	    LPCSTR      lpstrCommand;
3317	}
3318	
3319	alias MCI_VD_ESCAPE_PARMSA* PMCI_VD_ESCAPE_PARMSA;
3320	alias MCI_VD_ESCAPE_PARMSA* LPMCI_VD_ESCAPE_PARMSA;
3321	align(2) struct MCI_VD_ESCAPE_PARMSW {
3322	    DWORD_PTR   dwCallback;
3323	    LPCWSTR     lpstrCommand;
3324	}
3325	
3326	alias MCI_VD_ESCAPE_PARMSW* PMCI_VD_ESCAPE_PARMSW;
3327	alias MCI_VD_ESCAPE_PARMSW* LPMCI_VD_ESCAPE_PARMSW;
3328	
3329	version(UNICODE) {
3330		alias MCI_VD_ESCAPE_PARMSW MCI_VD_ESCAPE_PARMS;
3331		alias PMCI_VD_ESCAPE_PARMSW PMCI_VD_ESCAPE_PARMS;
3332		alias LPMCI_VD_ESCAPE_PARMSW LPMCI_VD_ESCAPE_PARMS;
3333	}
3334	else {
3335		alias MCI_VD_ESCAPE_PARMSA MCI_VD_ESCAPE_PARMS;
3336		alias PMCI_VD_ESCAPE_PARMSA PMCI_VD_ESCAPE_PARMS;
3337		alias LPMCI_VD_ESCAPE_PARMSA LPMCI_VD_ESCAPE_PARMS;
3338	}
3339	
3340	/* MCI extensions for CD audio devices */
3341	
3342	/* flags for the dwItem field of the MCI_STATUS_PARMS parameter block */
3343	const auto MCI_CDA_STATUS_TYPE_TRACK        = 0x00004001L;
3344	
3345	/* flags for the dwReturn field of MCI_STATUS_PARMS parameter block */
3346	/* MCI_STATUS command, (dwItem == MCI_CDA_STATUS_TYPE_TRACK) */
3347	const auto MCI_CDA_TRACK_AUDIO              = (MCI_CD_OFFSET + 0);
3348	const auto MCI_CDA_TRACK_OTHER              = (MCI_CD_OFFSET + 1);
3349	
3350	/* MCI extensions for waveform audio devices */
3351	
3352	const auto MCI_WAVE_PCM                     = (MCI_WAVE_OFFSET + 0);
3353	const auto MCI_WAVE_MAPPER                  = (MCI_WAVE_OFFSET + 1);
3354	
3355	/* flags for the dwFlags parameter of MCI_OPEN command message */
3356	const auto MCI_WAVE_OPEN_BUFFER             = 0x00010000L;
3357	
3358	/* flags for the dwFlags parameter of MCI_SET command message */
3359	const auto MCI_WAVE_SET_FORMATTAG           = 0x00010000L;
3360	const auto MCI_WAVE_SET_CHANNELS            = 0x00020000L;
3361	const auto MCI_WAVE_SET_SAMPLESPERSEC       = 0x00040000L;
3362	const auto MCI_WAVE_SET_AVGBYTESPERSEC      = 0x00080000L;
3363	const auto MCI_WAVE_SET_BLOCKALIGN          = 0x00100000L;
3364	const auto MCI_WAVE_SET_BITSPERSAMPLE       = 0x00200000L;
3365	
3366	/* flags for the dwFlags parameter of MCI_STATUS, MCI_SET command messages */
3367	const auto MCI_WAVE_INPUT                   = 0x00400000L;
3368	const auto MCI_WAVE_OUTPUT                  = 0x00800000L;
3369	
3370	/* flags for the dwItem field of MCI_STATUS_PARMS parameter block */
3371	const auto MCI_WAVE_STATUS_FORMATTAG        = 0x00004001L;
3372	const auto MCI_WAVE_STATUS_CHANNELS         = 0x00004002L;
3373	const auto MCI_WAVE_STATUS_SAMPLESPERSEC    = 0x00004003L;
3374	const auto MCI_WAVE_STATUS_AVGBYTESPERSEC   = 0x00004004L;
3375	const auto MCI_WAVE_STATUS_BLOCKALIGN       = 0x00004005L;
3376	const auto MCI_WAVE_STATUS_BITSPERSAMPLE    = 0x00004006L;
3377	const auto MCI_WAVE_STATUS_LEVEL            = 0x00004007L;
3378	
3379	/* flags for the dwFlags parameter of MCI_SET command message */
3380	const auto MCI_WAVE_SET_ANYINPUT            = 0x04000000L;
3381	const auto MCI_WAVE_SET_ANYOUTPUT           = 0x08000000L;
3382	
3383	/* flags for the dwFlags parameter of MCI_GETDEVCAPS command message */
3384	const auto MCI_WAVE_GETDEVCAPS_INPUTS       = 0x00004001L;
3385	const auto MCI_WAVE_GETDEVCAPS_OUTPUTS      = 0x00004002L;
3386	
3387	
3388	/* parameter block for MCI_OPEN command message */
3389	align(2) struct MCI_WAVE_OPEN_PARMSA {
3390	    DWORD_PTR   dwCallback;
3391	    MCIDEVICEID wDeviceID;
3392	    LPCSTR     lpstrDeviceType;
3393	    LPCSTR     lpstrElementName;
3394	    LPCSTR     lpstrAlias;
3395	    DWORD   dwBufferSeconds;
3396	}
3397	
3398	alias MCI_WAVE_OPEN_PARMSA* PMCI_WAVE_OPEN_PARMSA;
3399	alias MCI_WAVE_OPEN_PARMSA* LPMCI_WAVE_OPEN_PARMSA;
3400	
3401	align(2) struct MCI_WAVE_OPEN_PARMSW {
3402	    DWORD_PTR   dwCallback;
3403	    MCIDEVICEID wDeviceID;
3404	    LPCWSTR    lpstrDeviceType;
3405	    LPCWSTR    lpstrElementName;
3406	    LPCWSTR    lpstrAlias;
3407	    DWORD   dwBufferSeconds;
3408	}
3409	
3410	alias MCI_WAVE_OPEN_PARMSW* PMCI_WAVE_OPEN_PARMSW;
3411	alias MCI_WAVE_OPEN_PARMSW* LPMCI_WAVE_OPEN_PARMSW;
3412	
3413	version(UNICODE) {
3414		alias MCI_WAVE_OPEN_PARMSW MCI_WAVE_OPEN_PARMS;
3415		alias PMCI_WAVE_OPEN_PARMSW PMCI_WAVE_OPEN_PARMS;
3416		alias LPMCI_WAVE_OPEN_PARMSW LPMCI_WAVE_OPEN_PARMS;
3417	}
3418	else {
3419		alias MCI_WAVE_OPEN_PARMSA MCI_WAVE_OPEN_PARMS;
3420		alias PMCI_WAVE_OPEN_PARMSA PMCI_WAVE_OPEN_PARMS;
3421		alias LPMCI_WAVE_OPEN_PARMSA LPMCI_WAVE_OPEN_PARMS;
3422	}
3423	
3424	/* parameter block for MCI_DELETE command message */
3425	align(2) struct MCI_WAVE_DELETE_PARMS {
3426	    DWORD_PTR   dwCallback;
3427	    DWORD       dwFrom;
3428	    DWORD       dwTo;
3429	}
3430	
3431	alias MCI_WAVE_DELETE_PARMS* PMCI_WAVE_DELETE_PARMS;
3432	alias MCI_WAVE_DELETE_PARMS* LPMCI_WAVE_DELETE_PARMS;
3433	
3434	
3435	/* parameter block for MCI_SET command message */
3436	align(2) struct MCI_WAVE_SET_PARMS {
3437	    DWORD_PTR   dwCallback;
3438	    DWORD       dwTimeFormat;
3439	    DWORD       dwAudio;
3440	    UINT    wInput;
3441	    UINT    wOutput;
3442	    WORD    wFormatTag;
3443	    WORD    wReserved2;
3444	    WORD    nChannels;
3445	    WORD    wReserved3;
3446	    DWORD   nSamplesPerSec;
3447	    DWORD   nAvgBytesPerSec;
3448	    WORD    nBlockAlign;
3449	    WORD    wReserved4;
3450	    WORD    wBitsPerSample;
3451	    WORD    wReserved5;
3452	}
3453	
3454	alias MCI_WAVE_SET_PARMS* PMCI_WAVE_SET_PARMS;
3455	alias MCI_WAVE_SET_PARMS*  LPMCI_WAVE_SET_PARMS;
3456	
3457	
3458	/* MCI extensions for MIDI sequencer devices */
3459	
3460	/* flags for the dwReturn field of MCI_STATUS_PARMS parameter block */
3461	/* MCI_STATUS command, (dwItem == MCI_SEQ_STATUS_DIVTYPE) */
3462	const auto      MCI_SEQ_DIV_PPQN            = (0 + MCI_SEQ_OFFSET);
3463	const auto      MCI_SEQ_DIV_SMPTE_24        = (1 + MCI_SEQ_OFFSET);
3464	const auto      MCI_SEQ_DIV_SMPTE_25        = (2 + MCI_SEQ_OFFSET);
3465	const auto      MCI_SEQ_DIV_SMPTE_30DROP    = (3 + MCI_SEQ_OFFSET);
3466	const auto      MCI_SEQ_DIV_SMPTE_30        = (4 + MCI_SEQ_OFFSET);
3467
3468	/* flags for the dwMaster field of MCI_SEQ_SET_PARMS parameter block */
3469	/* MCI_SET command, (dwFlags == MCI_SEQ_SET_MASTER) */
3470	const auto      MCI_SEQ_FORMAT_SONGPTR      = 0x4001;
3471	const auto      MCI_SEQ_FILE                = 0x4002;
3472	const auto      MCI_SEQ_MIDI                = 0x4003;
3473	const auto      MCI_SEQ_SMPTE               = 0x4004;
3474	const auto      MCI_SEQ_NONE                = 65533;
3475	const auto      MCI_SEQ_MAPPER              = 65535;
3476
3477	/* flags for the dwItem field of MCI_STATUS_PARMS parameter block */
3478	const auto MCI_SEQ_STATUS_TEMPO             = 0x00004002;
3479	const auto MCI_SEQ_STATUS_PORT              = 0x00004003;
3480	const auto MCI_SEQ_STATUS_SLAVE             = 0x00004007;
3481	const auto MCI_SEQ_STATUS_MASTER            = 0x00004008;
3482	const auto MCI_SEQ_STATUS_OFFSET            = 0x00004009;
3483	const auto MCI_SEQ_STATUS_DIVTYPE           = 0x0000400A;
3484	const auto MCI_SEQ_STATUS_NAME              = 0x0000400B;
3485	const auto MCI_SEQ_STATUS_COPYRIGHT         = 0x0000400C;
3486	
3487	/* flags for the dwFlags parameter of MCI_SET command message */
3488	const auto MCI_SEQ_SET_TEMPO                = 0x00010000L;
3489	const auto MCI_SEQ_SET_PORT                 = 0x00020000L;
3490	const auto MCI_SEQ_SET_SLAVE                = 0x00040000L;
3491	const auto MCI_SEQ_SET_MASTER               = 0x00080000L;
3492	const auto MCI_SEQ_SET_OFFSET               = 0x01000000L;
3493	
3494	
3495	/* parameter block for MCI_SET command message */
3496	align(2) struct MCI_SEQ_SET_PARMS {
3497	    DWORD_PTR   dwCallback;
3498	    DWORD       dwTimeFormat;
3499	    DWORD       dwAudio;
3500	    DWORD       dwTempo;
3501	    DWORD       dwPort;
3502	    DWORD       dwSlave;
3503	    DWORD       dwMaster;
3504	    DWORD       dwOffset;
3505	}
3506	
3507	alias MCI_SEQ_SET_PARMS* PMCI_SEQ_SET_PARMS;
3508	alias MCI_SEQ_SET_PARMS*  LPMCI_SEQ_SET_PARMS;
3509	
3510	
3511	/* MCI extensions for animation devices */
3512	
3513	/* flags for dwFlags parameter of MCI_OPEN command message */
3514	const auto MCI_ANIM_OPEN_WS                 = 0x00010000L;
3515	const auto MCI_ANIM_OPEN_PARENT             = 0x00020000L;
3516	const auto MCI_ANIM_OPEN_NOSTATIC           = 0x00040000L;
3517	
3518	/* flags for dwFlags parameter of MCI_PLAY command message */
3519	const auto MCI_ANIM_PLAY_SPEED              = 0x00010000L;
3520	const auto MCI_ANIM_PLAY_REVERSE            = 0x00020000L;
3521	const auto MCI_ANIM_PLAY_FAST               = 0x00040000L;
3522	const auto MCI_ANIM_PLAY_SLOW               = 0x00080000L;
3523	const auto MCI_ANIM_PLAY_SCAN               = 0x00100000L;
3524	
3525	/* flags for dwFlags parameter of MCI_STEP command message */
3526	const auto MCI_ANIM_STEP_REVERSE            = 0x00010000L;
3527	const auto MCI_ANIM_STEP_FRAMES             = 0x00020000L;
3528	
3529	/* flags for dwItem field of MCI_STATUS_PARMS parameter block */
3530	const auto MCI_ANIM_STATUS_SPEED            = 0x00004001L;
3531	const auto MCI_ANIM_STATUS_FORWARD          = 0x00004002L;
3532	const auto MCI_ANIM_STATUS_HWND             = 0x00004003L;
3533	const auto MCI_ANIM_STATUS_HPAL             = 0x00004004L;
3534	const auto MCI_ANIM_STATUS_STRETCH          = 0x00004005L;
3535	
3536	/* flags for the dwFlags parameter of MCI_INFO command message */
3537	const auto MCI_ANIM_INFO_TEXT               = 0x00010000L;
3538	
3539	/* flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block */
3540	const auto MCI_ANIM_GETDEVCAPS_CAN_REVERSE  = 0x00004001L;
3541	const auto MCI_ANIM_GETDEVCAPS_FAST_RATE    = 0x00004002L;
3542	const auto MCI_ANIM_GETDEVCAPS_SLOW_RATE    = 0x00004003L;
3543	const auto MCI_ANIM_GETDEVCAPS_NORMAL_RATE  = 0x00004004L;
3544	const auto MCI_ANIM_GETDEVCAPS_PALETTES     = 0x00004006L;
3545	const auto MCI_ANIM_GETDEVCAPS_CAN_STRETCH  = 0x00004007L;
3546	const auto MCI_ANIM_GETDEVCAPS_MAX_WINDOWS  = 0x00004008L;
3547	
3548	/* flags for the MCI_REALIZE command message */
3549	const auto MCI_ANIM_REALIZE_NORM            = 0x00010000L;
3550	const auto MCI_ANIM_REALIZE_BKGD            = 0x00020000L;
3551	
3552	/* flags for dwFlags parameter of MCI_WINDOW command message */
3553	const auto MCI_ANIM_WINDOW_HWND             = 0x00010000L;
3554	const auto MCI_ANIM_WINDOW_STATE            = 0x00040000L;
3555	const auto MCI_ANIM_WINDOW_TEXT             = 0x00080000L;
3556	const auto MCI_ANIM_WINDOW_ENABLE_STRETCH   = 0x00100000L;
3557	const auto MCI_ANIM_WINDOW_DISABLE_STRETCH  = 0x00200000L;
3558	
3559	/* flags for hWnd field of MCI_ANIM_WINDOW_PARMS parameter block */
3560	/* MCI_WINDOW command message, (dwFlags == MCI_ANIM_WINDOW_HWND) */
3561	const auto MCI_ANIM_WINDOW_DEFAULT          = 0x00000000L;
3562	
3563	/* flags for dwFlags parameter of MCI_PUT command message */
3564	const auto MCI_ANIM_RECT                    = 0x00010000L;
3565	const auto MCI_ANIM_PUT_SOURCE              = 0x00020000L;
3566	const auto MCI_ANIM_PUT_DESTINATION         = 0x00040000L;
3567	
3568	/* flags for dwFlags parameter of MCI_WHERE command message */
3569	const auto MCI_ANIM_WHERE_SOURCE            = 0x00020000L;
3570	const auto MCI_ANIM_WHERE_DESTINATION       = 0x00040000L;
3571	
3572	/* flags for dwFlags parameter of MCI_UPDATE command message */
3573	const auto MCI_ANIM_UPDATE_HDC              = 0x00020000L;
3574	
3575	
3576	/* parameter block for MCI_OPEN command message */
3577	align(2) struct MCI_ANIM_OPEN_PARMSA {
3578	    DWORD_PTR   dwCallback;
3579	    MCIDEVICEID wDeviceID;
3580	    LPCSTR      lpstrDeviceType;
3581	    LPCSTR      lpstrElementName;
3582	    LPCSTR      lpstrAlias;
3583	    DWORD   dwStyle;
3584	    HWND    hWndParent;
3585	}
3586	
3587	alias MCI_ANIM_OPEN_PARMSA* PMCI_ANIM_OPEN_PARMSA;
3588	alias MCI_ANIM_OPEN_PARMSA* LPMCI_ANIM_OPEN_PARMSA;
3589	align(2) struct MCI_ANIM_OPEN_PARMSW {
3590	    DWORD_PTR   dwCallback;
3591	    MCIDEVICEID wDeviceID;
3592	    LPCWSTR     lpstrDeviceType;
3593	    LPCWSTR     lpstrElementName;
3594	    LPCWSTR     lpstrAlias;
3595	    DWORD   dwStyle;
3596	    HWND    hWndParent;
3597	}
3598	
3599	alias MCI_ANIM_OPEN_PARMSW* PMCI_ANIM_OPEN_PARMSW;
3600	alias MCI_ANIM_OPEN_PARMSW* LPMCI_ANIM_OPEN_PARMSW;
3601	
3602	version(UNICODE) {
3603		alias MCI_ANIM_OPEN_PARMSW MCI_ANIM_OPEN_PARMS;
3604		alias PMCI_ANIM_OPEN_PARMSW PMCI_ANIM_OPEN_PARMS;
3605		alias LPMCI_ANIM_OPEN_PARMSW LPMCI_ANIM_OPEN_PARMS;
3606	}
3607	else {
3608		alias MCI_ANIM_OPEN_PARMSA MCI_ANIM_OPEN_PARMS;
3609		alias PMCI_ANIM_OPEN_PARMSA PMCI_ANIM_OPEN_PARMS;
3610		alias LPMCI_ANIM_OPEN_PARMSA LPMCI_ANIM_OPEN_PARMS;
3611	}
3612	
3613	/* parameter block for MCI_PLAY command message */
3614	align(2) struct MCI_ANIM_PLAY_PARMS {
3615	    DWORD_PTR   dwCallback;
3616	    DWORD       dwFrom;
3617	    DWORD       dwTo;
3618	    DWORD       dwSpeed;
3619	}
3620	
3621	alias MCI_ANIM_PLAY_PARMS* PMCI_ANIM_PLAY_PARMS;
3622	alias MCI_ANIM_PLAY_PARMS* LPMCI_ANIM_PLAY_PARMS;
3623	
3624	/* parameter block for MCI_STEP command message */
3625	align(2) struct MCI_ANIM_STEP_PARMS {
3626	    DWORD_PTR   dwCallback;
3627	    DWORD       dwFrames;
3628	}
3629	
3630	alias MCI_ANIM_STEP_PARMS* PMCI_ANIM_STEP_PARMS;
3631	alias MCI_ANIM_STEP_PARMS* LPMCI_ANIM_STEP_PARMS;
3632	
3633	/* parameter block for MCI_WINDOW command message */
3634	align(2) struct MCI_ANIM_WINDOW_PARMSA {
3635	    DWORD_PTR   dwCallback;
3636	    HWND        hWnd;
3637	    UINT        nCmdShow;
3638	    LPCSTR     lpstrText;
3639	}
3640	
3641	alias MCI_ANIM_WINDOW_PARMSA* PMCI_ANIM_WINDOW_PARMSA;
3642	alias MCI_ANIM_WINDOW_PARMSA*  LPMCI_ANIM_WINDOW_PARMSA;
3643	align(2) struct MCI_ANIM_WINDOW_PARMSW {
3644	    DWORD_PTR   dwCallback;
3645	    HWND        hWnd;
3646	    UINT        nCmdShow;
3647	    LPCWSTR    lpstrText;
3648	}
3649	
3650	alias MCI_ANIM_WINDOW_PARMSW* PMCI_ANIM_WINDOW_PARMSW;
3651	alias MCI_ANIM_WINDOW_PARMSW*  LPMCI_ANIM_WINDOW_PARMSW;
3652	
3653	version(UNICODE) {
3654		alias MCI_ANIM_WINDOW_PARMSW MCI_ANIM_WINDOW_PARMS;
3655		alias PMCI_ANIM_WINDOW_PARMSW PMCI_ANIM_WINDOW_PARMS;
3656		alias LPMCI_ANIM_WINDOW_PARMSW LPMCI_ANIM_WINDOW_PARMS;
3657	}
3658	else {
3659		alias MCI_ANIM_WINDOW_PARMSA MCI_ANIM_WINDOW_PARMS;
3660		alias PMCI_ANIM_WINDOW_PARMSA PMCI_ANIM_WINDOW_PARMS;
3661		alias LPMCI_ANIM_WINDOW_PARMSA LPMCI_ANIM_WINDOW_PARMS;
3662	}
3663	
3664	/* parameter block for MCI_PUT, MCI_UPDATE, MCI_WHERE command messages */
3665	align(2) struct MCI_ANIM_RECT_PARMS {
3666	    DWORD_PTR   dwCallback;
3667		version(MCI_USE_OFFEXT) {
3668		    POINT   ptOffset;
3669		    POINT   ptExtent;
3670		}
3671		else {   /* !MCI_USE_OFFEXT */
3672		    RECT    rc;
3673		}
3674	}
3675	
3676	alias MCI_ANIM_RECT_PARMS * PMCI_ANIM_RECT_PARMS;
3677	alias MCI_ANIM_RECT_PARMS * LPMCI_ANIM_RECT_PARMS;
3678	
3679	/* parameter block for MCI_UPDATE PARMS */
3680	align(2) struct MCI_ANIM_UPDATE_PARMS {
3681	    DWORD_PTR   dwCallback;
3682	    RECT        rc;
3683	    HDC         hDC;
3684	}
3685	
3686	alias MCI_ANIM_UPDATE_PARMS* PMCI_ANIM_UPDATE_PARMS;
3687	alias MCI_ANIM_UPDATE_PARMS*  LPMCI_ANIM_UPDATE_PARMS;
3688	
3689	/* MCI extensions for video overlay devices */
3690	
3691	/* flags for dwFlags parameter of MCI_OPEN command message */
3692	const auto MCI_OVLY_OPEN_WS                 = 0x00010000L;
3693	const auto MCI_OVLY_OPEN_PARENT             = 0x00020000L;
3694	
3695	/* flags for dwFlags parameter of MCI_STATUS command message */
3696	const auto MCI_OVLY_STATUS_HWND             = 0x00004001L;
3697	const auto MCI_OVLY_STATUS_STRETCH          = 0x00004002L;
3698	
3699	/* flags for dwFlags parameter of MCI_INFO command message */
3700	const auto MCI_OVLY_INFO_TEXT               = 0x00010000L;
3701	
3702	/* flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block */
3703	const auto MCI_OVLY_GETDEVCAPS_CAN_STRETCH  = 0x00004001L;
3704	const auto MCI_OVLY_GETDEVCAPS_CAN_FREEZE   = 0x00004002L;
3705	const auto MCI_OVLY_GETDEVCAPS_MAX_WINDOWS  = 0x00004003L;
3706	
3707	/* flags for dwFlags parameter of MCI_WINDOW command message */
3708	const auto MCI_OVLY_WINDOW_HWND             = 0x00010000L;
3709	const auto MCI_OVLY_WINDOW_STATE            = 0x00040000L;
3710	const auto MCI_OVLY_WINDOW_TEXT             = 0x00080000L;
3711	const auto MCI_OVLY_WINDOW_ENABLE_STRETCH   = 0x00100000L;
3712	const auto MCI_OVLY_WINDOW_DISABLE_STRETCH  = 0x00200000L;
3713	
3714	/* flags for hWnd parameter of MCI_OVLY_WINDOW_PARMS parameter block */
3715	const auto MCI_OVLY_WINDOW_DEFAULT          = 0x00000000L;
3716	
3717	/* flags for dwFlags parameter of MCI_PUT command message */
3718	const auto MCI_OVLY_RECT                    = 0x00010000L;
3719	const auto MCI_OVLY_PUT_SOURCE              = 0x00020000L;
3720	const auto MCI_OVLY_PUT_DESTINATION         = 0x00040000L;
3721	const auto MCI_OVLY_PUT_FRAME               = 0x00080000L;
3722	const auto MCI_OVLY_PUT_VIDEO               = 0x00100000L;
3723	
3724	/* flags for dwFlags parameter of MCI_WHERE command message */
3725	const auto MCI_OVLY_WHERE_SOURCE            = 0x00020000L;
3726	const auto MCI_OVLY_WHERE_DESTINATION       = 0x00040000L;
3727	const auto MCI_OVLY_WHERE_FRAME             = 0x00080000L;
3728	const auto MCI_OVLY_WHERE_VIDEO             = 0x00100000L;
3729	
3730	
3731	/* parameter block for MCI_OPEN command message */
3732	align(2) struct MCI_OVLY_OPEN_PARMSA {
3733	    DWORD_PTR   dwCallback;
3734	    MCIDEVICEID wDeviceID;
3735	    LPCSTR      lpstrDeviceType;
3736	    LPCSTR      lpstrElementName;
3737	    LPCSTR      lpstrAlias;
3738	    DWORD   dwStyle;
3739	    HWND    hWndParent;
3740	}
3741	
3742	alias MCI_OVLY_OPEN_PARMSA* PMCI_OVLY_OPEN_PARMSA;
3743	alias MCI_OVLY_OPEN_PARMSA* LPMCI_OVLY_OPEN_PARMSA;
3744	align(2) struct MCI_OVLY_OPEN_PARMSW {
3745	    DWORD_PTR   dwCallback;
3746	    MCIDEVICEID wDeviceID;
3747	    LPCWSTR     lpstrDeviceType;
3748	    LPCWSTR     lpstrElementName;
3749	    LPCWSTR     lpstrAlias;
3750	    DWORD   dwStyle;
3751	    HWND    hWndParent;
3752	}
3753	
3754	alias MCI_OVLY_OPEN_PARMSW* PMCI_OVLY_OPEN_PARMSW;
3755	alias MCI_OVLY_OPEN_PARMSW* LPMCI_OVLY_OPEN_PARMSW;
3756	
3757	version(UNICODE) {
3758		alias MCI_OVLY_OPEN_PARMSW MCI_OVLY_OPEN_PARMS;
3759		alias PMCI_OVLY_OPEN_PARMSW PMCI_OVLY_OPEN_PARMS;
3760		alias LPMCI_OVLY_OPEN_PARMSW LPMCI_OVLY_OPEN_PARMS;
3761	}
3762	else {
3763		alias MCI_OVLY_OPEN_PARMSA MCI_OVLY_OPEN_PARMS;
3764		alias PMCI_OVLY_OPEN_PARMSA PMCI_OVLY_OPEN_PARMS;
3765		alias LPMCI_OVLY_OPEN_PARMSA LPMCI_OVLY_OPEN_PARMS;
3766	}
3767	
3768	/* parameter block for MCI_WINDOW command message */
3769	align(2) struct MCI_OVLY_WINDOW_PARMSA {
3770	    DWORD_PTR   dwCallback;
3771	    HWND        hWnd;
3772	    UINT        nCmdShow;
3773	    LPCSTR      lpstrText;
3774	}
3775	
3776	alias MCI_OVLY_WINDOW_PARMSA* PMCI_OVLY_WINDOW_PARMSA;
3777	alias MCI_OVLY_WINDOW_PARMSA*  LPMCI_OVLY_WINDOW_PARMSA;
3778	align(2) struct MCI_OVLY_WINDOW_PARMSW {
3779	    DWORD_PTR   dwCallback;
3780	    HWND        hWnd;
3781	    UINT        nCmdShow;
3782	    LPCWSTR     lpstrText;
3783	}
3784	
3785	alias MCI_OVLY_WINDOW_PARMSW* PMCI_OVLY_WINDOW_PARMSW;
3786	alias MCI_OVLY_WINDOW_PARMSW*  LPMCI_OVLY_WINDOW_PARMSW;
3787	
3788	version(UNICODE) {
3789		alias MCI_OVLY_WINDOW_PARMSW MCI_OVLY_WINDOW_PARMS;
3790		alias PMCI_OVLY_WINDOW_PARMSW PMCI_OVLY_WINDOW_PARMS;
3791		alias LPMCI_OVLY_WINDOW_PARMSW LPMCI_OVLY_WINDOW_PARMS;
3792	}
3793	else {
3794		alias MCI_OVLY_WINDOW_PARMSA MCI_OVLY_WINDOW_PARMS;
3795		alias PMCI_OVLY_WINDOW_PARMSA PMCI_OVLY_WINDOW_PARMS;
3796		alias LPMCI_OVLY_WINDOW_PARMSA LPMCI_OVLY_WINDOW_PARMS;
3797	}
3798	
3799	/* parameter block for MCI_PUT, MCI_UPDATE, and MCI_WHERE command messages */
3800	align(2) struct MCI_OVLY_RECT_PARMS {
3801	    DWORD_PTR   dwCallback;
3802		version(MCI_USE_OFFEXT) {
3803		    POINT   ptOffset;
3804	    	POINT   ptExtent;
3805		}
3806		else { /* !MCI_USE_OFFEXT */
3807		    RECT    rc;
3808		}
3809	}
3810	
3811	alias MCI_OVLY_RECT_PARMS* PMCI_OVLY_RECT_PARMS;
3812	alias MCI_OVLY_RECT_PARMS*  LPMCI_OVLY_RECT_PARMS;
3813	
3814	
3815	/* parameter block for MCI_SAVE command message */
3816	align(2) struct MCI_OVLY_SAVE_PARMSA {
3817	    DWORD_PTR   dwCallback;
3818	    LPCSTR      lpfilename;
3819	    RECT        rc;
3820	}
3821	
3822	alias MCI_OVLY_SAVE_PARMSA* PMCI_OVLY_SAVE_PARMSA;
3823	alias MCI_OVLY_SAVE_PARMSA*  LPMCI_OVLY_SAVE_PARMSA;
3824	align(2) struct MCI_OVLY_SAVE_PARMSW {
3825	    DWORD_PTR   dwCallback;
3826	    LPCWSTR     lpfilename;
3827	    RECT        rc;
3828	}
3829	
3830	alias MCI_OVLY_SAVE_PARMSW* PMCI_OVLY_SAVE_PARMSW;
3831	alias MCI_OVLY_SAVE_PARMSW*  LPMCI_OVLY_SAVE_PARMSW;
3832	
3833	version(UNICODE) {
3834		alias MCI_OVLY_SAVE_PARMSW MCI_OVLY_SAVE_PARMS;
3835		alias PMCI_OVLY_SAVE_PARMSW PMCI_OVLY_SAVE_PARMS;
3836		alias LPMCI_OVLY_SAVE_PARMSW LPMCI_OVLY_SAVE_PARMS;
3837	}
3838	else {
3839		alias MCI_OVLY_SAVE_PARMSA MCI_OVLY_SAVE_PARMS;
3840		alias PMCI_OVLY_SAVE_PARMSA PMCI_OVLY_SAVE_PARMS;
3841		alias LPMCI_OVLY_SAVE_PARMSA LPMCI_OVLY_SAVE_PARMS;
3842	}
3843	
3844	/* parameter block for MCI_LOAD command message */
3845	align(2) struct MCI_OVLY_LOAD_PARMSA {
3846	    DWORD_PTR   dwCallback;
3847	    LPCSTR      lpfilename;
3848	    RECT    rc;
3849	}
3850	
3851	alias MCI_OVLY_LOAD_PARMSA* PMCI_OVLY_LOAD_PARMSA;
3852	alias MCI_OVLY_LOAD_PARMSA*  LPMCI_OVLY_LOAD_PARMSA;
3853	align(2) struct MCI_OVLY_LOAD_PARMSW {
3854	    DWORD_PTR   dwCallback;
3855	    LPCWSTR     lpfilename;
3856	    RECT    rc;
3857	}
3858	
3859	alias MCI_OVLY_LOAD_PARMSW* PMCI_OVLY_LOAD_PARMSW;
3860	alias MCI_OVLY_LOAD_PARMSW*  LPMCI_OVLY_LOAD_PARMSW;
3861	
3862	version(UNICODE) {
3863		alias MCI_OVLY_LOAD_PARMSW MCI_OVLY_LOAD_PARMS;
3864		alias PMCI_OVLY_LOAD_PARMSW PMCI_OVLY_LOAD_PARMS;
3865		alias LPMCI_OVLY_LOAD_PARMSW LPMCI_OVLY_LOAD_PARMS;
3866	}
3867	else {
3868		alias MCI_OVLY_LOAD_PARMSA MCI_OVLY_LOAD_PARMS;
3869		alias PMCI_OVLY_LOAD_PARMSA PMCI_OVLY_LOAD_PARMS;
3870		alias LPMCI_OVLY_LOAD_PARMSA LPMCI_OVLY_LOAD_PARMS;
3871	}
3872}
3873
3874/****************************************************************************
3875
3876                        DISPLAY Driver extensions
3877
3878****************************************************************************/
3879
3880const auto NEWTRANSPARENT  = 3;           /* use with SetBkMode() */
3881const auto QUERYROPSUPPORT = 40;          /* use to determine ROP support */
3882
3883/****************************************************************************
3884
3885                        DIB Driver extensions
3886
3887****************************************************************************/
3888
3889const auto SELECTDIB        = 41                      ; /* DIB.DRV select dib escape */
3890//const auto DIBINDEX(n)      = MAKELONG((n),0x10FF);
3891
3892
3893/****************************************************************************
3894
3895                        ScreenSaver support
3896
3897    The current application will receive a syscommand of SC_SCREENSAVE just
3898    before the screen saver is invoked.  If the app wishes to prevent a
3899    screen save, return non-zero value, otherwise call DefWindowProc().
3900
3901****************************************************************************/
3902
3903// already defined elsewhere
3904//const auto SC_SCREENSAVE   = 0xF140;
3905