Share via


waveOutPrepareHeader function

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

Syntax

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 value

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

Return code Description
MMSYSERR_INVALHANDLE

Specified device handle is invalid.

MMSYSERR_NODRIVER

No device driver is present.

MMSYSERR_NOMEM

Unable to allocate or lock memory.

 

Remarks

Set the lpData, dwBufferLength, and dwFlags members of the WAVEHDR structure before calling this function. Set the dwFlags member to zero.

The dwFlags, dwBufferLength, and dwLoops members of the WAVEHDR structure can change between calls to this function and the waveOutWrite function. If you change the size specified by dwBufferLength before the call to waveOutWrite, the new value must be less than the prepared value.

If the method succeeds, the WHDR_PREPARED flag is set in the dwFlags member of the WAVEHDR structure.

Preparing a header that has already been prepared has no effect, and the function returns zero.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Mmsystem.h (include Windows.h)

Library

Winmm.lib

DLL

Winmm.dll

See also

Waveform Audio

Waveform Functions