Partager via


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 IDirectMusicPerformance8::PlaySegmentEx method allows you to specify a segment in the pTransition parameter. This segment is used as a template for a newly composed transition. The transition is played at i64StartTime, and then the segment specified by pSource is played.
  • The IDirectMusicComposer8::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 IDirectMusicComposer8::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.

The AutoTransition and ComposeTransition methods both take a chordmap , a command, and a set of flags as parameters:

  • The chordmap 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 the DMUS_COMPOSEF_FLAGS enumeration 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 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.

DirectMusic also provides many options for controlling the timing of transitions from one segment to another. For more information, see the following topics:

© 2004 Microsoft Corporation. All rights reserved.