DirectX SDK

DirectMusicComposer.ComposeTemplateFromShape

The DirectMusicComposer.ComposeTemplateFromShape method creates a new template segment, based on a predefined shape.

object.ComposeTemplateFromShape(numMeasures As Integer, _
    shape As Integer, _
    bIntro As Boolean, _
    bEnd As Boolean, _
    endLength As Integer) As DirectMusicSegment

Parameters

object
Object expression that resolves to a DirectMusicComposer object.
numMeasures
Length, in measures, of the segment to be composed. This value must be greater than 0.
shape
Shape of the segment to be composed, based on groove levels. Possible values are of the CONST_DMUS_SHAPET_TYPES enumeration.
bIntro
True if an introduction is to be composed for the segment, False otherwise.
bEnd
True if an ending is to be composed for the segment, False otherwise.
endLength
Length in measures of the ending, if one is to be composed. If bEnd is True, this value must be greater than 0 and equal to or less than the number of measures available (that is, not used in the introduction). See also Remarks.

Return Values

If the method succeeds, it returns a DirectMusicSegment object.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DMUS_E_INVALIDARG
DMUS_E_OUTOFMEMORY

Remarks

The value of endLength should not be greater than the length of the longest ending available in any style likely to be associated with this template through the DirectMusicComposer.ComposeSegmentFromTemplate method. The ending starts playing at endLength measures before the end of the segment. If the ending is less than endLength measures long, the music then reverts to the regular groove.

See Also

DirectMusicComposer.ComposeSegmentFromShape, DirectMusicComposer.ComposeSegmentFromTemplate