MODM_LONGDATA function
WINMM sends the MODM_LONGDATA
message to the modMessage function of a MIDI output driver when a client application wants the driver to make a data block available as output. This data block typically contains one or more MIDI events, including system-exclusive events. If the data block contains more than one MIDI event, the events are packed into the data block with no padding.
If a client of the MIDI output driver wants to send a single MIDI event, it is more efficient to use the MODM_DATA message.
Syntax
DWORD modMessage(
UINT uDeviceID,
UINT uMsg,
DWORD_PTR dwUser,
DWORD_PTR dwParam1,
DWORD_PTR dwParam2
);
Parameters
uDeviceID
Specifies the ID of the target device. Device IDs are sequential and have an initial value of zero and a final value that is equal to one less than the number of devices that the driver supports.uMsg
WINMM sets this parameter to MODM_LONGDATA when it calls modMessage to process this message.dwUser
Use this parameter to return instance data to the driver. Drivers that support multiple clients can use this instance data to track the client that is associated with the message.dwParam1
This parameter specifies a far pointer to MIDIHDR data structure that identifies the data block.dwParam2
This parameter specifies the size of the MIDIHDR structure.
Return value
The modMessage function returns MMSYSERR_NOERROR if the operation is successful. Otherwise, it returns one of the error messages in the following table.
Return code | Description |
---|---|
MMSYSERR_NOTENABLED | The driver failed to load or initialize. |
MIDIERR_UNPREPARED | The specified data block has not been prepared. |
MIDIERR_NOTREADY | The MIDI hardware is busy processing other data. |
Remarks
The driver must first check the MHDR_PREPARED bit in the dwFlags field of the MIDIHDR structure. If the bit is not set, the driver must return MIDIERR_UNPREPARED. The driver must also clear the MHDR_DONE bit, set the MHDR_INQUEUE bit, and place the data block in its output queue. Then the driver must return control to the client by returning MMSYSERR_NOERROR.
After the data block has been sent as an output, the driver must set the MHDR_DONE bit and clear the MHDR_INQUEUE bit before it notifies the client by using DriverCallback to send a MOM_DONE message.
The driver developer can design the driver to not return until the message has been sent to the output device. Alternatively, the driver can return immediately, but work in the background to send the MIDI data as output. The driver must maintain MIDI status across multiple MODM_DATA and MODM_LONGDATA
calls.
Requirements
Target platform |
Desktop |
Version |
Available in Windows XP and later Windows operating systems. |
Header |
Mmddk.h (include Mmddk.h, Mmsystem.h, or Windows.h) |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for