/binding/win32/mmsystem.d
http://github.com/wilkie/djehuty · D · 3905 lines · 2894 code · 594 blank · 417 comment · 69 complexity · c70baf485c6bd2c12e08c20d5c506953 MD5 · raw file
Large files are truncated click here to view the full file
- /*
- * mmsystem.d
- *
- * This module binds MMSystem.h to D. The original copyright notice is
- * preserved below.
- *
- * Author: Dave Wilkinson
- * Originated: November 25th, 2009
- *
- */
- module binding.win32.mmsystem;
- import binding.win32.windef;
- import binding.win32.winnt;
- import binding.win32.winuser;
- extern(System):
- /*==========================================================================
- *
- * mmsystem.h -- Include file for Multimedia API's
- *
- * Version 4.00
- *
- * Copyright (C) 1992-1998 Microsoft Corporation. All Rights Reserved.
- *
- *--------------------------------------------------------------------------
- *
- * Define: Prevent inclusion of:
- * -------------- --------------------------------------------------------
- * MMNODRV Installable driver support
- * MMNOSOUND Sound support
- * MMNOWAVE Waveform support
- * MMNOMIDI MIDI support
- * MMNOAUX Auxiliary audio support
- * MMNOMIXER Mixer support
- * MMNOTIMER Timer support
- * MMNOJOY Joystick support
- * MMNOMCI MCI support
- * MMNOMMIO Multimedia file I/O support
- * MMNOMMSYSTEM General MMSYSTEM functions
- *
- *==========================================================================
- */
- /****************************************************************************
- General constants and data types
- ****************************************************************************/
- /* general constants */
- const auto MAXPNAMELEN = 32 ; /* max product name length (including NULL) */
- const auto MAXERRORLENGTH = 256 ; /* max error text length (including NULL) */
- const auto MAX_JOYSTICKOEMVXDNAME = 260 ; /* max oem vxd name length (including NULL) */
- /*
- * Microsoft Manufacturer and Product ID's (these have been moved to
- * MMREG.H for Windows 4.00 and above).
- */
- const auto MM_MIDI_MAPPER = 1 ; /* MIDI Mapper */
- const auto MM_WAVE_MAPPER = 2 ; /* Wave Mapper */
- const auto MM_SNDBLST_MIDIOUT = 3 ; /* Sound Blaster MIDI output port */
- const auto MM_SNDBLST_MIDIIN = 4 ; /* Sound Blaster MIDI input port */
- const auto MM_SNDBLST_SYNTH = 5 ; /* Sound Blaster internal synthesizer */
- const auto MM_SNDBLST_WAVEOUT = 6 ; /* Sound Blaster waveform output */
- const auto MM_SNDBLST_WAVEIN = 7 ; /* Sound Blaster waveform input */
- const auto MM_ADLIB = 9 ; /* Ad Lib-compatible synthesizer */
- const auto MM_MPU401_MIDIOUT = 10 ; /* MPU401-compatible MIDI output port */
- const auto MM_MPU401_MIDIIN = 11 ; /* MPU401-compatible MIDI input port */
- const auto MM_PC_JOYSTICK = 12 ; /* Joystick adapter */
- /* general data types */
- alias UINT MMVERSION; /* major (high byte), minor (low byte) */
- alias UINT VERSION; /* major (high byte), minor (low byte) */
- alias UINT MMRESULT; /* error return code, 0 means no error */
- /* call as if(err=xxxx(...)) Error(err); else */
- alias UINT *LPUINT;
- /* MMTIME data align(2) structure */
- align(2) struct MMTIME {
- UINT wType; /* indicates the contents of the align(2) union */
- align(2) union _inner_union {
- DWORD ms; /* milliseconds */
- DWORD sample; /* samples */
- DWORD cb; /* byte count */
- DWORD ticks; /* ticks in MIDI stream */
- /* SMPTE */
- align(2) struct _inner_struct {
- BYTE hour; /* hours */
- BYTE min; /* minutes */
- BYTE sec; /* seconds */
- BYTE frame; /* frames */
- BYTE fps; /* frames per second */
- BYTE dummy; /* pad */
- BYTE pad[2];
- }
- _inner_struct smpte;
- /* MIDI */
- align(2) struct _inner_struct2 {
- DWORD songptrpos; /* song pointer position */
- }
- _inner_struct2 midi;
- }
- _inner_union u;
- }
- alias MMTIME* PMMTIME;
- alias MMTIME *NPMMTIME;
- alias MMTIME* LPMMTIME;
- /* types for wType field in MMTIME align(2) struct */
- const auto TIME_MS = 0x0001 ; /* time in milliseconds */
- const auto TIME_SAMPLES = 0x0002 ; /* number of wave samples */
- const auto TIME_BYTES = 0x0004 ; /* current byte offset */
- const auto TIME_SMPTE = 0x0008 ; /* SMPTE time */
- const auto TIME_MIDI = 0x0010 ; /* MIDI time */
- const auto TIME_TICKS = 0x0020 ; /* Ticks within MIDI stream */
- /*
- *
- *
- */
- template MAKEFOURCC(char ch0, char ch1, char ch2, char ch3) {
- const auto MAKEFOURCC =
- (cast(DWORD)cast(BYTE)(ch0) | (cast(DWORD)cast(BYTE)(ch1) << 8) |
- (cast(DWORD)cast(BYTE)(ch2) << 16) | (cast(DWORD)cast(BYTE)(ch3) << 24 ));
- }
- /****************************************************************************
- Multimedia Extensions Window Messages
- ****************************************************************************/
- const auto MM_JOY1MOVE = 0x3A0 ; /* joystick */
- const auto MM_JOY2MOVE = 0x3A1;
- const auto MM_JOY1ZMOVE = 0x3A2;
- const auto MM_JOY2ZMOVE = 0x3A3;
- const auto MM_JOY1BUTTONDOWN = 0x3B5;
- const auto MM_JOY2BUTTONDOWN = 0x3B6;
- const auto MM_JOY1BUTTONUP = 0x3B7;
- const auto MM_JOY2BUTTONUP = 0x3B8;
- const auto MM_MCINOTIFY = 0x3B9 ; /* MCI */
- const auto MM_WOM_OPEN = 0x3BB ; /* waveform output */
- const auto MM_WOM_CLOSE = 0x3BC;
- const auto MM_WOM_DONE = 0x3BD;
- const auto MM_WIM_OPEN = 0x3BE ; /* waveform input */
- const auto MM_WIM_CLOSE = 0x3BF;
- const auto MM_WIM_DATA = 0x3C0;
- const auto MM_MIM_OPEN = 0x3C1 ; /* MIDI input */
- const auto MM_MIM_CLOSE = 0x3C2;
- const auto MM_MIM_DATA = 0x3C3;
- const auto MM_MIM_LONGDATA = 0x3C4;
- const auto MM_MIM_ERROR = 0x3C5;
- const auto MM_MIM_LONGERROR = 0x3C6;
- const auto MM_MOM_OPEN = 0x3C7 ; /* MIDI output */
- const auto MM_MOM_CLOSE = 0x3C8;
- const auto MM_MOM_DONE = 0x3C9;
- /* these are also in msvideo.h */
- const auto MM_DRVM_OPEN = 0x3D0; /* installable drivers */
- const auto MM_DRVM_CLOSE = 0x3D1;
- const auto MM_DRVM_DATA = 0x3D2;
- const auto MM_DRVM_ERROR = 0x3D3;
- /* these are used by msacm.h */
- const auto MM_STREAM_OPEN = 0x3D4;
- const auto MM_STREAM_CLOSE = 0x3D5;
- const auto MM_STREAM_DONE = 0x3D6;
- const auto MM_STREAM_ERROR = 0x3D7;
- const auto MM_MOM_POSITIONCB = 0x3CA ; /* Callback for MEVT_POSITIONCB */
- const auto MM_MCISIGNAL = 0x3CB;
- const auto MM_MIM_MOREDATA = 0x3CC ; /* MIM_DONE w/ pending events */
- const auto MM_MIXM_LINE_CHANGE = 0x3D0 ; /* mixer line change notify */
- const auto MM_MIXM_CONTROL_CHANGE = 0x3D1 ; /* mixer control change notify */
- /****************************************************************************
- String resource number bases (internal use)
- ****************************************************************************/
- const auto MMSYSERR_BASE = 0;
- const auto WAVERR_BASE = 32;
- const auto MIDIERR_BASE = 64;
- const auto TIMERR_BASE = 96;
- const auto JOYERR_BASE = 160;
- const auto MCIERR_BASE = 256;
- const auto MIXERR_BASE = 1024;
- const auto MCI_STRING_OFFSET = 512;
- const auto MCI_VD_OFFSET = 1024;
- const auto MCI_CD_OFFSET = 1088;
- const auto MCI_WAVE_OFFSET = 1152;
- const auto MCI_SEQ_OFFSET = 1216;
- /****************************************************************************
- General error return values
- ****************************************************************************/
- /* general error return values */
- const auto MMSYSERR_NOERROR = 0 ; /* no error */
- const auto MMSYSERR_ERROR = (MMSYSERR_BASE + 1) ; /* unspecified error */
- const auto MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2) ; /* device ID out of range */
- const auto MMSYSERR_NOTENABLED = (MMSYSERR_BASE + 3) ; /* driver failed enable */
- const auto MMSYSERR_ALLOCATED = (MMSYSERR_BASE + 4) ; /* device already allocated */
- const auto MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5) ; /* device handle is invalid */
- const auto MMSYSERR_NODRIVER = (MMSYSERR_BASE + 6) ; /* no device driver present */
- const auto MMSYSERR_NOMEM = (MMSYSERR_BASE + 7) ; /* memory allocation error */
- const auto MMSYSERR_NOTSUPPORTED = (MMSYSERR_BASE + 8) ; /* function isn't supported */
- const auto MMSYSERR_BADERRNUM = (MMSYSERR_BASE + 9) ; /* error value out of range */
- const auto MMSYSERR_INVALFLAG = (MMSYSERR_BASE + 10) ; /* invalid flag passed */
- const auto MMSYSERR_INVALPARAM = (MMSYSERR_BASE + 11) ; /* invalid parameter passed */
- const auto MMSYSERR_HANDLEBUSY = (MMSYSERR_BASE + 12) ; /* handle being used */
- /* simultaneously on another */
- /* thread (eg callback) */
- const auto MMSYSERR_INVALIDALIAS = (MMSYSERR_BASE + 13) ; /* specified alias not found */
- const auto MMSYSERR_BADDB = (MMSYSERR_BASE + 14) ; /* bad registry database */
- const auto MMSYSERR_KEYNOTFOUND = (MMSYSERR_BASE + 15) ; /* registry key not found */
- const auto MMSYSERR_READERROR = (MMSYSERR_BASE + 16) ; /* registry read error */
- const auto MMSYSERR_WRITEERROR = (MMSYSERR_BASE + 17) ; /* registry write error */
- const auto MMSYSERR_DELETEERROR = (MMSYSERR_BASE + 18) ; /* registry delete error */
- const auto MMSYSERR_VALNOTFOUND = (MMSYSERR_BASE + 19) ; /* registry value not found */
- const auto MMSYSERR_NODRIVERCB = (MMSYSERR_BASE + 20) ; /* driver does not call DriverCallback */
- const auto MMSYSERR_MOREDATA = (MMSYSERR_BASE + 21) ; /* more data to be returned */
- const auto MMSYSERR_LASTERROR = (MMSYSERR_BASE + 21) ; /* last error in range */
- alias HANDLE HDRVR;
- /****************************************************************************
- Installable driver support
- ****************************************************************************/
- version(MMNODRV) {
- }
- else {
- align(2) struct DRVCONFIGINFOEX {
- DWORD dwDCISize;
- LPCWSTR lpszDCISectionName;
- LPCWSTR lpszDCIAliasName;
- DWORD dnDevNode;
- }
-
- alias DRVCONFIGINFOEX* PDRVCONFIGINFOEX;
- alias DRVCONFIGINFOEX *NPDRVCONFIGINFOEX;
- alias DRVCONFIGINFOEX* LPDRVCONFIGINFOEX;
-
- /* Driver messages */
- const auto DRV_LOAD = 0x0001;
- const auto DRV_ENABLE = 0x0002;
- const auto DRV_OPEN = 0x0003;
- const auto DRV_CLOSE = 0x0004;
- const auto DRV_DISABLE = 0x0005;
- const auto DRV_FREE = 0x0006;
- const auto DRV_CONFIGURE = 0x0007;
- const auto DRV_QUERYCONFIGURE = 0x0008;
- const auto DRV_INSTALL = 0x0009;
- const auto DRV_REMOVE = 0x000A;
- const auto DRV_EXITSESSION = 0x000B;
- const auto DRV_POWER = 0x000F;
- const auto DRV_RESERVED = 0x0800;
- const auto DRV_USER = 0x4000;
-
- /* LPARAM of DRV_CONFIGURE message */
- align(2) struct DRVCONFIGINFO {
- DWORD dwDCISize;
- LPCWSTR lpszDCISectionName;
- LPCWSTR lpszDCIAliasName;
- }
-
- alias DRVCONFIGINFO* PDRVCONFIGINFO;
- alias DRVCONFIGINFO *NPDRVCONFIGINFO;
- alias DRVCONFIGINFO* LPDRVCONFIGINFO;
-
- /* Supported return values for DRV_CONFIGURE message */
- const auto DRVCNF_CANCEL = 0x0000;
- const auto DRVCNF_OK = 0x0001;
- const auto DRVCNF_RESTART = 0x0002;
-
- /* installable driver function prototypes */
- alias LRESULT function(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM) DRIVERPROC;
-
- LRESULT CloseDriver( HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
- HDRVR OpenDriver( LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2);
- LRESULT SendDriverMessage( HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2);
- HMODULE DrvGetModuleHandle( HDRVR hDriver);
- HMODULE GetDriverModuleHandle( HDRVR hDriver);
- LRESULT DefDriverProc( DWORD_PTR dwDriverIdentifier, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
-
- /* return values from DriverProc() function */
- const auto DRV_CANCEL = DRVCNF_CANCEL;
- const auto DRV_OK = DRVCNF_OK;
- const auto DRV_RESTART = DRVCNF_RESTART;
- const auto DRV_MCI_FIRST = DRV_RESERVED;
- const auto DRV_MCI_LAST = (DRV_RESERVED + 0xFFF);
- }
- /****************************************************************************
- Driver callback support
- ****************************************************************************/
- /* flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and */
- /* midiOutOpen() to specify the type of the dwCallback parameter. */
- const auto CALLBACK_TYPEMASK = 0x00070000 ; /* callback type mask */
- const auto CALLBACK_NULL = 0x00000000 ; /* no callback */
- const auto CALLBACK_WINDOW = 0x00010000 ; /* dwCallback is a HWND */
- const auto CALLBACK_TASK = 0x00020000 ; /* dwCallback is a HTASK */
- const auto CALLBACK_FUNCTION = 0x00030000 ; /* dwCallback is a FARPROC */
- const auto CALLBACK_THREAD = (CALLBACK_TASK); /* thread ID replaces 16 bit task */
- const auto CALLBACK_EVENT = 0x00050000 ; /* dwCallback is an EVENT Handle */
- alias void function(HDRVR hdrvr, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DRVCALLBACK;
- alias DRVCALLBACK *LPDRVCALLBACK;
- alias DRVCALLBACK *PDRVCALLBACK;
- /****************************************************************************
- General MMSYSTEM support
- ****************************************************************************/
- version(MMNOMMSYSTEM) {
- }
- else {
- UINT mmsystemGetVersion();
- }
- /****************************************************************************
- Sound support
- ****************************************************************************/
- version(MMNOSOUND) {
- }
- else {
- BOOL sndPlaySoundA( LPCSTR pszSound, UINT fuSound);
- BOOL sndPlaySoundW( LPCWSTR pszSound, UINT fuSound);
-
- version(UNICODE) {
- alias sndPlaySoundW sndPlaySound;
- }
- else {
- alias sndPlaySoundA sndPlaySound;
- }
-
- /*
- * flag values for fuSound and fdwSound arguments on [snd]PlaySound
- */
- const auto SND_SYNC = 0x0000 ; /* play synchronously (default) */
- const auto SND_ASYNC = 0x0001 ; /* play asynchronously */
- const auto SND_NODEFAULT = 0x0002 ; /* silence (!default) if sound not found */
- const auto SND_MEMORY = 0x0004 ; /* pszSound points to a memory file */
- const auto SND_LOOP = 0x0008 ; /* loop the sound until next sndPlaySound */
- const auto SND_NOSTOP = 0x0010 ; /* don't stop any currently playing sound */
-
- const auto SND_NOWAIT = 0x00002000L ; /* don't wait if the driver is busy */
- const auto SND_ALIAS = 0x00010000L ; /* name is a registry alias */
- const auto SND_ALIAS_ID = 0x00110000L ; /* alias is a predefined ID */
- const auto SND_FILENAME = 0x00020000L ; /* name is file name */
- const auto SND_RESOURCE = 0x00040004L ; /* name is resource name or atom */
-
- const auto SND_PURGE = 0x0040 ; /* purge non-static events for task */
- const auto SND_APPLICATION = 0x0080 ; /* look for application specific association */
-
- const auto SND_SENTRY = 0x00080000L ; /* Generate a SoundSentry event with this sound */
- const auto SND_SYSTEM = 0x00200000L ; /* Treat this as a system sound */
-
- const auto SND_ALIAS_START = 0 ; /* alias base */
-
- template sndAlias(char ch0, char ch1) {
- const DWORD sndAlias = (SND_ALIAS_START + cast(DWORD)cast(BYTE)(ch0) | (cast(DWORD)cast(BYTE)(ch1) << 8));
- }
-
- const auto SND_ALIAS_SYSTEMASTERISK = sndAlias!('S', '*');
- const auto SND_ALIAS_SYSTEMQUESTION = sndAlias!('S', '?');
- const auto SND_ALIAS_SYSTEMHAND = sndAlias!('S', 'H');
- const auto SND_ALIAS_SYSTEMEXIT = sndAlias!('S', 'E');
- const auto SND_ALIAS_SYSTEMSTART = sndAlias!('S', 'S');
- const auto SND_ALIAS_SYSTEMWELCOME = sndAlias!('S', 'W');
- const auto SND_ALIAS_SYSTEMEXCLAMATION = sndAlias!('S', '!');
- const auto SND_ALIAS_SYSTEMDEFAULT = sndAlias!('S', 'D');
-
- BOOL PlaySoundA( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
- BOOL PlaySoundW( LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
- version(UNICODE) {
- alias PlaySoundW PlaySound;
- }
- else {
- alias PlaySoundA PlaySound;
- }
- }
- /****************************************************************************
- Waveform audio support
- ****************************************************************************/
- version(MMNOWAVE) {
- }
- else {
- /* waveform audio error return values */
- const auto WAVERR_BADFORMAT = (WAVERR_BASE + 0) ; /* unsupported wave format */
- const auto WAVERR_STILLPLAYING = (WAVERR_BASE + 1) ; /* still something playing */
- const auto WAVERR_UNPREPARED = (WAVERR_BASE + 2) ; /* header not prepared */
- const auto WAVERR_SYNC = (WAVERR_BASE + 3) ; /* device is synchronous */
- const auto WAVERR_LASTERROR = (WAVERR_BASE + 3) ; /* last error in range */
-
- /* waveform audio data types */
- alias HANDLE HWAVE;
- alias HANDLE HWAVEIN;
- alias HANDLE HWAVEOUT;
-
- alias HWAVEIN *LPHWAVEIN;
- alias HWAVEOUT *LPHWAVEOUT;
-
- alias DRVCALLBACK WAVECALLBACK;
- alias WAVECALLBACK *LPWAVECALLBACK;
-
- /* wave callback messages */
- const auto WOM_OPEN = MM_WOM_OPEN;
- const auto WOM_CLOSE = MM_WOM_CLOSE;
- const auto WOM_DONE = MM_WOM_DONE;
- const auto WIM_OPEN = MM_WIM_OPEN;
- const auto WIM_CLOSE = MM_WIM_CLOSE;
- const auto WIM_DATA = MM_WIM_DATA;
-
- /* device ID for wave device mapper */
- const auto WAVE_MAPPER = (cast(UINT)-1);
-
- /* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
- const auto WAVE_FORMAT_QUERY = 0x0001;
- const auto WAVE_ALLOWSYNC = 0x0002;
- const auto WAVE_MAPPED = 0x0004;
- const auto WAVE_FORMAT_DIRECT = 0x0008;
- const auto WAVE_FORMAT_DIRECT_QUERY = (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT);
-
- /* wave data block header */
- align(2) struct WAVEHDR {
- ubyte* lpData; /* pointer to locked data buffer */
- DWORD dwBufferLength; /* length of data buffer */
- DWORD dwBytesRecorded; /* used for input only */
- DWORD_PTR dwUser; /* for client's use */
- DWORD dwFlags; /* assorted flags (see defines) */
- DWORD dwLoops; /* loop control counter */
- WAVEHDR* lpNext; /* reserved for driver */
- DWORD_PTR reserved; /* reserved for driver */
- }
-
- alias WAVEHDR* PWAVEHDR;
- alias WAVEHDR* NPWAVEHDR;
- alias WAVEHDR* LPWAVEHDR;
-
- /* flags for dwFlags field of WAVEHDR */
- const auto WHDR_DONE = 0x00000001 ; /* done bit */
- const auto WHDR_PREPARED = 0x00000002 ; /* set if this header has been prepared */
- const auto WHDR_BEGINLOOP = 0x00000004 ; /* loop start block */
- const auto WHDR_ENDLOOP = 0x00000008 ; /* loop end block */
- const auto WHDR_INQUEUE = 0x00000010 ; /* reserved for driver */
-
- /* waveform output device capabilities align(2) structure */
- align(2) struct WAVEOUTCAPSA {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of sources supported */
- WORD wReserved1; /* packing */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias WAVEOUTCAPSA* PWAVEOUTCAPSA;
- alias WAVEOUTCAPSA* NPWAVEOUTCAPSA;
- alias WAVEOUTCAPSA* LPWAVEOUTCAPSA;
- align(2) struct WAVEOUTCAPSW {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of sources supported */
- WORD wReserved1; /* packing */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias WAVEOUTCAPSW* PWAVEOUTCAPSW;
- alias WAVEOUTCAPSW* NPWAVEOUTCAPSW;
- alias WAVEOUTCAPSW* LPWAVEOUTCAPSW;
-
- version(UNICODE) {
- alias WAVEOUTCAPSW WAVEOUTCAPS;
- alias PWAVEOUTCAPSW PWAVEOUTCAPS;
- alias NPWAVEOUTCAPSW NPWAVEOUTCAPS;
- alias LPWAVEOUTCAPSW LPWAVEOUTCAPS;
- }
- else {
- alias WAVEOUTCAPSA WAVEOUTCAPS;
- alias PWAVEOUTCAPSA PWAVEOUTCAPS;
- alias NPWAVEOUTCAPSA NPWAVEOUTCAPS;
- alias LPWAVEOUTCAPSA LPWAVEOUTCAPS;
- }
- align(2) struct WAVEOUTCAPS2A {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of sources supported */
- WORD wReserved1; /* packing */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias WAVEOUTCAPS2A* PWAVEOUTCAPS2A;
- alias WAVEOUTCAPS2A* NPWAVEOUTCAPS2A;
- alias WAVEOUTCAPS2A* LPWAVEOUTCAPS2A;
- align(2) struct WAVEOUTCAPS2W {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of sources supported */
- WORD wReserved1; /* packing */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias WAVEOUTCAPS2W* PWAVEOUTCAPS2W;
- alias WAVEOUTCAPS2W* NPWAVEOUTCAPS2W;
- alias WAVEOUTCAPS2W* LPWAVEOUTCAPS2W;
-
- version(UNICODE) {
- alias WAVEOUTCAPS2W WAVEOUTCAPS2;
- alias PWAVEOUTCAPS2W PWAVEOUTCAPS2;
- alias NPWAVEOUTCAPS2W NPWAVEOUTCAPS2;
- alias LPWAVEOUTCAPS2W LPWAVEOUTCAPS2;
- }
- else {
- alias WAVEOUTCAPS2A WAVEOUTCAPS2;
- alias PWAVEOUTCAPS2A PWAVEOUTCAPS2;
- alias NPWAVEOUTCAPS2A NPWAVEOUTCAPS2;
- alias LPWAVEOUTCAPS2A LPWAVEOUTCAPS2;
- }
-
- /* flags for dwSupport field of WAVEOUTCAPS */
- const auto WAVECAPS_PITCH = 0x0001 ; /* supports pitch control */
- const auto WAVECAPS_PLAYBACKRATE = 0x0002 ; /* supports playback rate control */
- const auto WAVECAPS_VOLUME = 0x0004 ; /* supports volume control */
- const auto WAVECAPS_LRVOLUME = 0x0008 ; /* separate left-right volume control */
- const auto WAVECAPS_SYNC = 0x0010;
- const auto WAVECAPS_SAMPLEACCURATE = 0x0020;
-
- /* waveform input device capabilities align(2) structure */
- align(2) struct WAVEINCAPSA {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of channels supported */
- WORD wReserved1; /* align(2) structure packing */
- }
-
- alias WAVEINCAPSA* PWAVEINCAPSA;
- alias WAVEINCAPSA* NPWAVEINCAPSA;
- alias WAVEINCAPSA* LPWAVEINCAPSA;
- align(2) struct WAVEINCAPSW {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of channels supported */
- WORD wReserved1; /* align(2) structure packing */
- }
-
- alias WAVEINCAPSW* PWAVEINCAPSW;
- alias WAVEINCAPSW* NPWAVEINCAPSW;
- alias WAVEINCAPSW* LPWAVEINCAPSW;
-
- version(UNICODE) {
- alias WAVEINCAPSW WAVEINCAPS;
- alias PWAVEINCAPSW PWAVEINCAPS;
- alias NPWAVEINCAPSW NPWAVEINCAPS;
- alias LPWAVEINCAPSW LPWAVEINCAPS;
- }
- else {
- alias WAVEINCAPSA WAVEINCAPS;
- alias PWAVEINCAPSA PWAVEINCAPS;
- alias NPWAVEINCAPSA NPWAVEINCAPS;
- alias LPWAVEINCAPSA LPWAVEINCAPS;
- }
-
- align(2) struct WAVEINCAPS2A {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of channels supported */
- WORD wReserved1; /* align(2) structure packing */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias WAVEINCAPS2A* PWAVEINCAPS2A;
- alias WAVEINCAPS2A* NPWAVEINCAPS2A;
- alias WAVEINCAPS2A* LPWAVEINCAPS2A;
- align(2) struct WAVEINCAPS2W {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of channels supported */
- WORD wReserved1; /* align(2) structure packing */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias WAVEINCAPS2W* PWAVEINCAPS2W;
- alias WAVEINCAPS2W* NPWAVEINCAPS2W;
- alias WAVEINCAPS2W* LPWAVEINCAPS2W;
-
- version(UNICODE) {
- alias WAVEINCAPS2W WAVEINCAPS2;
- alias PWAVEINCAPS2W PWAVEINCAPS2;
- alias NPWAVEINCAPS2W NPWAVEINCAPS2;
- alias LPWAVEINCAPS2W LPWAVEINCAPS2;
- }
- else {
- alias WAVEINCAPS2A WAVEINCAPS2;
- alias PWAVEINCAPS2A PWAVEINCAPS2;
- alias NPWAVEINCAPS2A NPWAVEINCAPS2;
- alias LPWAVEINCAPS2A LPWAVEINCAPS2;
- }
-
- /* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
- const auto WAVE_INVALIDFORMAT = 0x00000000 ; /* invalid format */
- const auto WAVE_FORMAT_1M08 = 0x00000001 ; /* 11.025 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_1S08 = 0x00000002 ; /* 11.025 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_1M16 = 0x00000004 ; /* 11.025 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_1S16 = 0x00000008 ; /* 11.025 kHz, Stereo, 16-bit */
- const auto WAVE_FORMAT_2M08 = 0x00000010 ; /* 22.05 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_2S08 = 0x00000020 ; /* 22.05 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_2M16 = 0x00000040 ; /* 22.05 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_2S16 = 0x00000080 ; /* 22.05 kHz, Stereo, 16-bit */
- const auto WAVE_FORMAT_4M08 = 0x00000100 ; /* 44.1 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_4S08 = 0x00000200 ; /* 44.1 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_4M16 = 0x00000400 ; /* 44.1 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_4S16 = 0x00000800 ; /* 44.1 kHz, Stereo, 16-bit */
-
- const auto WAVE_FORMAT_44M08 = 0x00000100 ; /* 44.1 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_44S08 = 0x00000200 ; /* 44.1 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_44M16 = 0x00000400 ; /* 44.1 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_44S16 = 0x00000800 ; /* 44.1 kHz, Stereo, 16-bit */
- const auto WAVE_FORMAT_48M08 = 0x00001000 ; /* 48 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_48S08 = 0x00002000 ; /* 48 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_48M16 = 0x00004000 ; /* 48 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_48S16 = 0x00008000 ; /* 48 kHz, Stereo, 16-bit */
- const auto WAVE_FORMAT_96M08 = 0x00010000 ; /* 96 kHz, Mono, 8-bit */
- const auto WAVE_FORMAT_96S08 = 0x00020000 ; /* 96 kHz, Stereo, 8-bit */
- const auto WAVE_FORMAT_96M16 = 0x00040000 ; /* 96 kHz, Mono, 16-bit */
- const auto WAVE_FORMAT_96S16 = 0x00080000 ; /* 96 kHz, Stereo, 16-bit */
-
- /* OLD general waveform format align(2) structure (information common to all formats) */
- align(2) struct WAVEFORMAT {
- WORD wFormatTag; /* format type */
- WORD nChannels; /* number of channels (i.e. mono, stereo, etc.) */
- DWORD nSamplesPerSec; /* sample rate */
- DWORD nAvgBytesPerSec; /* for buffer estimation */
- WORD nBlockAlign; /* block size of data */
- }
-
- alias WAVEFORMAT* PWAVEFORMAT;
- alias WAVEFORMAT *NPWAVEFORMAT;
- alias WAVEFORMAT* LPWAVEFORMAT;
-
- /* flags for wFormatTag field of WAVEFORMAT */
- const auto WAVE_FORMAT_PCM = 1;
-
- /* specific waveform format align(2) structure for PCM data */
- align(2) struct PCMWAVEFORMAT {
- WAVEFORMAT wf;
- WORD wBitsPerSample;
- }
- alias PCMWAVEFORMAT* PPCMWAVEFORMAT;
- alias PCMWAVEFORMAT *NPPCMWAVEFORMAT;
- alias PCMWAVEFORMAT* LPPCMWAVEFORMAT;
-
- /*
- * extended waveform format align(2) structure used for all non-PCM formats. this
- * align(2) structure is common to all non-PCM formats.
- */
- align(2) struct WAVEFORMATEX {
- WORD wFormatTag; /* format type */
- WORD nChannels; /* number of channels (i.e. mono, stereo...) */
- DWORD nSamplesPerSec; /* sample rate */
- DWORD nAvgBytesPerSec; /* for buffer estimation */
- WORD nBlockAlign; /* block size of data */
- WORD wBitsPerSample; /* number of bits per sample of mono data */
- WORD cbSize; /* the count in bytes of the size of */
- /* extra information (after cbSize) */
- }
-
- alias WAVEFORMATEX* PWAVEFORMATEX;
- alias WAVEFORMATEX *NPWAVEFORMATEX;
- alias WAVEFORMATEX* LPWAVEFORMATEX;
-
- alias WAVEFORMATEX *LPCWAVEFORMATEX;
-
- /* waveform audio function prototypes */
- UINT waveOutGetNumDevs();
-
- MMRESULT waveOutGetDevCapsA( UINT_PTR uDeviceID, LPWAVEOUTCAPSA pwoc, UINT cbwoc);
- MMRESULT waveOutGetDevCapsW( UINT_PTR uDeviceID, LPWAVEOUTCAPSW pwoc, UINT cbwoc);
-
- version(UNICODE) {
- alias waveOutGetDevCapsW waveOutGetDevCaps;
- }
- else {
- alias waveOutGetDevCapsA waveOutGetDevCaps;
- }
-
- MMRESULT waveOutGetVolume( HWAVEOUT hwo, LPDWORD pdwVolume);
- MMRESULT waveOutSetVolume( HWAVEOUT hwo, DWORD dwVolume);
- MMRESULT waveOutGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText);
- MMRESULT waveOutGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-
- version(UNICODE) {
- alias waveOutGetErrorTextW waveOutGetErrorText;
- }
- else {
- alias waveOutGetErrorTextA waveOutGetErrorText;
- }
-
- MMRESULT waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID,
- LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-
- MMRESULT waveOutClose( HWAVEOUT hwo);
- MMRESULT waveOutPrepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveOutUnprepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveOutPause( HWAVEOUT hwo);
- MMRESULT waveOutRestart( HWAVEOUT hwo);
- MMRESULT waveOutReset( HWAVEOUT hwo);
- MMRESULT waveOutBreakLoop( HWAVEOUT hwo);
- MMRESULT waveOutGetPosition( HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
- MMRESULT waveOutGetPitch( HWAVEOUT hwo, LPDWORD pdwPitch);
- MMRESULT waveOutSetPitch( HWAVEOUT hwo, DWORD dwPitch);
- MMRESULT waveOutGetPlaybackRate( HWAVEOUT hwo, LPDWORD pdwRate);
- MMRESULT waveOutSetPlaybackRate( HWAVEOUT hwo, DWORD dwRate);
- MMRESULT waveOutGetID( HWAVEOUT hwo, LPUINT puDeviceID);
-
- MMRESULT waveOutMessage( HWAVEOUT hwo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-
- UINT waveInGetNumDevs();
-
- MMRESULT waveInGetDevCapsA( UINT_PTR uDeviceID, LPWAVEINCAPSA pwic, UINT cbwic);
- MMRESULT waveInGetDevCapsW( UINT_PTR uDeviceID, LPWAVEINCAPSW pwic, UINT cbwic);
-
- version(UNICODE) {
- alias waveInGetDevCapsW waveInGetDevCaps;
- }
- else {
- alias waveInGetDevCapsA waveInGetDevCaps;
- }
-
- MMRESULT waveInGetErrorTextA(MMRESULT mmrError, LPSTR pszText, UINT cchText);
- MMRESULT waveInGetErrorTextW(MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-
- version(UNICODE) {
- alias waveInGetErrorTextW waveInGetErrorText;
- }
- else {
- alias waveInGetErrorTextA waveInGetErrorText;
- }
-
- MMRESULT waveInOpen( LPHWAVEIN phwi, UINT uDeviceID,
- LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-
- MMRESULT waveInClose( HWAVEIN hwi);
- MMRESULT waveInPrepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveInUnprepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveInAddBuffer( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT waveInStart( HWAVEIN hwi);
- MMRESULT waveInStop( HWAVEIN hwi);
- MMRESULT waveInReset( HWAVEIN hwi);
- MMRESULT waveInGetPosition( HWAVEIN hwi, LPMMTIME pmmt, UINT cbmmt);
- MMRESULT waveInGetID( HWAVEIN hwi, LPUINT puDeviceID);
- MMRESULT waveInMessage( HWAVEIN hwi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
- }
- /****************************************************************************
- MIDI audio support
- ****************************************************************************/
- version(MMNOMIDI) {
- }
- else {
- /* MIDI error return values */
- const auto MIDIERR_UNPREPARED = (MIDIERR_BASE + 0) ; /* header not prepared */
- const auto MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1) ; /* still something playing */
- const auto MIDIERR_NOMAP = (MIDIERR_BASE + 2) ; /* no configured instruments */
- const auto MIDIERR_NOTREADY = (MIDIERR_BASE + 3) ; /* hardware is still busy */
- const auto MIDIERR_NODEVICE = (MIDIERR_BASE + 4) ; /* port no longer connected */
- const auto MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5) ; /* invalid MIF */
- const auto MIDIERR_BADOPENMODE = (MIDIERR_BASE + 6) ; /* operation unsupported w/ open mode */
- const auto MIDIERR_DONT_CONTINUE = (MIDIERR_BASE + 7) ; /* thru device 'eating' a message */
- const auto MIDIERR_LASTERROR = (MIDIERR_BASE + 7) ; /* last error in range */
-
- /* MIDI audio data types */
- alias HANDLE HMIDI;
- alias HANDLE HMIDIIN;
- alias HANDLE HMIDIOUT;
- alias HANDLE HMIDISTRM;
-
- alias HMIDI *LPHMIDI;
- alias HMIDIIN *LPHMIDIIN;
- alias HMIDIOUT *LPHMIDIOUT;
- alias HMIDISTRM *LPHMIDISTRM;
-
- alias DRVCALLBACK MIDICALLBACK;
- alias MIDICALLBACK *LPMIDICALLBACK;
-
- const auto MIDIPATCHSIZE = 128;
-
- alias WORD[MIDIPATCHSIZE] PATCHARRAY;
- alias WORD *LPPATCHARRAY;
- alias WORD[MIDIPATCHSIZE] KEYARRAY;
- alias WORD *LPKEYARRAY;
-
- /* MIDI callback messages */
- const auto MIM_OPEN = MM_MIM_OPEN;
- const auto MIM_CLOSE = MM_MIM_CLOSE;
- const auto MIM_DATA = MM_MIM_DATA;
- const auto MIM_LONGDATA = MM_MIM_LONGDATA;
- const auto MIM_ERROR = MM_MIM_ERROR;
- const auto MIM_LONGERROR = MM_MIM_LONGERROR;
- const auto MOM_OPEN = MM_MOM_OPEN;
- const auto MOM_CLOSE = MM_MOM_CLOSE;
- const auto MOM_DONE = MM_MOM_DONE;
-
- const auto MIM_MOREDATA = MM_MIM_MOREDATA;
- const auto MOM_POSITIONCB = MM_MOM_POSITIONCB;
-
- /* device ID for MIDI mapper */
- const auto MIDIMAPPER = (cast(UINT)-1);
- const auto MIDI_MAPPER = (cast(UINT)-1);
-
- /* flags for dwFlags parm of midiInOpen() */
- const auto MIDI_IO_STATUS = 0x00000020L;
-
- /* flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() */
- const auto MIDI_CACHE_ALL = 1;
- const auto MIDI_CACHE_BESTFIT = 2;
- const auto MIDI_CACHE_QUERY = 3;
- const auto MIDI_UNCACHE = 4;
-
- /* MIDI output device capabilities align(2) structure */
- align(2) struct MIDIOUTCAPSA {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- WORD wTechnology; /* type of device */
- WORD wVoices; /* # of voices (internal synth only) */
- WORD wNotes; /* max # of notes (internal synth only) */
- WORD wChannelMask; /* channels used (internal synth only) */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias MIDIOUTCAPSA* PMIDIOUTCAPSA;
- alias MIDIOUTCAPSA* NPMIDIOUTCAPSA;
- alias MIDIOUTCAPSA* LPMIDIOUTCAPSA;
-
- align(2) struct MIDIOUTCAPSW {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- WORD wTechnology; /* type of device */
- WORD wVoices; /* # of voices (internal synth only) */
- WORD wNotes; /* max # of notes (internal synth only) */
- WORD wChannelMask; /* channels used (internal synth only) */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias MIDIOUTCAPSW* PMIDIOUTCAPSW;
- alias MIDIOUTCAPSW* NPMIDIOUTCAPSW;
- alias MIDIOUTCAPSW* LPMIDIOUTCAPSW;
-
- version(UNICODE) {
- alias MIDIOUTCAPSW MIDIOUTCAPS;
- alias PMIDIOUTCAPSW PMIDIOUTCAPS;
- alias NPMIDIOUTCAPSW NPMIDIOUTCAPS;
- alias LPMIDIOUTCAPSW LPMIDIOUTCAPS;
- }
- else {
- alias MIDIOUTCAPSA MIDIOUTCAPS;
- alias PMIDIOUTCAPSA PMIDIOUTCAPS;
- alias NPMIDIOUTCAPSA NPMIDIOUTCAPS;
- alias LPMIDIOUTCAPSA LPMIDIOUTCAPS;
- }
-
- align(2) struct MIDIOUTCAPS2A {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- WORD wTechnology; /* type of device */
- WORD wVoices; /* # of voices (internal synth only) */
- WORD wNotes; /* max # of notes (internal synth only) */
- WORD wChannelMask; /* channels used (internal synth only) */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias MIDIOUTCAPS2A* PMIDIOUTCAPS2A;
- alias MIDIOUTCAPS2A* NPMIDIOUTCAPS2A;
- alias MIDIOUTCAPS2A* LPMIDIOUTCAPS2A;
-
- align(2) struct MIDIOUTCAPS2W {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- WORD wTechnology; /* type of device */
- WORD wVoices; /* # of voices (internal synth only) */
- WORD wNotes; /* max # of notes (internal synth only) */
- WORD wChannelMask; /* channels used (internal synth only) */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias MIDIOUTCAPS2W* PMIDIOUTCAPS2W;
- alias MIDIOUTCAPS2W* NPMIDIOUTCAPS2W;
- alias MIDIOUTCAPS2W* LPMIDIOUTCAPS2W;
-
- version(UNICODE) {
- alias MIDIOUTCAPS2W MIDIOUTCAPS2;
- alias PMIDIOUTCAPS2W PMIDIOUTCAPS2;
- alias NPMIDIOUTCAPS2W NPMIDIOUTCAPS2;
- alias LPMIDIOUTCAPS2W LPMIDIOUTCAPS2;
- }
- else {
- alias MIDIOUTCAPS2A MIDIOUTCAPS2;
- alias PMIDIOUTCAPS2A PMIDIOUTCAPS2;
- alias NPMIDIOUTCAPS2A NPMIDIOUTCAPS2;
- alias LPMIDIOUTCAPS2A LPMIDIOUTCAPS2;
- }
-
- /* flags for wTechnology field of MIDIOUTCAPS align(2) structure */
- const auto MOD_MIDIPORT = 1 ; /* output port */
- const auto MOD_SYNTH = 2 ; /* generic internal synth */
- const auto MOD_SQSYNTH = 3 ; /* square wave internal synth */
- const auto MOD_FMSYNTH = 4 ; /* FM internal synth */
- const auto MOD_MAPPER = 5 ; /* MIDI mapper */
- const auto MOD_WAVETABLE = 6 ; /* hardware wavetable synth */
- const auto MOD_SWSYNTH = 7 ; /* software synth */
-
- /* flags for dwSupport field of MIDIOUTCAPS align(2) structure */
- const auto MIDICAPS_VOLUME = 0x0001 ; /* supports volume control */
- const auto MIDICAPS_LRVOLUME = 0x0002 ; /* separate left-right volume control */
- const auto MIDICAPS_CACHE = 0x0004;
-
- const auto MIDICAPS_STREAM = 0x0008 ; /* driver supports midiStreamOut directly */
-
- /* MIDI input device capabilities align(2) structure */
- align(2) struct MIDIINCAPSA {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias MIDIINCAPSA* PMIDIINCAPSA;
- alias MIDIINCAPSA* NPMIDIINCAPSA;
- alias MIDIINCAPSA* LPMIDIINCAPSA;
-
- align(2) struct MIDIINCAPSW {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
- DWORD dwSupport; /* functionality supported by driver */
- }
-
- alias MIDIINCAPSW* PMIDIINCAPSW;
- alias MIDIINCAPSW* NPMIDIINCAPSW;
- alias MIDIINCAPSW* LPMIDIINCAPSW;
-
- version(UNICODE) {
- alias MIDIINCAPSW MIDIINCAPS;
- alias PMIDIINCAPSW PMIDIINCAPS;
- alias NPMIDIINCAPSW NPMIDIINCAPS;
- alias LPMIDIINCAPSW LPMIDIINCAPS;
- }
- else {
- alias MIDIINCAPSA MIDIINCAPS;
- alias PMIDIINCAPSA PMIDIINCAPS;
- alias NPMIDIINCAPSA NPMIDIINCAPS;
- alias LPMIDIINCAPSA LPMIDIINCAPS;
- }
-
- align(2) struct MIDIINCAPS2A {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- CHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias MIDIINCAPS2A* PMIDIINCAPS2A;
- alias MIDIINCAPS2A* NPMIDIINCAPS2A;
- alias MIDIINCAPS2A* LPMIDIINCAPS2A;
-
- align(2) struct MIDIINCAPS2W {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- WCHAR[MAXPNAMELEN] szPname; /* product name (NULL terminated string) */
- DWORD dwSupport; /* functionality supported by driver */
- GUID ManufacturerGuid; /* for extensible MID mapping */
- GUID ProductGuid; /* for extensible PID mapping */
- GUID NameGuid; /* for name lookup in registry */
- }
-
- alias MIDIINCAPS2W* PMIDIINCAPS2W;
- alias MIDIINCAPS2W* NPMIDIINCAPS2W;
- alias MIDIINCAPS2W* LPMIDIINCAPS2W;
-
- version(UNICODE) {
- alias MIDIINCAPS2W MIDIINCAPS2;
- alias PMIDIINCAPS2W PMIDIINCAPS2;
- alias NPMIDIINCAPS2W NPMIDIINCAPS2;
- alias LPMIDIINCAPS2W LPMIDIINCAPS2;
- }
- else {
- alias MIDIINCAPS2A MIDIINCAPS2;
- alias PMIDIINCAPS2A PMIDIINCAPS2;
- alias NPMIDIINCAPS2A NPMIDIINCAPS2;
- alias LPMIDIINCAPS2A LPMIDIINCAPS2;
- }
-
- /* MIDI data block header */
- align(2) struct MIDIHDR {
- LPSTR lpData; /* pointer to locked data block */
- DWORD dwBufferLength; /* length of data in data block */
- DWORD dwBytesRecorded; /* used for input only */
- DWORD_PTR dwUser; /* for client's use */
- DWORD dwFlags; /* assorted flags (see defines) */
- MIDIHDR* lpNext; /* reserved for driver */
- DWORD_PTR reserved; /* reserved for driver */
- DWORD dwOffset; /* Callback offset into buffer */
- DWORD_PTR[8] dwReserved; /* Reserved for MMSYSTEM */
- }
-
- alias MIDIHDR* PMIDIHDR;
- alias MIDIHDR *NPMIDIHDR;
- alias MIDIHDR* LPMIDIHDR;
-
- align(2) struct MIDIEVENT {
- DWORD dwDeltaTime; /* Ticks since last event */
- DWORD dwStreamID; /* Reserved; must be zero */
- DWORD dwEvent; /* Event type and parameters */
- DWORD[1] dwParms; /* Parameters if this is a long event */
- }
-
- align(2) struct MIDISTRMBUFFVER {
- DWORD dwVersion; /* Stream buffer format version */
- DWORD dwMid; /* Manufacturer ID as defined in MMREG.H */
- DWORD dwOEMVersion; /* Manufacturer version for custom ext */
- }
-
- /* flags for dwFlags field of MIDIHDR align(2) structure */
- const auto MHDR_DONE = 0x00000001 ; /* done bit */
- const auto MHDR_PREPARED = 0x00000002 ; /* set if header prepared */
- const auto MHDR_INQUEUE = 0x00000004 ; /* reserved for driver */
- const auto MHDR_ISSTRM = 0x00000008 ; /* Buffer is stream buffer */
-
- /* */
- /* Type codes which go in the high byte of the event DWORD of a stream buffer */
- /* */
- /* Type codes 00-7F contain parameters within the low 24 bits */
- /* Type codes 80-FF contain a length of their parameter in the low 24 */
- /* bits, followed by their parameter data in the buffer. The event */
- /* DWORD contains the exact byte length; the parm data itself must be */
- /* padded to be an even multiple of 4 bytes long. */
- /* */
-
- const auto MEVT_F_SHORT = 0x00000000L;
- const auto MEVT_F_LONG = 0x80000000L;
- const auto MEVT_F_CALLBACK = 0x40000000L;
-
- template MEVT_EVENTTYPE(DWORD x) {
- const auto MEVT_EVENTTYPE = (cast(BYTE)(((x)>>24)&0xFF));
- }
- template MEVT_EVENTPARM(DWORD x) {
- const auto MEVT_EVENTPARM = (cast(DWORD)((x)&0x00FFFFFFL));
- }
- const auto MEVT_SHORTMSG = (cast(BYTE)0x00) ; /* parm = shortmsg for midiOutShortMsg */
- const auto MEVT_TEMPO = (cast(BYTE)0x01) ; /* parm = new tempo in microsec/qn */
- const auto MEVT_NOP = (cast(BYTE)0x02) ; /* parm = unused; does nothing */
- /* 0x04-0x7F reserved */
- const auto MEVT_LONGMSG = (cast(BYTE)0x80) ; /* parm = bytes to send verbatim */
- const auto MEVT_COMMENT = (cast(BYTE)0x82) ; /* parm = comment data */
- const auto MEVT_VERSION = (cast(BYTE)0x84) ; /* parm = MIDISTRMBUFFVER align(2) struct */
-
- /* 0x81-0xFF reserved */
-
- const auto MIDISTRM_ERROR = (-2);
-
- /* */
- /* Structures and defines for midiStreamProperty */
- /* */
- const auto MIDIPROP_SET = 0x80000000L;
- const auto MIDIPROP_GET = 0x40000000L;
-
- /* These are intentionally both non-zero so the app cannot accidentally */
- /* leave the operation off and happen to appear to work due to default */
- /* action. */
-
- const auto MIDIPROP_TIMEDIV = 0x00000001L;
- const auto MIDIPROP_TEMPO = 0x00000002L;
-
- align(2) struct MIDIPROPTIMEDIV {
- DWORD cbStruct;
- DWORD dwTimeDiv;
- }
-
- alias MIDIPROPTIMEDIV* LPMIDIPROPTIMEDIV;
-
- align(2) struct MIDIPROPTEMPO {
- DWORD cbStruct;
- DWORD dwTempo;
- }
- alias MIDIPROPTEMPO* LPMIDIPROPTEMPO;
-
- /* MIDI function prototypes */
- UINT midiOutGetNumDevs();
-
- MMRESULT midiStreamOpen( LPHMIDISTRM phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
- MMRESULT midiStreamClose( HMIDISTRM hms);
-
- MMRESULT midiStreamProperty( HMIDISTRM hms, LPBYTE lppropdata, DWORD dwProperty);
- MMRESULT midiStreamPosition( HMIDISTRM hms, LPMMTIME lpmmt, UINT cbmmt);
-
- MMRESULT midiStreamOut( HMIDISTRM hms, LPMIDIH…