Using Styles

The DirectMusicStyle object represents a collection of musical patterns, usually including embellishments and motifs, together with a time signature, tempo, and band. It defines the basic rhythm and the notes that will be played in each instrument part.

You obtain the DirectMusicStyle object from a style or segment file. For more information, see Loading Objects and Music Files for Composition.

A style by itself does not contain enough information to create a segment of music at run time. For this you need two other components: a chordmap (map of chord progressions) and a command track to set the groove level and embellishments as the music plays. The command track can come from a template or be generated at run time from a shape.

To create a segment with a command track based on a template, call the IDirectMusicComposer::ComposeSegmentFromTemplate method. (See Using Templates.)

To create a segment based on a shape, call the IDirectMusicComposer::ComposeSegmentFromShape method. You supply pointers to the style and the chordmap, and a variable to receive a pointer to the created segment. You also supply a rate of harmonic motion, which controls the frequency of chord changes, and a shape constant, which determines the progression of groove levels and embellishments.