diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2019-01-25 08:16:31 +0100 |
---|---|---|
committer | JP Cimalando <jpcima@users.noreply.github.com> | 2019-01-25 10:51:30 +0100 |
commit | 3bdda83b7d5417785f5df0120d4f2d73af4253d4 (patch) | |
tree | fb1ce7d24f72ac4ea98977b3009fe4e7586be342 /src | |
parent | 60bc095f2f431b4e6421307fc7ab62c6cc9ce0c2 (diff) | |
download | libADLMIDI-3bdda83b7d5417785f5df0120d4f2d73af4253d4.tar.gz libADLMIDI-3bdda83b7d5417785f5df0120d4f2d73af4253d4.tar.bz2 libADLMIDI-3bdda83b7d5417785f5df0120d4f2d73af4253d4.zip |
force note-on to do immediate note killing
Diffstat (limited to 'src')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 6 | ||||
-rw-r--r-- | src/adlmidi_midiplay.hpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index f8bd0a2..011f74a 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -345,7 +345,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) if(static_cast<size_t>(channel) > m_midiChannels.size()) channel = channel % 16; - noteOff(channel, note); + noteOff(channel, note, velocity != 0); // On Note on, Keyoff the note first, just in case keyoff // was omitted; this fixes Dance of sugar-plum fairy // by Microsoft. Now that we've done a Keyoff, @@ -1733,7 +1733,7 @@ void MIDIplay::updatePortamento(size_t midCh) } -void MIDIplay::noteOff(size_t midCh, uint8_t note) +void MIDIplay::noteOff(size_t midCh, uint8_t note, bool forceNow) { MIDIchannel &ch = m_midiChannels[midCh]; MIDIchannel::notes_iterator i = ch.find_activenote(note); @@ -1741,7 +1741,7 @@ void MIDIplay::noteOff(size_t midCh, uint8_t note) if(!i.is_end()) { MIDIchannel::NoteInfo &ni = i->value; - if(ni.ttl <= 0) + if(forceNow || ni.ttl <= 0) noteUpdate(midCh, i, Upd_Off); else ni.isOnExtendedLifeTime = true; diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp index d7d8022..1067252 100644 --- a/src/adlmidi_midiplay.hpp +++ b/src/adlmidi_midiplay.hpp @@ -963,8 +963,9 @@ private: * @brief Off the note * @param midCh MIDI channel * @param note Note to off + * @param forceNow Do not delay the key-off to a later time */ - void noteOff(size_t midCh, uint8_t note); + void noteOff(size_t midCh, uint8_t note, bool forceNow = false); /** * @brief Update processing of vibrato to amount of seconds |