Microsoft DirectX 9.0

Using Chordmaps

A chordmap object represents a collection of chords that provides the foundation of the harmonic structure and the mood of the music. A chordmap contains several pathways with many interconnected chords, providing many possibilities for the composition engine to choose from in determining the chord progression in a piece of music. For a conceptual overview, see Chordmaps.

For authored segments, applications don't normally need to concern themselves with chordmaps. The chordmap is used at the authoring stage to create a fixed chord progression. However, chordmaps can be used to compose segments at run time and to alter the chord progression of existing segments.

If a chordmap reference has been authored into a style, you can retrieve a pointer to its IDirectMusicChordMap8 interface by passing its name (assigned by the author) to the IDirectMusicStyle8::GetChordMap method. You can also use the IDirectMusicStyle8::EnumChordMap method to search for a particular chordmap, or the IDirectMusicStyle8::GetDefaultChordMap method to obtain a pointer to the default chordmap for the style.

Note   DirectMusic Producer does not support authoring chordmap references into style files.

You set the chordmap for a composition when you create a segment by using either IDirectMusicComposer8::ComposeSegmentFromTemplate or IDirectMusicComposer8::ComposeSegmentFromShape.

After a segment has been created, you can change its chordmap by calling the IDirectMusicComposer8::ChangeChordMap method. This has the effect of changing the mood of the music without altering its basic rhythm and melody.

Every chordmap has an underlying scale, consisting of 24 tones. You can determine the tones of the scale by using the IDirectMusicChordMap8::GetScale method. The lower 24 bits of the variable pointed to by the pdwScale parameter of this method are set or cleared depending on whether the corresponding tone is part of the scale. The upper 8 bits give the root of the scale as an integer in the range from 0 through 23 (low C to middle B).

See Also