diff options
Diffstat (limited to 'src/inputprocessor.cc')
-rw-r--r-- | src/inputprocessor.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index 3af203c..1421d43 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -109,43 +109,43 @@ bool InputProcessor::processOnset(event_t& event, return false; } + auto orig_level = event.velocity; + for(auto& filter : filters) + { + // This line might change the 'event' variable + bool keep = filter->filter(event, event.offset + pos); + + if(!keep) + { + return false; // Skip event completely + } + } + if(instr->getGroup() != "") { // Add event to ramp down all existing events with the same groupname. for(Channel& ch: kit.channels) { - for(Event* event: activeevents[ch.num]) + for(Event* active_event: activeevents[ch.num]) { - if(event->getType() == Event::sample) + if(active_event->getType() == Event::sample) { - auto& event_sample = *static_cast<EventSample*>(event); + auto& event_sample = *static_cast<EventSample*>(active_event); if(event_sample.group == instr->getGroup() && event_sample.instrument != instr) { // Fixed ramp of 68ms, independent of samplerate - std::size_t ramp_length = (68./1000.)*settings.samplerate.load(); - event_sample.rampdown = ramp_length; // TODO: This must be configurable at some point... // ... perhaps even by instrument (ie. in the xml file) - event_sample.ramp_start = event_sample.rampdown; + std::size_t ramp_length = (68./1000.)*settings.samplerate.load(); + event_sample.rampdown_count = event.offset + ramp_length; + event_sample.ramp_length = ramp_length; } } } } } - auto orig_level = event.velocity; - for(auto& filter : filters) - { - // This line might change the 'event' variable - bool keep = filter->filter(event, event.offset + pos); - - if(!keep) - { - return false; // Skip event completely - } - } - Sample* sample = instr->sample(event.velocity, event.offset + pos); if(sample == nullptr) |