waveOutWrite

Syntax

WORD waveOutWrite(hWaveOut, lpWaveOutHdr, wSize)

This function sends a data block to the specified waveform output device.

Parameters

HWAVEOUT hWaveOut

Specifies a handle to the waveform output device.

LPWAVEHDR lpWaveOutHdr

Specifies a far pointer to a WAVEHDR structure containing information about the data block.

WORD 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:

MMSYSERR_INVALHANDLE

Specified device handle is invalid.

WAVERR_UNPREPARED

lpWaveOutHdr hasn't been prepared.

Comments

The data buffer must be prepared with waveOutPrepareHeader before it is passed to waveOutWrite. The WAVEHDR data structure and the data buffer pointed to by its lpData field must be allocated with GlobalAlloc using the GMEM_MOVEABLE and GMEM_SHARE flags, and locked with GlobalLock. Unless the device is paused by calling waveOutPause, playback begins when the first data block is sent to the device.

See Also

waveOutPrepareHeader, waveOutPause, waveOutReset, waveOutRestart