waveOutPrepareHeader

The waveOutPrepareHeader function prepares a waveform-audio data block for playback.

MMRESULT waveOutPrepareHeader(
  HWAVEOUT hwo,  
  LPWAVEHDR pwh, 
  UINT cbwh      
);

Parameters

hwo

Handle to the waveform-audio output device.

pwh

Pointer to a WAVEHDR structure that identifies the data block to be prepared.

cbwh

Size, in bytes, of the WAVEHDR structure.

Return Values

Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.

Value Description
MMSYSERR_INVALHANDLE Specified device handle is invalid.
MMSYSERR_NODRIVER No device driver is present.
MMSYSERR_NOMEM Unable to allocate or lock memory.

Remarks

The lpData, dwBufferLength, and dwFlags members of the WAVEHDR structure must be set before calling this function. The dwFlags member must be set to WHDR_PREPARED, WHDR_BEGINLOOP, or WHDR_ENDLOOP.

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.

See Also

Waveform Audio, Waveform Functions, WAVEHDR, waveOutWrite