MIDM_START

The MIDM_START message requests a MIDI input driver to begin recording.

Parameters

uDeviceId

Device identifier (0, 1, 2, and so on) for the target device.

uMsg

MIDM_START

dwUser

Device instance identifier.

dwParam1

Not used.

dwParam2

Not used.

Return Value

The driver should return MMSYSERR_NOERROR if the operation succeeds. Otherwise it should return one of the MMSYSERR or MIDIERR error codes defined in mmsystem.h. See midiInStart return values in the Win32 SDK.

Comments

A client sends the MIDM_START message by calling the user-mode driver’s midMessage entry point, passing the specified parameters.

This message resets the time stamp to zero. If the message is received after input has been started, the driver should return MMSYSERR_NOERROR.

Typically, the user-mode driver starts recording by calling ReadFileEx, to fill internal buffers with data returned by the kernel-mode driver, and by calling DeviceIoControl, to send the kernel-mode driver an IOCTL_MIDI_SET_STATE control code. When the kernel-mode driver returns a filled buffer, the user-mode driver should read the buffer data to differentiate short MIDI messages from long MIDI messages. The user-mode driver returns each short message to the client by means of a MIM_DATA callback message. It should copy long messages into the user-specified input buffers (see MIDM_ADDBUFFER) and, when a buffer is full, do the following:

·Set the dwBytesRecorded member in the buffer’s MIDIHDR structure.

·Set the buffer’s MHDR_DONE flag.

·Clear the buffer’s MHDR_INQUEUE flag.

·Send a MIM_LONGDATA callback message to the client.

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

Recording should continue until the client sends MIDM_STOP or MIDM_RESET.

For additional information, see Transferring MIDI Input Data.