summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-10-21 18:27:18 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-02-18 11:43:42 +0100
commit260511a8a5f68e83c3bdfd7b28f5f235353da9cd (patch)
tree9d891fc5143da125f706d89715789f73266662b5 /src
parentc3cb642947c42de48a64e79b15af77ff900d2491 (diff)
Make latency controls more intuitive.
Diffstat (limited to 'src')
-rw-r--r--src/latencyfilter.cc13
-rw-r--r--src/settings.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/src/latencyfilter.cc b/src/latencyfilter.cc
index 2f4bfe5..e1e9776 100644
--- a/src/latencyfilter.cc
+++ b/src/latencyfilter.cc
@@ -55,6 +55,10 @@ bool LatencyFilter::filter(event_t& event, std::size_t pos)
// Assert latency_regain is within range [0; 1].
assert(latency_regain >= 0.0f && latency_regain <= 1.0f);
+ // User inputs 0 as no regain and 1 as instant - pow() is the other way around
+ latency_regain *= -1.0f;
+ latency_regain += 1.0f;
+
float duration = (pos - latency_last_pos) / samplerate;
latency_offset *= pow(latency_regain, duration);
@@ -63,8 +67,8 @@ bool LatencyFilter::filter(event_t& event, std::size_t pos)
float offset_min = latency * -1.0f;
float offset_max = latency * 1.0f;
- float mean = latency_laid_back;
- float stddev = latency_stddev;
+ float mean = 0.0f;//latency_laid_back;
+ float stddev = latency_stddev / 2.0f;
float offset = random.normalDistribution(mean, stddev);
@@ -76,8 +80,9 @@ bool LatencyFilter::filter(event_t& event, std::size_t pos)
DEBUG(offset, "latency: %d, offset: %f, drift: %f",
(int)latency, offset, latency_offset);
- event.offset += latency;
- event.offset += latency_offset;//(int)std::round(offset);
+ event.offset += latency; // fixed latency offset
+ event.offset += latency_laid_back; // laid back offset (user controlled)
+ event.offset += latency_offset; // current drift
return true;
}
diff --git a/src/settings.h b/src/settings.h
index b2fe3bb..2f3569f 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -94,7 +94,7 @@ struct Settings
Atomic<bool> enable_latency_modifier{true};
//! Maximum "early hits" introduces latency. In no. samples.
- Atomic<std::size_t> latency_max{5000u};
+ Atomic<std::size_t> latency_max{10000u};
//! 0 := on-beat
//! positive := laid back