Microsoft DirectX 8.1 (Visual Basic)

DirectMusicPerformance8.PlaySegmentEx

The PlaySegmentEx method begins playback of a segment.

object.PlaySegmentEx( _
  Source As Unknown, _
  lFlags As CONST_DMUS_SEGF_FLAGS, _
  StartTime As Long, _
  [From As Unknown], _
  [AudioPath As Unknown], _
) As DirectMusicSegmentState8

Parts

object

Resolves to a DirectMusicPerformance8 object.

Source

DirectMusicSegment8 object to play.

lFlags

Flags that modify the method's behavior. Can be 0 or one or more constants from the CONST_DMUS_SEGF_FLAGS enumeration.

StartTime

Performance time at which to begin playing the segment, adjusted to any resolution boundary specified in lFlags. The time is in music time unless the DMUS_SEGF_REFTIME flag is set. A value of 0 causes the segment to start playing as soon as possible.

From

Optional DirectMusicSegmentState8 or DirectMusicAudioPath8 object to stop playing when the new segment begins. If it is an audiopath, all segment states playing on that audiopath are stopped. See also Remarks.

AudioPath

Optional DirectMusicAudioPath8 object that represents the audiopath on which to play the segment. If Nothing or omitted, the segment plays on the default path.

Return Values

Returns a DirectMusicSegmentState8 object that represents the playing instance of the segment.

Error Codes

If the method fails, an error is raised. Possible values for Err.Number include the following:

DMUS_E_AUDIOPATH_INACTIVE
DMUS_E_AUDIOPATH_NOPORT
DMUS_E_NO_MASTER_CLOCK
DMUS_E_SEGMENT_INIT_FAILED
DMUS_E_TIME_PAST
DMUS_E_OUTOFMEMORY

Remarks

Segments should be greater than 250 milliseconds in length.

The boundary resolutions in lFlags are relative to the primary segment.

If a primary segment is scheduled to play while another primary segment is playing, the first one stops unless you set the DMUS_SEGF_QUEUE flag for the second segment, in which case it plays as soon as the first one finishes.

For more information on the exact start time of segments, see Segment Timing. For information on how the start time of segments can be affected by tempo changes, see Clock Time vs. Music Time.

If DMUS_SEGF_AUTOTRANSITION is specified in lFlags and a segment is playing at StartTime and is being interrupted, the method composes a transition between the two segments and plays it before playing Source.

If Source is a segment, a transitional segment based on a template provided at Transition is composed and played.

When the segment is being cued as a secondary segment, the pFrom parameter can be used to specify another secondary segment against which to cue the new segment. For example, the following code cues SegmentA to play as soon as SegmentB finishes playing:

dmPerformance.PlaySegmentEx SegmentA, DMUS_SEGF_QUEUE Or DMUS_SEGF_SECONDARY, _
    0, SegmentB, Nothing

In the example, SegmentB plays to the end before stopping because the DMUS_SEGF_QUEUE flag has been set. If you set a different flag such as DMUS_SEGF_MEASURE, SegmentB stops as soon as the boundary is reached and the new secondary segment begins playing.

See Also