Segments

The basic chunk of data in DirectMusic is called a segment. A segment is represented by an IDirectMusicSegment interface. You can create a segment in any of the following ways:

Each segment consists of one or more tracks, each represented by an IDirectMusicTrack 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 do not need to use this interface, because the tracks are managed through the segment object. For more information, see Tracks.

Segments can serve different purposes. The following are the kinds of segments you are most likely to use:

The playback of segments is controlled by the IDirectMusicPerformance interface. An instance of a playing segment is represented by an IDirectMusicSegmentState interface, which can be used to retrieve information about the current state of the segment.

Only one primary segment can play inside a performance. When you cue a primary segment for playback, using the IDirectMusicPerformance::PlaySegment method, 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 on top of 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 a control segment, in which case it takes over the task of responding to IDirectMusicPerformance::SetParam and IDirectMusicPerformance::GetParam calls, which normally go to tracks in the primary segment. Thus a control segment might control the current chord or groove level. For more information, see Tracks.

For more information on control segments, see DMUS_SEGF_FLAGS.

For more information on segment playback, see Segment Timing.