Microsoft DirectX 8.1 (C++)

Using Segments

Segments are the basic units of playable data in the DirectMusic performance. A segment is represented by an IDirectMusicSegment8 interface.

You can create a segment object in an application by any of the following means:

Each segment consists of one or more tracks, each represented by an IDirectMusicTrack8 interface. Tracks contain most of the data for the segment, whether that data consists of note events, band changes, tempo changes, or other timed events. Applications generally don't need to use this interface, because the tracks are managed through the segment object. For more information, see DirectMusic Tracks.

Segments can perform different roles in the performance. There must always be a primary segment, which provides the main content of the soundtrack and normally serves as the control segment. Secondary segments play along with the primary segment and might provide sound effects or short musical themes. A special type of secondary segment is the motif, which is always obtained from a DirectMusic style object.

In addition there are three kinds of segments with special roles:

The playback of segments is controlled by the performance object and begins with a call to IDirectMusicPerformance8::PlaySegment or IDirectMusicPerformance8::PlaySegmentEx.

Only one primary segment can play inside a performance. When you cue a primary segment for playback, you can specify that it is to be played after the currently playing segment is finished, or you can use it to replace the current primary segment.

Secondary segments, on the other hand, play over the current primary segment, and any number of secondary segments can be playing simultaneously.

Secondary segments do not normally alter the performance of the primary segment. For example, a secondary segment can be based on a different style without affecting the style of the primary segment. However, a secondary segment can be designated as the control segment, in which case it takes over certain tasks normally handled by the primary segment.

More information on segments is contained in the following topics:

See also Segment Timing.