Microsoft DirectX 9.0

Using DirectMusic Messages

Data passes through the DirectMusic performance and to the synthesizer in the form of messages. For the most part, messages are created and processed behind the scenes, and your application might never have to work directly with them. However, a basic knowledge of messages can help you understand how DirectMusic works, and a more thorough understanding will enable you to use messages for greater control over the performance.

DirectMusic uses two different kinds of messages:

Applications don't deal directly with MIDI messages. When a segment is played, all its data is in the form of performance messages and stays that way until it reaches the final output tool, which converts it to MIDI message format before sequencing it to the synthesizer. However, some performance messages contain information similar to that in standard MIDI messages. To help you understand such messages, this section describes some aspects of the MIDI message format.

Note   The DMUS_MIDI_PMSG structure contains data equivalent to that in any standard MIDI message. However, it is used in performance messages.

Most performance messages are sent by a segment's tracks as the segment is playing. Applications can also send messages to do things like setting a MIDI controller, playing a single note, or changing the tempo.

Once a message has been sent, the application cannot retrieve or alter it except by implementing a tool. For example, a segment authored in DirectMusic Producer might contain a lyrics track that generates DMUS_LYRIC_PMSG messages. The only way an application can display the lyrics is by implementing a tool designed for that purpose. For more information, see DirectMusic Tools.

Notifications are an exception to the rule that messages can be intercepted only by tools. The IDirectMusicPerformance8::GetNotificationPMsg method enables the application to retrieve DMUS_NOTIFICATION_PMSG messages.

The following topics discuss messages and how they are routed:

See Also