IDirectMusicPerformance::MIDIToMusic
This method converts a MIDI note value to a DirectMusic music value, using a supplied chord, subchord level, and play mode.
HRESULT MIDIToMusic(
BYTE bMIDIValue,
DMUS_CHORD_KEY* pChord,
BYTE bPlayMode,
BYTE bChordLevel,
WORD* pwMusicValue
);
Parameters
- bMIDIValue
MIDI note value to convert, in the range from 0 through 127. - pChord
Address of a DMUS_CHORD_KEY structure containing information about the chord and key structure to be used in translating the note. This includes the underlying scale. For example, if the chord is a CM7, the note is interpreted against the chord positions for root note C, chord intervals of a major seventh. The structure carries up to eight parallel subchords, with chord intervals, root, scale, and inversion flags for each. It also carries the overall key root. - bPlayMode
Play mode determining how the music value is derived from the chord. For a list of values, see DMUS_PLAYMODE_FLAGS. - bChordLevel
Subchord level, defining which subchords can be used. For more information, see DMUS_SUBCHORD. - pwMusicValue
Address of a variable to receive the music value. For information about this value, see DMUS_NOTE_PMSG.
Return Values
If the method succeeds, the return value is one of the following. See Remarks.
S_OK |
DMUS_S_DOWN_OCTAVE |
DMUS_S_UP_OCTAVE |
If it fails, the method can return one of the following error values:
DMUS_E_CANNOT_CONVERT |
E_INVALIDARG |
Remarks
If the method fails, *pwMusicValue is not changed.
If the return value is DMUS_S_UP_OCTAVE or DMUS_DOWN_OCTAVE, the note conversion generated a note value that is less than 0 or greater than 127, so it has been bumped up or down one or more octaves to be in the proper MIDI range of from 0 through 127. This can occur when using play modes DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of which return MIDI values in *pwMusicValue.
Requirements
OS Versions: Windows CE .NET 4.0 and Windows CE .NET 4.1.
Header: Dmusici.h.
Link Library: Dmusic.lib.
See Also
Music Values and MIDI Notes | IDirectMusicPerformance::MusicToMIDI | DMUS_CHORD_KEY | DMUS_NOTE_PMSG | DMUS_PLAYMODE_FLAGS | DMUS_SUBCHORD
Last updated on Monday, April 12, 2004
© 1992-2002 Microsoft Corporation. All rights reserved.