Microsoft DirectX 9.0

IDirectMusicSegment8::SetStartPoint

The SetStartPoint method sets the point within the segment at which it starts playing.

Syntax

HRESULT SetStartPoint(
  MUSIC_TIME mtStart
);

Parameters

mtStart

Point within the segment at which it is to start playing. Must be greater than or equal to 0 and less than the length of the segment.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return DMUS_E_OUT_OF_RANGE.

Remarks

The start point is the first point in the segment that can possibly be heard. However, the actual first point heard may be later, if the start point of the segment is aligned to a past time. For more information, see Segment Timing.

By default, the start point is 0, meaning that the segment starts from the beginning.

If the segment does not already have a length, IDirectMusicSegment8::SetLength must be called before SetStartPoint can be called. SetLength is normally called by the loader. However, when a WAV file is loaded, the length is always set to 1, because a WAV file is played in clock time and has no inherent music-time length. If you want to set the start point for a WAV file to some value other than 0, you must first call SetLength, setting the length to some value greater than the desired start point. The length you set does not have to be the actual length of the sound unless you intend to cue another segment after it. When the segment is played, the conversion of the start point to clock-time units is based on a tempo of 120. Alternatively, you can use DirectMusic Producer to create a segment file that has a wave track; in this case, the loader will set the correct music-time length based on the tempo of the segment.

The method does not affect any currently playing segment states created from this segment.

The start point of a cached segment persists even if the segment is released and then reloaded. To ensure that a segment is not subsequently reloaded from the cache, call IDirectMusicLoader8::ReleaseObject on it before releasing it.

Requirements

  Header: Declared in dmusici.h.

See Also