To avoid a sudden and perhaps discordant break when stopping one segment and beginning another, or when bringing the music to a close, you can have the composer create an intermediate or closing segment that provides an appropriate transition.
[C++]
There are two methods for composing transitional segments.
The IDirectMusicComposer::AutoTransition method, given a pointer to the performance, creates a transition from the currently playing segment to a second segment of your choice, and then automatically cues the transitional segment and the second segment for playback, returning an IDirectMusicSegmentState interface for both. The transition begins playing immediately or on the next boundary, as specified in the dwFlags parameter. Optionally, the second segment can be NULL so that the transition is to silence.
The IDirectMusicComposer::ComposeTransition method composes a transition from any point in one segment to the beginning of a second segment, or to silence, and returns an IDirectMusicSegment interface so that the application can play the transition.
Both these methods take a chord map, a command, and a set of flags as parameters.
The chord map, as usual, is used to create a chord track that defines the chord progression in the segment.
The command is one of the DMUS_COMMANDT_TYPES enumeration. It determines which type of pattern—either an ordinary groove pattern or one of the embellishments—is called for in the command track of the transitional segment. When the segment plays, an appropriate pattern is selected from the style.
The flags are from DMUS_COMPOSEF_FLAGS and further define the transition, principally its timing. The DMUS_COMPOSEF_MODULATE flag can be used to cause the transition to move smoothly from one tonality to another; it cannot be used when there is no second segment because there can be no modulation to silence.
[Visual Basic]
There are two methods for composing transitional segments.
The DirectMusicComposer.AutoTransition method, given a DirectMusicPerformance, creates a transition from the currently playing segment to a second segment of your choice, and then automatically cues the transitional segment and the second segment for playback. The transition begins playing immediately or on the next boundary, as specified in the lFlags parameter. Optionally, the second segment can be Nothing so that the transition is to silence.
The DirectMusicComposer.ComposeTransition method composes a transition from any point in one segment to the beginning of a second segment, or to silence, and returns a DirectMusicSegment object so that the application can play the transition.
Both these methods take a chord map, a command, and a set of flags as parameters.
The chord map, as usual, is used to create a chord track that defines the chord progression in the segment.
The command is one of the CONST_DMUS_COMMANDT_TYPES enumeration. It determines which type of pattern—either an ordinary groove pattern or one of the embellishments—is called for in the command track of the transitional segment. When the segment plays, an appropriate pattern is selected from the style.
The flags are from CONST_DMUS_COMPOSEF_FLAGS and further define the transition, principally its timing. The DMUS_COMPOSEF_MODULATE flag can be used to cause the transition to move smoothly from one tonality to another; it cannot be used when there is no second segment, because there can be no modulation to silence.
Transitions are normally a single measure in length. There are two exceptions: when the DMUS_COMPOSEF_LONG flag is included and when the command is DMUS_COMMANDT_END and the end embellishment in the style is more than one measure long.