DirectX SDK

Using Styles

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

You can obtain the DirectMusicStyle object from a style or segment file or from a resource. For more information, see DirectMusic Loader and Music Files for Composition.

A style by itself does not contain enough information to create a segment of music at run time. You need two other components: a chord map (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. The chord map generally comes from a chord-map file or resource.

[C++]

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 chord map, 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.

[Visual Basic]

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

To create a segment based on a shape, call the DirectMusicComposer.ComposeSegmentFromShape method. You supply pointers to the style and the chord map, 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.