waveOutUnprepareHeader

  MMRESULT waveOutUnprepareHeader(hWaveOut, lpWaveOutHdr, wSize)    
  HWAVEOUT hWaveOut;    
  LPWAVEHDR lpWaveOutHdr;    
  UINT wSize;    

The waveOutUnprepareHeader function cleans up the preparation performed by waveOutPrepareHeader. The function must be called after the device driver is finished with a data block. You must call this function before freeing the data buffer.

Parameters

hWaveOut

Specifies a handle to the waveform output device.

lpWaveOutHdr

Specifies a pointer to a WAVEHDR structure identifying the data block to be cleaned up.

wSize

Specifies the size of the WAVEHDR structure.

Return Value

Returns zero if the function was successful. Otherwise, it returns an error number. Possible error returns are:

Value Meaning

MMSYSERR_INVALHANDLE Specified device handle is invalid.
WAVERR_STILLPLAYING lpWaveOutHdr is still in the queue.
MMSYSERR_HANDLEBUSY The handle hWaveOut is in use on another thread.

Comments

This function is the complementary function to waveOutPrepareHeader. You must call this function before freeing the data buffer with GlobalFree. After passing a buffer to the device driver with waveOutWrite, you must wait until the driver is finished with the buffer before calling waveOutUnprepareHeader.

Unpreparing a buffer that has not been prepared has no effect, and the function returns zero.

See Also

waveOutPrepareHeader