home *** CD-ROM | disk | FTP | other *** search
- /*++
-
- Copyright (c) 1995-1998 Microsoft Corporation
-
- Module Name:mmsystem.h -- Include file for Multimedia API's
-
- * If defined, the following flags inhibit inclusion
- * of the indicated items:
- *
- * MMNOSOUND Sound support
- * MMNOWAVE Waveform support
- *
- */
-
- #ifndef _INC_MMSYSTEM
- #define _INC_MMSYSTEM // to prevent multiple inclusion of mmsystem.h
-
- #include "pshpack1.h" // Assume byte packing throughout
-
- #ifdef __cplusplus
- extern "C" { // Assume C declarations for C++
- #endif // __cplusplus
-
- /****************************************************************************
-
- General constants and data types
-
- ****************************************************************************/
-
- /* general constants */
- #define MAXPNAMELEN 32 // max product name length (including NULL)
- #define MAXERRORLENGTH 128 // max error text length (including final NULL)
-
- /*
- * Microsoft Manufacturer and Product ID's
- *
- Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS,
- MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures.
- */
- /*
- * (these have been moved to
- * MMREG.H for Windows 4.00 and above).
- */
- /* manufacturer IDs */
- #ifndef MM_MICROSOFT
- #define MM_MICROSOFT 1 // Microsoft Corporation
- #endif // MM_MICROSOFT
-
-
-
- /* general data types */
- typedef UINT MMVERSION; // major (high byte), minor (low byte)
-
- typedef UINT MMRESULT; // error return code, 0 means no error
- // call as if(err=xxxx(...)) Error(err); else
-
- #define _MMRESULT_ // ??? Not needed for NT, but probably harmless.
-
- typedef UINT *LPUINT;
-
-
- /* MMTIME data structure */
- typedef struct mmtime_tag
- {
- UINT wType; /* indicates the contents of the union */
- union
- {
- DWORD ms; /* milliseconds */
- DWORD sample; /* samples */
- DWORD cb; /* byte count */
- DWORD ticks; /* ticks in MIDI stream */
-
- /* SMPTE */
- struct
- {
- BYTE hour; /* hours */
- BYTE min; /* minutes */
- BYTE sec; /* seconds */
- BYTE frame; /* frames */
- BYTE fps; /* frames per second */
- BYTE dummy; /* pad */
- #ifdef _WIN32
- BYTE pad[2];
- #endif
- } smpte;
-
- /* MIDI */
- struct
- {
- DWORD songptrpos; /* song pointer position */
- } midi;
- } u;
- } MMTIME, *PMMTIME, NEAR *NPMMTIME, FAR *LPMMTIME;
-
- /* types for wType field in MMTIME struct */
- #define TIME_MS 0x0001 /* time in milliseconds */
- #define TIME_SAMPLES 0x0002 /* number of wave samples */
- #define TIME_BYTES 0x0004 /* current byte offset */
- #define TIME_SMPTE 0x0008 /* SMPTE time */
- #define TIME_MIDI 0x0010 /* MIDI time */
- #define TIME_TICKS 0x0020 /* Ticks within MIDI stream */
-
- #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
- ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
- ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
-
- #define mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3)
-
- /****************************************************************************
-
- Multimedia Extensions Window Messages
-
- ****************************************************************************/
-
- #define MM_WOM_OPEN 0x3BB /* waveform output */
- #define MM_WOM_CLOSE 0x3BC
- #define MM_WOM_DONE 0x3BD
-
- #define MM_WIM_OPEN 0x3BE /* waveform input */
- #define MM_WIM_CLOSE 0x3BF
- #define MM_WIM_DATA 0x3C0
-
-
- /* these are used by msacm.h */
- #define MM_STREAM_OPEN 0x3D4
- #define MM_STREAM_CLOSE 0x3D5
- #define MM_STREAM_DONE 0x3D6
- #define MM_STREAM_ERROR 0x3D7
-
-
- /****************************************************************************
-
- String resource number bases (internal use)
-
- ****************************************************************************/
-
- #define MMSYSERR_BASE 0
- #define WAVERR_BASE 32
-
- /****************************************************************************
-
- General error return values
-
- ****************************************************************************/
-
- /* general error return values */
- #define MMSYSERR_NOERROR 0 /* no error */
- #define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
- #define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
- #define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
- #define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
- #define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
- #define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
- #define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
- #define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
- #define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
- #define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
- #define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */
- #define MMSYSERR_HANDLEBUSY (MMSYSERR_BASE + 12) /* handle being used */
- /* simultaneously on another */
- /* thread (eg callback) */
- #define MMSYSERR_INVALIDALIAS (MMSYSERR_BASE + 13) /* specified alias not found */
- #define MMSYSERR_BADDB (MMSYSERR_BASE + 14) /* bad registry database */
- #define MMSYSERR_KEYNOTFOUND (MMSYSERR_BASE + 15) /* registry key not found */
- #define MMSYSERR_READERROR (MMSYSERR_BASE + 16) /* registry read error */
- #define MMSYSERR_WRITEERROR (MMSYSERR_BASE + 17) /* registry write error */
- #define MMSYSERR_DELETEERROR (MMSYSERR_BASE + 18) /* registry delete error */
- #define MMSYSERR_VALNOTFOUND (MMSYSERR_BASE + 19) /* registry value not found */
- #define MMSYSERR_NODRIVERCB (MMSYSERR_BASE + 20) /* driver does not call DriverCallback */
- #define MMSYSERR_LASTERROR (MMSYSERR_BASE + 20) /* last error in range */
-
-
- /****************************************************************************
-
- Driver callback support
-
- ****************************************************************************/
-
- /* flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and */
- /* midiOutOpen() to specify the type of the dwCallback parameter. */
-
- #define CALLBACK_TYPEMASK 0x00070000l /* callback type mask */
- #define CALLBACK_NULL 0x00000000l /* no callback */
- #define CALLBACK_WINDOW 0x00010000l /* dwCallback is a HWND */
- #define CALLBACK_TASK 0x00020000l /* dwCallback is a HTASK */
- #define CALLBACK_FUNCTION 0x00030000l /* dwCallback is a FARPROC */
- #define CALLBACK_THREAD (CALLBACK_TASK)/* thread ID replaces 16 bit task */
- #define CALLBACK_EVENT 0x00050000l /* dwCallback is an EVENT Handle */
-
-
- typedef void (CALLBACK DRVCALLBACK)(HANDLE hdrvr, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
-
- typedef DRVCALLBACK FAR *LPDRVCALLBACK;
- typedef DRVCALLBACK *PDRVCALLBACK;
-
-
- #ifndef MMNOSOUND
-
- BOOL APIENTRY sndPlaySoundW( LPCWSTR lpszSoundName, UINT fuSound );
- #ifdef UNICODE
- #define sndPlaySound sndPlaySoundW
- #else
- #define sndPlaySound sndPlaySoundA
- #endif // !UNICODE
-
- BOOL WINAPI PlaySoundA( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
- BOOL WINAPI PlaySoundW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
- #ifdef UNICODE
- #define PlaySound PlaySoundW
- #else
- #define PlaySound PlaySoundA
- #endif // !UNICODE
-
-
-
- /*
- * flag values for fuSound arguments on [snd]PlaySound
- * or dwFlags for PlaySound
- */
-
- /* sndAlias creates the alias identifier */
- #define sndAlias( ch0, ch1 ) \
- ( SND_ALIAS_START + (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ))
-
- #define SND_ALIAS_SYSTEMASTERISK sndAlias('S', '*')
- #define SND_ALIAS_SYSTEMQUESTION sndAlias('S', '?')
- #define SND_ALIAS_SYSTEMHAND sndAlias('S', 'H')
- #define SND_ALIAS_SYSTEMEXIT sndAlias('S', 'E')
- #define SND_ALIAS_SYSTEMSTART sndAlias('S', 'S')
- #define SND_ALIAS_SYSTEMWELCOME sndAlias('S', 'W')
- #define SND_ALIAS_SYSTEMEXCLAMATION sndAlias('S', '!')
- #define SND_ALIAS_SYSTEMDEFAULT sndAlias('S', 'D')
-
- #define SND_ALIAS 0x00010000 // name is a WIN.INI [sounds] entry
- #define SND_FILENAME 0x00020000 // name is a file name
- #define SND_RESOURCE 0x00040004 // name is a resource name or atom
-
- #define SND_SYNC 0x00000000 // play synchronously (default)
- #define SND_ASYNC 0x00000001 // play asynchronously
- #define SND_NODEFAULT 0x00000002 // silence not default, if sound not found
- #define SND_MEMORY 0x00000004 // lpszSoundName points to a memory file
- #define SND_LOOP 0x00000008 // loop the sound until next sndPlaySound
- #define SND_NOSTOP 0x00000010 // don't stop any currently playing sound
-
- #define SND_NOWAIT 0x00002000 // don't wait if the driver is busy
- #define SND_VALIDFLAGS 0x0017201F // Set of valid flag bits. Anything outside
- // this range will raise an error
- #define SND_RESERVED 0xFF000000 // In particular these flags are reserved
- #define SND_TYPE_MASK 0x00170007
- #define SND_ALIAS_ID 0x00110000 // name is a WIN.INI [sounds] entry identifier
- #define SND_ALIAS_START 0 // ??? must be > 4096 to keep strings in same section of resource file
-
-
-
-
-
-
- typedef HANDLE HDRVR;
- typedef HANDLE HMMIO; // a handle to an open file
-
-
- #endif // ifndef MMNOSOUND
-
- #ifndef MMNOWAVE
- /****************************************************************************
-
- Waveform audio support
-
- ****************************************************************************/
-
- /* waveform audio error return values */
- #define WAVERR_BADFORMAT (WAVERR_BASE + 0) // unsupported wave format
- #define WAVERR_STILLPLAYING (WAVERR_BASE + 1) // still something playing
- #define WAVERR_UNPREPARED (WAVERR_BASE + 2) // header not prepared
- #define WAVERR_SYNC (WAVERR_BASE + 3) // device is synchronous
- #define WAVERR_LASTERROR (WAVERR_BASE + 3) // last error in range
-
- /* waveform audio data types */
- DECLARE_HANDLE(HWAVE);
- DECLARE_HANDLE(HWAVEIN);
- DECLARE_HANDLE(HWAVEOUT);
-
- typedef HWAVEIN FAR *LPHWAVEIN;
- typedef HWAVEOUT FAR *LPHWAVEOUT;
- typedef DRVCALLBACK WAVECALLBACK;
- typedef WAVECALLBACK FAR *LPWAVECALLBACK;
-
- /* wave callback messages */
- #define WOM_OPEN MM_WOM_OPEN
- #define WOM_CLOSE MM_WOM_CLOSE
- #define WOM_DONE MM_WOM_DONE
- #define WIM_OPEN MM_WIM_OPEN
- #define WIM_CLOSE MM_WIM_CLOSE
- #define WIM_DATA MM_WIM_DATA
-
- /* device ID for wave device mapper */
- /* device ID for wave device mapper */
- #define WAVE_MAPPER ((DWORD)(-1))
-
- /* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
- #define WAVE_FORMAT_QUERY 0x00000001
- #define WAVE_ALLOWSYNC 0x00000002
- #define WAVE_MAPPED 0x00000004
- #define WAVE_FORMAT_DIRECT 0x00000008
- #define WAVE_FORMAT_DIRECT_QUERY (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT)
-
-
- /* general waveform format (information common to all formats) */
- /* as read from a file. See Multimedia file formats in Programmer Reference */
- typedef struct {
- 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
- } WAVEFORMAT;
- typedef WAVEFORMAT *PWAVEFORMAT;
- typedef WAVEFORMAT *NPWAVEFORMAT;
- typedef WAVEFORMAT *LPWAVEFORMAT;
- typedef CONST WAVEFORMAT *LPCWAVEFORMAT;
-
- /* flags for wFormatTag field of WAVEFORMAT */
- #define WAVE_FORMAT_PCM 1 // Needed in resource files so outside #ifndef RC_INVOKED #endif
-
-
-
- /* specific waveform format for PCM data */
- typedef struct tagPCMWAVEFORMAT {
- WAVEFORMAT wf;
- WORD wBitsPerSample; // corresponds to MCI_WAVE_SET_.... structure
- } PCMWAVEFORMAT;
- typedef PCMWAVEFORMAT *PPCMWAVEFORMAT;
- typedef PCMWAVEFORMAT *NPPCMWAVEFORMAT;
- typedef PCMWAVEFORMAT *LPPCMWAVEFORMAT;
-
-
- /* wave data block header */
- typedef struct wavehdr_tag {
- LPSTR lpData; /* pointer to locked data buffer */
- DWORD dwBufferLength; /* length of data buffer */
- DWORD dwBytesRecorded; /* used for input only */
- DWORD dwUser; /* for client's use */
- DWORD dwFlags; /* assorted flags (see defines) */
- DWORD dwLoops; /* loop control counter */
- struct wavehdr_tag FAR *lpNext; /* reserved for driver */
- DWORD reserved; /* reserved for driver */
- } WAVEHDR, *PWAVEHDR, NEAR *NPWAVEHDR, FAR *LPWAVEHDR;
-
- /* flags for dwFlags field of WAVEHDR */
- #define WHDR_DONE 0x00000001 /* done bit */
- #define WHDR_PREPARED 0x00000002 /* set if this header has been prepared */
- #define WHDR_BEGINLOOP 0x00000004 /* loop start block */
- #define WHDR_ENDLOOP 0x00000008 /* loop end block */
- #define WHDR_INQUEUE 0x00000010 /* reserved for driver */
-
- /* waveform output device capabilities structure */
- typedef struct tagWAVEOUTCAPS {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- TCHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of sources supported */
- WORD wReserved1; /* packing */
- DWORD dwSupport; /* functionality supported by driver */
- } WAVEOUTCAPS, *PWAVEOUTCAPS, *NPWAVEOUTCAPS, *LPWAVEOUTCAPS;
-
-
- /* flags for dwSupport field of WAVEOUTCAPS */
- #define WAVECAPS_PITCH 0x0001 /* supports pitch control */
- #define WAVECAPS_PLAYBACKRATE 0x0002 /* supports playback rate control */
- #define WAVECAPS_VOLUME 0x0004 /* supports volume control */
- #define WAVECAPS_LRVOLUME 0x0008 /* separate left-right volume control */
- #define WAVECAPS_SYNC 0x0010
- #define WAVECAPS_SAMPLEACCURATE 0x0020
- #define WAVECAPS_DIRECTSOUND 0x0040
-
- /* waveform input device capabilities structure */
- typedef struct tagWAVEINCAPS {
- WORD wMid; /* manufacturer ID */
- WORD wPid; /* product ID */
- MMVERSION vDriverVersion; /* version of the driver */
- TCHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
- DWORD dwFormats; /* formats supported */
- WORD wChannels; /* number of channels supported */
- WORD wReserved1; /* structure packing */
- } WAVEINCAPS, *PWAVEINCAPS, *NPWAVEINCAPS, *LPWAVEINCAPS;
-
- /* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
- #define WAVE_INVALIDFORMAT 0x00000000 /* invalid format */
- #define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
- #define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
- #define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
- #define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
- #define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
- #define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
- #define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
- #define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
- #define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
- #define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
- #define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
- #define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
-
-
-
- #ifndef _WAVEFORMATEX_
- #define _WAVEFORMATEX_
-
- /*
- * extended waveform format structure used for all non-PCM formats. this
- * structure is common to all non-PCM formats.
- */
- typedef struct tWAVEFORMATEX
- {
- 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) */
- } WAVEFORMATEX, *PWAVEFORMATEX, NEAR *NPWAVEFORMATEX, FAR *LPWAVEFORMATEX;
- typedef const WAVEFORMATEX FAR *LPCWAVEFORMATEX;
-
- #endif /* _WAVEFORMATEX_ */
-
-
- /* waveform audio function prototypes */
- UINT WINAPI waveOutGetNumDevs(void);
- MMRESULT WINAPI waveOutGetDevCaps(UINT uDeviceID, LPWAVEOUTCAPS pwoc, UINT cbwoc);
- MMRESULT WINAPI waveOutGetVolume(HWAVEOUT hwo, LPDWORD pdwVolume);
- MMRESULT WINAPI waveOutSetVolume(HWAVEOUT hwo, DWORD dwVolume);
- MMRESULT WINAPI waveOutGetErrorText(MMRESULT mmrError, LPTSTR pszText, UINT cchText);
- MMRESULT WINAPI waveOutClose(HWAVEOUT hwo);
- MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveOutPause(HWAVEOUT hwo);
- MMRESULT WINAPI waveOutRestart(HWAVEOUT hwo);
- MMRESULT WINAPI waveOutReset(HWAVEOUT hwo);
- MMRESULT WINAPI waveOutBreakLoop(HWAVEOUT hwo);
- MMRESULT WINAPI waveOutGetPosition(HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
- MMRESULT WINAPI waveOutGetPitch(HWAVEOUT hwo, LPDWORD pdwPitch);
- MMRESULT WINAPI waveOutSetPitch(HWAVEOUT hwo, DWORD dwPitch);
- MMRESULT WINAPI waveOutGetPlaybackRate(HWAVEOUT hwo, LPDWORD pdwRate);
- MMRESULT WINAPI waveOutSetPlaybackRate(HWAVEOUT hwo, DWORD dwRate);
- MMRESULT WINAPI waveOutGetID(HWAVEOUT hwo, LPUINT puDeviceID);
- MMRESULT WINAPI waveOutMessage(HWAVEOUT hwo, UINT uMsg, DWORD dw1, DWORD dw2);
- MMRESULT WINAPI waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
- LPCWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen);
-
-
- UINT WINAPI waveInGetNumDevs(void);
- MMRESULT WINAPI waveInGetDevCaps(UINT uDeviceID, LPWAVEINCAPS pwic, UINT cbwic);
- MMRESULT WINAPI waveInGetErrorText(MMRESULT mmrError, LPTSTR pszText, UINT cchText);
- MMRESULT WINAPI waveInClose(HWAVEIN hwi);
- MMRESULT WINAPI waveInPrepareHeader(HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveInUnprepareHeader(HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveInAddBuffer(HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
- MMRESULT WINAPI waveInStart(HWAVEIN hwi);
- MMRESULT WINAPI waveInStop(HWAVEIN hwi);
- MMRESULT WINAPI waveInReset(HWAVEIN hwi);
- MMRESULT WINAPI waveInGetPosition(HWAVEIN hwi, LPMMTIME pmmt, UINT cbmmt);
- MMRESULT WINAPI waveInGetID(HWAVEIN hwi, LPUINT puDeviceID);
- MMRESULT WINAPI waveInMessage(HWAVEIN hwi, UINT uMsg, DWORD dw1, DWORD dw2);
- MMRESULT WINAPI waveInOpen(LPHWAVEIN phwi, UINT uDeviceID,
- LPCWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen);
-
-
-
- #endif /* ifndef MMNOWAVE */
-
-
-
- #ifdef __cplusplus
- } // End of extern "C" {
- #endif // __cplusplus
-
- #include "poppack.h" /* Revert to default packing */
-
- #endif // _INC_MMSYSTEM
-