diff options
author | Wohlstand <admin@wohlnet.ru> | 2023-10-05 10:49:57 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2023-10-05 10:49:57 +0300 |
commit | 62add404aa71015dd7ae9713a0292743788f3d23 (patch) | |
tree | e3302f443fd4adbf926a0ffaeae03f64375bf795 /src/midi_sequencer_impl.hpp | |
parent | 3efa2e1f77feca5f2626828cf9b559ec570ce1ad (diff) | |
download | libADLMIDI-62add404aa71015dd7ae9713a0292743788f3d23.tar.gz libADLMIDI-62add404aa71015dd7ae9713a0292743788f3d23.tar.bz2 libADLMIDI-62add404aa71015dd7ae9713a0292743788f3d23.zip |
Improved CMF support
- Added missing transpose, depth control, and song marker controllers
Diffstat (limited to 'src/midi_sequencer_impl.hpp')
-rw-r--r-- | src/midi_sequencer_impl.hpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/midi_sequencer_impl.hpp b/src/midi_sequencer_impl.hpp index 1bdb70b..5eb2d95 100644 --- a/src/midi_sequencer_impl.hpp +++ b/src/midi_sequencer_impl.hpp @@ -1761,7 +1761,7 @@ BW_MidiSequencer::MidiEvent BW_MidiSequencer::parseEvent(const uint8_t **pptr, c } } - if(m_format == Format_XMIDI) + else if(m_format == Format_XMIDI) { switch(evt.data[0]) { @@ -1809,6 +1809,38 @@ BW_MidiSequencer::MidiEvent BW_MidiSequencer::parseEvent(const uint8_t **pptr, c break; } } + + else if(m_format == Format_CMF) + { + switch(evt.data[0]) + { + case 102: // Song markers (0x66) + evt.type = MidiEvent::T_SPECIAL; + evt.subtype = MidiEvent::ST_CALLBACK_TRIGGER; + evt.data.assign(1, evt.data[1]); + break; + + case 104: // Transpose Up (0x68), convert into pitch bend + { + int16_t bend = 8192 + (((int)evt.data[1] * 8192) / 128); + evt.type = MidiEvent::T_WHEEL; + evt.data.resize(2); + evt.data[0] = (bend & 0x7F); + evt.data[1] = ((bend >> 7) & 0x7F); + break; + } + + case 105: // Transpose Down (0x69), convert into pitch bend + { + int16_t bend = 8192 - (((int)evt.data[1] * 8192) / 128); + evt.type = MidiEvent::T_WHEEL; + evt.data.resize(2); + evt.data[0] = (bend & 0x7F); + evt.data[1] = ((bend >> 7) & 0x7F); + break; + } + } + } } return evt; |