summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-03-17 16:20:34 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2019-03-17 16:20:34 +0100
commit3877ec05e123ce3d904b72f0105b170b2aa74599 (patch)
tree356245a76132fd37ea12c78f025ca76d9c85d493 /src
parentf23bee5a5a0eff34cbea1d7d238f7b5d23b28cbf (diff)
Fix bad behaviour (and potential division by zero) if the fadelength is less than or equal to 0.
Diffstat (limited to 'src')
-rw-r--r--src/drumgizmo.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 0e374f2..1e1974f 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -284,7 +284,14 @@ repeat:
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);
+ if(evt.ramp_length > 0)
+ {
+ scale = std::min((float)evt.rampdown_count / evt.ramp_length, 1.f);
+ }
+ else
+ {
+ scale = 0.0f;
+ }
evt.rampdown_count--;
}