diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-05 16:21:04 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-05 16:21:04 +0200 |
commit | e517296012efd234c8991a7b1fef3db51da116be (patch) | |
tree | 7adc44019d76abdce23dfb24d21cecbe61faba9e /src | |
parent | a0e2b9398a06ca2ea164c2ffd6fd89f713b93598 (diff) |
Fix rampdown offsets.
Diffstat (limited to 'src')
-rw-r--r-- | src/drumgizmo.cc | 5 | ||||
-rw-r--r-- | src/events.h | 1 | ||||
-rw-r--r-- | src/inputprocessor.cc | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 81db5c5..5a201af 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -271,9 +271,10 @@ repeat: assert(t >= 0); assert(t < evt.buffer_size - evt.buffer_ptr); - if(evt.rampdownInProgress() && evt.rampdown_count > 0) + if(evt.rampdownInProgress() && evt.rampdown_offset < (evt.t + t) && + evt.rampdown_count > 0) { - scale = std::min((float)evt.rampdown_count/evt.ramp_length, 1.f); + scale = std::min((float)evt.rampdown_count / evt.ramp_length, 1.f); evt.rampdown_count--; } diff --git a/src/events.h b/src/events.h index c28283e..f43fbe2 100644 --- a/src/events.h +++ b/src/events.h @@ -101,6 +101,7 @@ public: void* instrument; int rampdown_count; int ramp_length; + std::size_t rampdown_offset{0}; float scale{1.0f}; }; diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index 1421d43..0adc389 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -138,7 +138,8 @@ bool InputProcessor::processOnset(event_t& event, // TODO: This must be configurable at some point... // ... perhaps even by instrument (ie. in the xml file) std::size_t ramp_length = (68./1000.)*settings.samplerate.load(); - event_sample.rampdown_count = event.offset + ramp_length; + event_sample.rampdown_count = ramp_length; + event_sample.rampdown_offset = event.offset; event_sample.ramp_length = ramp_length; } } |