Using Transitions
In order 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 will provide an appropriate transition.
You have your choice of 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 chordmap, 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 DMUS_COMMANDT_TYPES enumeration. It determines which type of pattern—either an ordinary groove pattern or one of the embellishments—will be called for in the command track of the transitional segment. When the segment plays, an appropriate pattern will be 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 can't be used when there is no second segment, because there can be no modulation to silence.
Note that 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.