diff options
author | Wohlstand <admin@wohlnet.ru> | 2020-09-03 00:46:53 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2020-09-03 00:46:53 +0300 |
commit | add55f65c5727bfab338be16e6548f9af8756048 (patch) | |
tree | 3955e14974ffacab98a7939e1c23fb637c68fc30 /src/midi_sequencer_impl.hpp | |
parent | 9d34329f81f9d2588c27d828aaaf3a3d5f222da3 (diff) | |
download | libADLMIDI-add55f65c5727bfab338be16e6548f9af8756048.tar.gz libADLMIDI-add55f65c5727bfab338be16e6548f9af8756048.tar.bz2 libADLMIDI-add55f65c5727bfab338be16e6548f9af8756048.zip |
Fixed an incorrect logic of CC121
Issue #227
Diffstat (limited to 'src/midi_sequencer_impl.hpp')
-rw-r--r-- | src/midi_sequencer_impl.hpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/midi_sequencer_impl.hpp b/src/midi_sequencer_impl.hpp index f0ba839..62e78c3 100644 --- a/src/midi_sequencer_impl.hpp +++ b/src/midi_sequencer_impl.hpp @@ -206,6 +206,7 @@ void BW_MidiSequencer::MidiTrackRow::sortEvents(bool *noteStates) else if((events[i].type == MidiEvent::T_SPECIAL) && ( (events[i].subtype == MidiEvent::ST_MARKER) || (events[i].subtype == MidiEvent::ST_DEVICESWITCH) || + (events[i].subtype == MidiEvent::ST_SONG_BEGIN_HOOK) || (events[i].subtype == MidiEvent::ST_LOOPSTART) || (events[i].subtype == MidiEvent::ST_LOOPEND) || (events[i].subtype == MidiEvent::ST_LOOPSTACK_BEGIN) || @@ -566,13 +567,11 @@ bool BW_MidiSequencer::buildSmfTrackData(const std::vector<std::vector<uint8_t> } // HACK: Begin every track with "Reset all controllers" event to avoid controllers state break came from end of song - for(uint8_t chan = 0; chan < 16; chan++) + if(tk == 0) { MidiEvent resetEvent; - resetEvent.type = MidiEvent::T_CTRLCHANGE; - resetEvent.channel = chan; - resetEvent.data.push_back(121); - resetEvent.data.push_back(0); + resetEvent.type = MidiEvent::T_SPECIAL; + resetEvent.subtype = MidiEvent::ST_SONG_BEGIN_HOOK; evtPos.events.push_back(resetEvent); } @@ -1677,7 +1676,7 @@ void BW_MidiSequencer::handleEvent(size_t track, const BW_MidiSequencer::MidiEve if(evt.type == MidiEvent::T_SPECIAL) { // Special event FF - uint8_t evtype = evt.subtype; + uint_fast16_t evtype = evt.subtype; uint64_t length = static_cast<uint64_t>(evt.data.size()); const char *data(length ? reinterpret_cast<const char *>(evt.data.data()) : ""); @@ -1771,6 +1770,13 @@ void BW_MidiSequencer::handleEvent(size_t track, const BW_MidiSequencer::MidiEve return; } + if(evtype == MidiEvent::ST_SONG_BEGIN_HOOK) + { + if(m_interface->onSongStart) + m_interface->onSongStart(m_interface->onSongStart_userData); + return; + } + return; } |