waveOutWrite

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

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

Parameters

hWaveOut

Specifies a handle to the waveform output device.

lpWaveOutHdr

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

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_UNPREPARED lpWaveOutHdr hasn't been prepared.
MMSYSERR_HANDLEBUSY The handle hWaveOut is in use on another thread.

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