DirectX SDK

IDirectMusicSegment::Clone

The IDirectMusicSegment::Clone method copies all or part of the segment and the tracks that it contains.

HRESULT Clone(
  MUSIC_TIME mtStart, 
  MUSIC_TIME mtEnd, 
  IDirectMusicSegment** ppSegment
);

Parameters

mtStart
Start of the part to copy. If less than 0 or greater than the length of the segment, 0 is used.
mtEnd
End of the part to copy. If this value is past the end of the segment, the segment is copied to the end. A value of 0 or anything less than mtStart also copies to the end.
ppSegment
Address of a variable to receive a pointer to the created segment, if successful. It is the caller's responsibility to call Release when finished with the segment.

Return Values

If the method succeeds, the return value is S_OK, or S_FALSE if some tracks failed to copy.

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

E_OUTOFMEMORY
E_POINTER

Remarks

If an IDirectMusicGraph interface exists in the segment, a copy of the pointer is included in the clone, and the reference count is incremented. The start point and loop points set by the IDirectMusicSegment::SetStartPoint and IDirectMusicSegment::SetLoopPoints methods are set to their default values (0, and 0 to the end of the segment, respectively) inside the clone. The number of repeats is also reset to 0. The resolution set by the IDirectMusicSegment::SetDefaultResolution method is copied into the clone.

For style-based segments, if mtStart is greater than 0, it should be on a measure boundary.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusici.h.