Microsoft DirectX 8.1 (Visual Basic)

Using Segments

Segments are the basic units of playable data in the DirectMusic performance. A segment is represented by a DirectMusicSegment8 object.

You can create a segment object in any of the following ways:

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 DirectMusicPerformance8 object and begins with a call to DirectMusicPerformance8.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.