diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-19 22:13:40 +0200 |
---|---|---|
committer | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-19 22:21:58 +0200 |
commit | 6586740caacfb17210a26e9618c31c54ec0da703 (patch) | |
tree | 93cddc7d8cf81e9bdc1531ab87c794ee460fa568 /src/adlmidi_midiplay.cpp | |
parent | 94470c7e544a8086b02aa12e7361b64bacb44ee6 (diff) | |
download | libADLMIDI-6586740caacfb17210a26e9618c31c54ec0da703.tar.gz libADLMIDI-6586740caacfb17210a26e9618c31c54ec0da703.tar.bz2 libADLMIDI-6586740caacfb17210a26e9618c31c54ec0da703.zip |
avoid portamento work when no notes have it on channel
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 0a4639a..2f186a6 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1225,7 +1225,9 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) ir.first->chip_channels_count = 0; int8_t currentPortamentoSource = midiChan.portamentoSource; - bool portamentoEnable = midiChan.portamentoEnable && + double currentPortamentoRate = midiChan.portamentoRate; + bool portamentoEnable = + midiChan.portamentoEnable && currentPortamentoRate != HUGE_VAL && !isPercussion && !isXgPercussion; // Record the last note on MIDI channel as source of portamento midiChan.portamentoSource = portamentoEnable ? (int8_t)note : (int8_t)-1; @@ -1234,7 +1236,8 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) if (portamentoEnable && currentPortamentoSource >= 0) { ir.first->currentTone = currentPortamentoSource; - ir.first->glideRate = midiChan.portamentoRate; + ir.first->glideRate = currentPortamentoRate; + ++midiChan.gliding_note_count; } for(unsigned ccount = 0; ccount < MIDIchannel::NoteInfo::MaxNumPhysChans; ++ccount) @@ -1697,7 +1700,11 @@ void MIDIplay::NoteUpdate(uint16_t MidCh, } if(info.chip_channels_count == 0) + { + if(i->glideRate != HUGE_VAL) + --Ch[MidCh].gliding_note_count; Ch[MidCh].activenotes_erase(i); + } } #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER @@ -2593,6 +2600,9 @@ void MIDIplay::UpdateGlide(double amount) for(unsigned channel = 0; channel < 16; ++channel) { MIDIchannel &midiChan = Ch[channel]; + if(midiChan.gliding_note_count == 0) + continue; + for(MIDIchannel::activenoteiterator it = midiChan.activenotes_begin(); it; ++it) { |