Using Transitions
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 object create an intermediate or closing segment that provides an appropriate transition.
You have your choice of three techniques for composing transitional segments:
- The DirectMusicPerformance8.PlaySegmentEx method allows you to specify a segment in the Transition parameter. This segment is used as a template for a newly composed transition. The transition is played at startTime, and then the segment specified by Source is played.
- The DirectMusicComposer8.AutoTransition method, given a DirectMusicPerformance8 object, 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 DirectMusicComposer8.ComposeTransition method composes a transition from any point in one segment to the beginning of a second segment, or to silence, and returns a DirectMusicSegment8 object so that the application can play the transition.
The AutoTransition and ComposeTransition methods both take a , a command, and a set of flags as parameters.
- The chordmap, 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 either an ordinary groove pattern or one of the embellishmentsis called for in the command track of the transitional segment. When the segment plays, an appropriate pattern is selected from the .
- 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 can't be used when there is no second segment, because there can be no modulation to silence.
Transitions created by AutoTransition and ComposeTransition are normally a single measure in length. However, they can be longer if the DMUS_COMPOSEF_LONG flag is included and the embellishment in the style is more than one measure long. They also contain at least two measures if they are of type DMUS_COMMANDT_ENDANDINTRO.