Share via


Segment Timing

Segments play from the beginning unless a start point is set by a call to the IDirectMusicSegment::SetStartPoint method. If a repeat count is set by using IDirectMusicSegment::SetRepeats, the entire segment repeats that number of times, unless a loop has been defined by a call to IDirectMusicSegment::SetLoopPoints. In this case, only the part of the segment between the loop points repeats.

The performance time at which the segment starts playing is determined by two parameters of IDirectMusicPerformance::PlaySegment:

  • The i64StartTime parameter sets the earliest time at which the segment can start playing. If i64StartTime is 0, this time is as soon as possible. The time at which the segment starts depends on the type of segment. If it is a primary segment or a control segment, the earliest start time is at queue (or flush) time. If it is a noncontrol secondary segment, the earliest start is at latency time. For more information about queue time and latency time, see Latency and Bumper Time.
  • The dwFlags parameter determines how soon after the scheduled time the segment starts playing, depending on the rhythm of the currently playing segment. Usually, you will want to wait for an appropriate moment before introducing a new segment, a transition, or a motif. You control the delay by setting one of the following DMUS_SEGF_FLAGS:
  • DMUS_SEGF_AFTERPREPARETIME
    Play at the earliest start time plus the prepare time. This ensures that any messages from the currently playing segment that have already been queued to the port are not invalidated. This saves processing time and also ensures that any motifs continue to play smoothly over a transition from one primary segment to another.
  • DMUS_SEGF_GRID
    Play on a grid boundary. A grid is a subdivision of a beat. The time signature (authored into the style) determines how many grids each beat is divided into.
  • DMUS_SEGF_BEAT
    Play on a beat.
  • DMUS_SEGF_MEASURE
    Play at the beginning of a measure.
  • DMUS_SEGF_DEFAULT
    Use the cued segment's default boundary.

If none of these flags is set, the segment starts playing at exactly the earliest start time.

For information about how tempo changes can affect start times, see Clock Time vs. Music Time.

 Last updated on Monday, April 12, 2004

© 1992-2002 Microsoft Corporation. All rights reserved.