WAVEHDR

The WAVEHDR structure defines the header used to identify a waveform data buffer.

typedef struct wavehdr_tag {

LPSTR lpData;

DWORD dwBufferLength;

DWORD dwBytesRecorded;

DWORD dwUser;

DWORD dwFlags;

DWORD dwLoops;

struct wavehdr_tag far * lpNext;

DWORD reserved;

} WAVEHDR;

Fields

The WAVEHDR structure has the following fields:

lpData

Specifies a far pointer to the waveform data buffer.

dwBufferLength

Specifies the length of the data buffer.

dwBytesRecorded

When the header is used in input, this specifies how much data is in the buffer.

dwUser

Specifies 32 bits of user data.

dwFlags

Specifies flags giving information about the data buffer.

WHDR_DONE

Set by the device driver to indicate that it is finished with the data buffer and is returning it to the application.

WHDR_BEGINLOOP

Specifies that this buffer is the first buffer in a loop. This flag is only used with output data buffers.

WHDR_ENDLOOP

Specifies that this buffer is the last buffer in a loop. This flag is only used with output data buffers.

WHDR_PREPARED

Set by the device driver to indicate that the data buffer has been prepared with waveInPrepareHeader or waveOutPrepareHeader.

WHDR_INQUEUE

Set by the device driver to indicate that the data buffer is queued for playback.

dwLoops

Specifies the number of times to play the loop. This parameter is used only with output data buffers.

lpNext

Is reserved for use by the device driver to point to the next WAVEHDR structure in the queue.

reserved

Is reserved for use by the device driver. This field can be used to store a pointer to a structure containing information about the client.

Comments

Use the WHDR_BEGINLOOP and WHDR_ENDLOOP flags in the dwFlags field to specify the beginning and ending data blocks for looping. To loop on a single block, specify both flags for the same block. Use the dwLoops field in the WAVEHDR structure for the first block in the loop to specify the number of times to play the loop.