WODM_WRITE

This message is used in an MMDRV_MESSAGE_PARAMS structure passed to the WAV_IOControl function to request a waveform output driver to write a waveform data block to the specified device.

Parameters

uDeviceId
Device identifier—0, 1, 2, and so on—for the target device.
uMsg
Specifies this message.
dwUser
Specifies a device instance identifier.
dwParam1
Pointer to a WAVEHDR structure identifying the buffer.
dwParam2
Specifies the size, in bytes, of WAVEHDR.

Return Values

MMSYSERR_NOERROR indicates success. Otherwise, the driver returns one of the MMSYSERR or WAVEERR error values declared in the Mmsystem.h header file.

Remarks

The ACM sends this message by calling the audio driver’s WAV_IOControl entry point through the DeviceIoControl function.

If the WHDR_PREPARED flag in the dwFlags member of WAVEHDR is not set, the driver returns WAVERR_UNPREPARED.

Unless the device has been paused with a WODM_PAUSE message, the driver begins playback the first time it receives this message.

Waveform output drivers handle output asynchronously by creating a separate thread to handle communication with the hardware. Typically, the original thread queues the output buffer, sets its WHDR_INQUEUE flag, clears its WHDR_DONE flag in WAVEHDR, and returns control to the client.

The driver continues sending buffers to the audio circuit until the client sends WODM_PAUSE or WIDM_RESET.

The driver usually is responsible for implementing waveform looping. The driver should check each buffer’s WAVEHDR structure for WHDR_BEGINLOOP and WHDR_ENDLOOP flags, along with an iteration count in the dwLoops member of the structure.