MODM_LONGDATA

The MODM_LONGDATA message requests a MIDI output driver to send the contents of a specified output buffer containing one or more MIDI events, including system-exclusive events.

Parameters
uDeviceId
Device identifier (0, 1, 2, and so on) for the target device.
uMsg
MODM_LONGDATA
dwUser
Device instance identifier.
dwParam1
Pointer to a MIDIHDR structure identifying the output buffer. (The MIDIHDR structure is described in the Win32 SDK.)
dwParam2
Size of the MIDIHDR structure.
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 midiOutLongMsg return values in the Win32 SDK.

Comments

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

If the MHDR_PREPARED flag in the dwFlags member of MIDIHDR is not set, the driver should return MIDIERR_UNPREPARED.

The driver should clear the MHDR_DONE flag, set the MHDR_INQUEUE flag, and place the output buffer in its output queue. The driver returns control to the client by returning MMSYSERR_NOERROR.

When the buffer contents have been sent, the driver should set the MHDR_DONE flag, clear the MHDR_INQUEUE flag, and send the client a MOM_DONE callback message.

The driver can be designed to handle MODM_LONGDATA messages synchronously, not returning until the message has been sent to the kernel-mode driver, or asynchronously, returning immediately and using a separate thread to send the MIDI data in the background.

Typically, the user-mode driver sends the buffer to the kernel-mode driver by calling DeviceIoControl with an IOCTL_MIDI_PLAY control code.

If clients use high-level audio interfaces, winmm.dll guarantees that the input buffer contains only a single MIDI event, which can be either a short or long (system-exclusive) message. On the other hand, if clients call midiOutLongMsg, there is no such guarantee. If your user-mode driver is mmdrv.dll or is based on drvlib.lib functions, whatever is received in the input buffer is passed directly to the kernel-mode driver by means of the DeviceIoControl call.