The IDirectMusicPerformance::MusicToMIDI method converts a DirectMusic music value to a MIDI note value.
HRESULT MusicToMIDI(
WORD wMusicValue,
DMUS_CHORD_KEY* pChord,
BYTE bPlayMode,
BYTE bChordLevel,
BYTE *pbMIDIValue
);
If the method succeeds, the return value is one of the following. See Remarks.
S_OK |
DMUS_S_OVER_CHORD |
DMUS_S_DOWN_OCTAVE |
DMUS_S_UP_OCTAVE |
If it fails, the method may return one of the following error values:
DMUS_E_CANNOT_CONVERT |
E_INVALIDARG |
If the method fails or returns DMUS_S_OVER_CHORD, *pwMIDIValue is not changed.
The method returns DMUS_S_OVER_CHORD if no note has been calculated because the music value has the note at a position higher than the top note of the chord. This applies only to DMUS_PLAYMODE_NORMALCHORD play mode. The caller should not do anything with the note, which is not meant to be played against this chord.
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 0 through 127. This may occur when using any play mode except DMUS_PLAYMODE_FIXED.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dmusici.h.
IDirectMusicPerformance::MIDIToMusic, Music Values and MIDI Notes