DirectX SDK

Segment Timing

[C++]

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:

[Visual Basic]

Segments play from the beginning unless a start point is set by a call to the DirectMusicSegment.SetStartPoint method. If a repeat count is set by using DirectMusicSegment.SetRepeats, the entire segment repeats that number of times, unless a loop has been defined by a call to DirectMusicSegment.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 DirectMusicPerformance.PlaySegment:

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 on how tempo changes can affect start times, see Clock Time vs. Music Time.