Microsoft DirectX 8.1 (C++) |
The DirectMusic style 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 to be played in each instrument part.
For a conceptual overview, see Styles.
To obtain a style from a segment, use the IDirectMusicSegment8::GetParam method, as in the following example, where dwStyleIndex is the index of the style within the segment:
IDirectMusicStyle8** ppStyle;
HRESULT hr = pSegment->GetParam( GUID_IDirectMusicStyle, 0xFFFFFFFF,
dwStyleIndex, 0, NULL, (VOID*)ppStyle );
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, which is a scheme of chord progressions, and a command track to set the
To create a segment with a command track based on a template, call the IDirectMusicComposer8::ComposeSegmentFromTemplate method. See Using Templates.
To create a segment based on a shape, call the IDirectMusicComposer8::ComposeSegmentFromShape method. You supply pointers to a style and a chordmap. 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.