diff options
Diffstat (limited to 'src/inputprocessor.cc')
-rw-r--r-- | src/inputprocessor.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index fd6e5b9..7d12bdd 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -163,6 +163,11 @@ static void applyChokeGroup(Settings& settings, DrumKit& kit, // Add event to ramp down all existing events with the same groupname. for(const auto& ch : kit.channels) { + if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine + { + continue; + } + for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num)) { if(event_sample.group == instr.getGroup() && @@ -186,13 +191,18 @@ static void applyDirectedChoke(Settings& settings, DrumKit& kit, // Add event to ramp down all existing events with the same groupname. for(const auto& ch : kit.channels) { + if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine + { + continue; + } + for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num)) { if(choke.instrument_id == event_sample.instrument_id && event_sample.rampdown_count == -1) // Only if not already ramping. { // choke.choketime is in ms - applyChoke(settings, event_sample, choke.choketime, event_sample.offset); + applyChoke(settings, event_sample, choke.choketime, event.offset); } } } @@ -264,6 +274,11 @@ bool InputProcessor::processOnset(event_t& event, std::size_t pos, bool new_group_added = false; for(Channel& ch: kit.channels) { + if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine + { + continue; + } + const auto af = sample->getAudioFile(ch); if(af == nullptr || !af->isValid()) { @@ -330,13 +345,18 @@ bool InputProcessor::processChoke(event_t& event, // Add event to ramp down all existing events with the same groupname. for(const auto& ch : kit.channels) { + if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine + { + continue; + } + for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num)) { if(event_sample.instrument_id == instrument_id && event_sample.rampdown_count == -1) // Only if not already ramping. { // Fixed group rampdown time of 68ms, independent of samplerate - applyChoke(settings, event_sample, 68, event_sample.offset); + applyChoke(settings, event_sample, 450, event.offset); } } } @@ -357,6 +377,11 @@ bool InputProcessor::processStop(event_t& event) int num_active_events = 0; for(auto& ch: kit.channels) { + if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine + { + continue; + } + num_active_events += events_ds.numberOfEvents(ch.num); } |