From 77e8b86be524edf42a7070e2b7a1f6f67d7cfaa8 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sun, 30 Sep 2018 18:58:13 +0300 Subject: Move "MaxChips" constant macro into adlmidi_private.hpp --- src/adlmidi_midiplay.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/adlmidi_midiplay.cpp') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 673ec30..1e1da07 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1465,6 +1465,8 @@ void MIDIplay::killOrEvacuate(size_t from_channel, AdlChannel::LocationData *j, MIDIplay::MIDIchannel::activenoteiterator i) { + uint32_t maxChannels = ADL_MAX_CHIPS * 18; + // Before killing the note, check if it can be // evacuated to another channel as an arpeggio // instrument. This helps if e.g. all channels @@ -1474,6 +1476,8 @@ void MIDIplay::killOrEvacuate(size_t from_channel, { uint16_t cs = static_cast(c); + if(c >= maxChannels) + break; if(c == from_channel) continue; if(m_synth.m_channelCategory[c] != m_synth.m_channelCategory[from_channel]) -- cgit v1.2.3