This method begins playback of a segment.

HRESULT PlaySegment(
  IDirectMusicSegment* pSegment,
  DWORD dwFlags,
  __int64 i64StartTime,
  IDirectMusicSegmentState** ppSegmentState


  • pSegment
    Segment to play.
  • dwFlags
    Flags that modify the method's behavior. For more information, see DMUS_SEGF_FLAGS.
  • i64StartTime
    Time at which to begin playing the segment, adjusted to any resolution boundary specified in dwFlags. 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.
  • ppSegmentState
    Address of a variable to receive a pointer to the segment state for this instance of the playing segment. This field can be NULL. If it is non-NULL, the segment state pointer is returned, and the application must call Release on it.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the following error values:



Segments should be greater than 250 milliseconds in length.

The boundary resolutions in dwFlags are relative to the currently playing 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 about the exact start time of segments, see Segment Timing. For information about how the start time of segments can be affected by tempo changes, see Clock Time vs. Music Time.


OS Versions: Windows CE .NET 4.0 and Windows CE .NET 4.1.
Header: Dmusici.h.
Link Library: Dmusic.lib.

See Also


 Last updated on Monday, April 12, 2004

© 1992-2002 Microsoft Corporation. All rights reserved.