MIDM_ADDBUFFER

This message is sent to a MIDI input device driver to add a buffer to the input queue.

Parameters

DWORD dwParam1

Specifies a far pointer to a MIDIHDR data structure identifying the buffer.

DWORD dwParam2

Specifies the size of the MIDIHDR structure.

Return Value

The return value is an error code, or zero (MMSYSERR_NOERROR) if the operation is successful. Possible error codes are:

MMSYSERR_NOTENABLED

The driver failed to load or initialize.

MIDIERR_UNPREPARED

The specified data buffer has not been prepared for input.

Comments

The driver should first check the MHDR_PREPARED bit in the dwFlags field of the MIDIHDR structure. If the bit is not set, the driver should return MIDIERR_UNPREPARED. The driver should clear the MHDR_DONE bit and set the MHDR_INQUEUE bit in the header structure, and place the data block in its input queue. Then the driver should return control to the client by returning MMSYSERR_NOERROR.

Input to the buffer should occur as an interrupt-driven process. Only system-exclusive data should be placed in the buffer. Other MIDI events should be sent directly to the client application by sending a MIM_DATA message with the DriverCallback function.

Recording begins when the driver receives a MIDM_START message. Once the data block has been filled with data, the driver should set the MHDR_DONE bit and clear the MHDR_INQUEUE bit before notifying the client by using DriverCallback to send a MIM_DATA message.

If the driver receives data with no buffers in its input queue, it should ignore the data without notifying the client.