From be9fe821ff1689ece9ee6433fcf42ec316e0aaad Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 15 Jun 2018 20:15:07 +0200 Subject: PoC for humanisation visualiser. --- src/latencyfilter.cc | 2 ++ src/settings.h | 14 ++++++++++++++ src/staminafilter.cc | 2 ++ 3 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/latencyfilter.cc b/src/latencyfilter.cc index 9ea707d..5cb6db2 100644 --- a/src/latencyfilter.cc +++ b/src/latencyfilter.cc @@ -92,6 +92,8 @@ bool LatencyFilter::filter(event_t& event, std::size_t pos) event.offset += latency_laid_back; // laid back offset (user controlled) event.offset += latency_offset; // current drift + settings.latency_current.store(latency_offset + latency_laid_back); + return true; } diff --git a/src/settings.h b/src/settings.h index f044bae..9d225b0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -79,6 +79,9 @@ struct Settings Atomic velocity_modifier_weight{velocity_modifier_weight_default}; Atomic velocity_stddev{velocity_stddev_default}; // [0.5; 3.0] + // Current velocity offset - for UI + Atomic velocity_modifier_current{1.0f}; + Atomic enable_velocity_randomiser{false}; Atomic velocity_randomiser_weight{0.1f}; @@ -121,6 +124,9 @@ struct Settings //! 1: never static float constexpr latency_regain_default = 0.9f; Atomic latency_regain{latency_regain_default}; + + // Current latency offset - for UI + Atomic latency_current{0}; }; //! Settings getter class. @@ -146,6 +152,7 @@ struct SettingsGetter SettingRef velocity_modifier_falloff; SettingRef velocity_modifier_weight; SettingRef velocity_stddev; + SettingRef velocity_modifier_current; SettingRef enable_velocity_randomiser; SettingRef velocity_randomiser_weight; @@ -169,6 +176,7 @@ struct SettingsGetter SettingRef latency_laid_back; SettingRef latency_stddev; SettingRef latency_regain; + SettingRef latency_current; SettingsGetter(Settings& settings) : drumkit_file(settings.drumkit_file) @@ -188,6 +196,7 @@ struct SettingsGetter , velocity_modifier_falloff{settings.velocity_modifier_falloff} , velocity_modifier_weight{settings.velocity_modifier_weight} , velocity_stddev{settings.velocity_stddev} + , velocity_modifier_current{settings.velocity_modifier_current} , enable_velocity_randomiser{settings.enable_velocity_randomiser} , velocity_randomiser_weight{settings.velocity_randomiser_weight} , samplerate{settings.samplerate} @@ -205,6 +214,7 @@ struct SettingsGetter , latency_laid_back{settings.latency_laid_back} , latency_stddev{settings.latency_stddev} , latency_regain{settings.latency_regain} + , latency_current{settings.latency_current} { } }; @@ -233,6 +243,7 @@ public: Notifier velocity_modifier_falloff; Notifier velocity_modifier_weight; Notifier velocity_stddev; + Notifier velocity_modifier_current; Notifier enable_velocity_randomiser; Notifier velocity_randomiser_weight; @@ -256,6 +267,7 @@ public: Notifier latency_laid_back; Notifier latency_stddev; Notifier latency_regain; + Notifier latency_current; void evaluate() { @@ -281,6 +293,7 @@ public: EVAL(velocity_modifier_falloff); EVAL(velocity_modifier_weight); EVAL(velocity_stddev); + EVAL(velocity_modifier_current); EVAL(enable_velocity_randomiser); EVAL(velocity_randomiser_weight); @@ -304,6 +317,7 @@ public: EVAL(latency_laid_back); EVAL(latency_stddev); EVAL(latency_regain); + EVAL(latency_current); } SettingsNotifier(Settings& settings) diff --git a/src/staminafilter.cc b/src/staminafilter.cc index a8f6a86..aadfd2d 100644 --- a/src/staminafilter.cc +++ b/src/staminafilter.cc @@ -76,5 +76,7 @@ bool StaminaFilter::filter(event_t& event, size_t pos) mod *= velocity_modifier_weight; } + settings.velocity_modifier_current.store(mod); + return true; } -- cgit v1.2.3