MMRESULT waveOutPrepareHeader(
HWAVEOUT hwo, /* 波形音频输出设备的句柄 */
LPWAVEHDR pwh, /* 一个WAVEHDR结构的指针 */
UINT cbwh /* WAVEHDR结构的大小,以字节 */
);
返回值:
如果成功,返回MMSYSERR_NOERROR.否则,返回错误,可能的错误值为:
Value | Description |
MMSYSERR_INVALHANDLE | Specified device handle is invalid. |
MMSYSERR_NODRIVER | No device driver is present. |
MMSYSERR_NOMEM | Unable to allocate or lock memory. |
备注:
调用此函数之前必须设置WAVEHDR结构的lpData,dwBufferLength,dwFlags中成员。 dwFlags成员必须设置为WHDR_PREPARED,WHDR_BEGINLOOP,或WHDR_ENDLOOP。
/* 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 */ 0001 0000 :16
依次是:1,2,4,8,16
0000 0001
0000 0010
0000 0100
0000 1000
0001 0000
The dwFlags , dwBufferLength , and dwLoops members of the WAVEHDR structure can change between calls to this function and the waveOutWrite function. (The only flags that can change in this interval for the dwFlags member are WHDR_BEGINLOOP and WHDR_ENDLOOP.) If you change the size specified by dwBufferLength before the call to waveOutWrite , the new value must be less than the prepared value.
Preparing a header that has already been prepared has no effect, and the function returns zero.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib.