From 8205b1cb55e41085f8d044839964dcbcf7d0ae9c Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 19 Aug 2018 10:23:49 +0200 Subject: Move sample lookup retry count to Settings. --- src/powerlist.cc | 2 +- src/settings.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/powerlist.cc b/src/powerlist.cc index 56962d7..67dae2f 100644 --- a/src/powerlist.cc +++ b/src/powerlist.cc @@ -215,7 +215,7 @@ Sample* PowerList::get(level_t level) return nullptr; // No samples to choose from. } - int retry = 3; // TODO: This must be user controllable via the UI. + int retry = settings.sample_selection_retry_count.load(); Sample* sample{nullptr}; diff --git a/src/settings.h b/src/settings.h index 13bb956..4a7d904 100644 --- a/src/settings.h +++ b/src/settings.h @@ -79,6 +79,12 @@ struct Settings Atomic velocity_modifier_weight{velocity_modifier_weight_default}; Atomic velocity_stddev{velocity_stddev_default}; // [0.5; 3.0] + //! Control number of times to retry sample selection as long as the sample + //! is the same one as the last one. + //! 0: will do no retries, ie. just use the first sample found. + static std::size_t constexpr sample_selection_retry_count_default = 3; + Atomic sample_selection_retry_count{sample_selection_retry_count_default}; + // Current velocity offset - for UI Atomic velocity_modifier_current{1.0f}; @@ -157,6 +163,9 @@ struct SettingsGetter SettingRef velocity_modifier_falloff; SettingRef velocity_modifier_weight; SettingRef velocity_stddev; + + SettingRef sample_selection_retry_count; + SettingRef velocity_modifier_current; SettingRef enable_velocity_randomiser; @@ -205,6 +214,7 @@ struct SettingsGetter , velocity_modifier_falloff{settings.velocity_modifier_falloff} , velocity_modifier_weight{settings.velocity_modifier_weight} , velocity_stddev{settings.velocity_stddev} + , sample_selection_retry_count(settings.sample_selection_retry_count) , velocity_modifier_current{settings.velocity_modifier_current} , enable_velocity_randomiser{settings.enable_velocity_randomiser} , velocity_randomiser_weight{settings.velocity_randomiser_weight} @@ -255,6 +265,7 @@ public: Notifier velocity_modifier_falloff; Notifier velocity_modifier_weight; Notifier velocity_stddev; + Notifier sample_selection_retry_count; Notifier velocity_modifier_current; Notifier enable_velocity_randomiser; @@ -309,6 +320,7 @@ public: EVAL(velocity_modifier_falloff); EVAL(velocity_modifier_weight); EVAL(velocity_stddev); + EVAL(sample_selection_retry_count); EVAL(velocity_modifier_current); EVAL(enable_velocity_randomiser); -- cgit v1.2.3