summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-07-15 18:55:26 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-07-15 18:55:26 +0200
commit3e003e674b31ca1308f5c32125f5a2152e773f17 (patch)
treebf02f68fae42624e41065e8f99102317b7b26ac0
parentf1727b39be71f1c6acd050defaee8d61c1140be7 (diff)
Make sample ramp-down samplerate dependent: 14.7ms.
-rw-r--r--src/inputprocessor.cc4
-rw-r--r--src/inputprocessor.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc
index 1dbd79e..96bc2c0 100644
--- a/src/inputprocessor.cc
+++ b/src/inputprocessor.cc
@@ -44,6 +44,7 @@ InputProcessor::InputProcessor(Settings& settings,
: kit(kit)
, activeevents(activeevents)
, is_stopping(false)
+ , settings(settings)
{
// Build filter list
filters.emplace_back(std::make_unique<StaminaFilter>(settings));
@@ -121,7 +122,8 @@ bool InputProcessor::processOnset(event_t& event,
if(event_sample.group == instr->getGroup() &&
event_sample.instrument != instr)
{
- event_sample.rampdown = 3000; // Ramp down 3000 samples
+ // Ramp down 14.7ms (3000 samples in 44k1Hz)
+ event_sample.rampdown = settings.samplerate.load() / 14.7;
// TODO: This must be configurable at some point...
// ... perhaps even by instrument (ie. in the xml file)
event_sample.ramp_start = event_sample.rampdown;
diff --git a/src/inputprocessor.h b/src/inputprocessor.h
index cf62ea2..95fdfdb 100644
--- a/src/inputprocessor.h
+++ b/src/inputprocessor.h
@@ -62,4 +62,6 @@ private:
bool processStop(event_t& event);
std::vector<std::unique_ptr<InputFilter>> filters;
+
+ Settings& settings;
};