IDirectMusicComposer8::ComposeTemplateFromShape

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

Syntax

HRESULT ComposeTemplateFromShape(
  WORD wNumMeasures,
  WORD wShape,
  BOOL fIntro,
  BOOL fEnd,
  WORD wEndLength, 
  IDirectMusicSegment** ppTemplate
);

Parameters

wNumMeasures

Length, in measures, of the segment to be composed. This value must be greater than 0.

wShape

Shape of the segment to be composed. Possible values are of the DMUS_SHAPET_TYPES enumerated type.

fIntro

TRUE if an introduction is to be composed for the segment.

fEnd

TRUE if an ending is to be composed for the segment.

wEndLength

Length in measures of the ending, if one is to be composed. If fEnd 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 Remarks.)

ppTemplate

Address of a variable that receives a pointer to the created template segment.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the error values shown in the following table.

Return code
E_INVALIDARG
E_OUTOFMEMORY
E_POINTER

Remarks

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

Requirements

**  Header:** Dmusici.h
  Library: Dmcompos.dll, Dmcompod.dll

See Also

© 2004 Microsoft Corporation. All rights reserved.