aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 276a33d..1e1da07 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -141,7 +141,7 @@ MIDIplay::MIDIplay(unsigned long sampleRate):
m_setup.maxdelay = 512.0 / (double)m_setup.PCM_RATE;
m_setup.bankId = 0;
- m_setup.numFourOps = 7;
+ m_setup.numFourOps = -1;
m_setup.numChips = 2;
m_setup.deepTremoloMode = -1;
m_setup.deepVibratoMode = -1;
@@ -198,9 +198,13 @@ void MIDIplay::applySetup()
m_synth.m_volumeScale = (OPL3::VolumesScale)m_synth.m_insBankSetup.volumeModel;
m_synth.m_numChips = m_setup.numChips;
- m_synth.m_numFourOps = m_setup.numFourOps;
m_cmfPercussionMode = false;
+ if(m_setup.numFourOps >= 0)
+ m_synth.m_numFourOps = m_setup.numFourOps;
+ else
+ adlCalculateFourOpChannels(this, true);
+
m_synth.reset(m_setup.emulator, m_setup.PCM_RATE, this);
m_chipChannels.clear();
m_chipChannels.resize(m_synth.m_numChannels);
@@ -1461,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
@@ -1470,7 +1476,7 @@ void MIDIplay::killOrEvacuate(size_t from_channel,
{
uint16_t cs = static_cast<uint16_t>(c);
- if(c > std::numeric_limits<uint32_t>::max())
+ if(c >= maxChannels)
break;
if(c == from_channel)
continue;