summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-08-19 10:23:49 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-08-19 10:23:49 +0200
commit8205b1cb55e41085f8d044839964dcbcf7d0ae9c (patch)
tree0b49276f9c91ac90fa0b5d2d5e2652cbecb14d6d /src
parentff36b44d2182fc51be7bd4c1e06a29b0b403fd89 (diff)
Move sample lookup retry count to Settings.
Diffstat (limited to 'src')
-rw-r--r--src/powerlist.cc2
-rw-r--r--src/settings.h12
2 files changed, 13 insertions, 1 deletions
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<float> velocity_modifier_weight{velocity_modifier_weight_default};
Atomic<float> 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<std::size_t> sample_selection_retry_count{sample_selection_retry_count_default};
+
// Current velocity offset - for UI
Atomic<float> velocity_modifier_current{1.0f};
@@ -157,6 +163,9 @@ struct SettingsGetter
SettingRef<float> velocity_modifier_falloff;
SettingRef<float> velocity_modifier_weight;
SettingRef<float> velocity_stddev;
+
+ SettingRef<std::size_t> sample_selection_retry_count;
+
SettingRef<float> velocity_modifier_current;
SettingRef<bool> 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<float> velocity_modifier_falloff;
Notifier<float> velocity_modifier_weight;
Notifier<float> velocity_stddev;
+ Notifier<std::size_t> sample_selection_retry_count;
Notifier<float> velocity_modifier_current;
Notifier<bool> 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);