DirectX SDK

Using Templates

A template is a special kind of segment that can be used in composing a playable segment of music at run time. The template sets the length of the segment and any loop points. It provides the command track, which controls changes in the groove level and the choice of embellishment patterns. It also prescribes how the chord map is used in composing the segment, by specifying from which signpost group each new chord must come.

[C++]

A template is represented by a DirectMusicSegment object.

There are two ways to obtain a template:

Once you have obtained a template segment object, you can pass it to the IDirectMusicComposer::ComposeSegmentFromTemplate method, along with pointers to a style and a chord map. You also supply a rate of harmonic motion, which sets the frequency of chord changes. The ComposeSegmentFromTemplate method creates a segment and returns a pointer to its IDirectMusicSegment interface at the address given in the ppSectionSeg parameter. You pass this pointer to the IDirectMusicPerformance::PlaySegment method.

[Visual Basic]

A template is represented by a DirectMusicSegment object.

There are two ways to obtain a template object:

Once you have obtained a template segment object, you can pass it to the DirectMusicComposer.ComposeSegmentFromTemplate method, along with pointers to a style and a chord map. You also supply a rate of harmonic motion, which sets the frequency of chord changes. The ComposeSegmentFromTemplate method creates a segment that can be passed to the DirectMusicPerformance.PlaySegment method.