aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-05-31 07:36:51 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-05-31 07:36:51 +0200
commit9007918bce92c5af1305426ead055591e29dd6b9 (patch)
treee2464498f9f18244256af28128d668f8ac56d663 /src/adlmidi_midiplay.cpp
parent526283f46bf2d77973e7d6d5225dd77040708193 (diff)
downloadlibADLMIDI-9007918bce92c5af1305426ead055591e29dd6b9.tar.gz
libADLMIDI-9007918bce92c5af1305426ead055591e29dd6b9.tar.bz2
libADLMIDI-9007918bce92c5af1305426ead055591e29dd6b9.zip
rewrite the check of whether aftertouch is used
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index e453a05..b8ef555 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -1258,8 +1258,16 @@ void MIDIplay::realTime_NoteAfterTouch(uint8_t channel, uint8_t note, uint8_t at
{
i->vibrato = atVal;
}
- chan.noteAftertouch[note % 128] = atVal;
- chan.noteAfterTouchInUse = (std::memcmp(chan.noteAftertouch, chan.noteAftertouch_Zero, 128) != 0);
+
+ uint8_t oldAtVal = chan.noteAftertouch[note % 128];
+ if(atVal != oldAtVal)
+ {
+ chan.noteAftertouch[note % 128] = atVal;
+ bool inUse = atVal != 0;
+ for(unsigned n = 0; !inUse && n < 128; ++n)
+ inUse = chan.noteAftertouch[n] != 0;
+ chan.noteAfterTouchInUse = inUse;
+ }
}
void MIDIplay::realTime_ChannelAfterTouch(uint8_t channel, uint8_t atVal)