From 39e841af517c0c82a54702eeafb7651e03260601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sat, 13 Feb 2021 12:35:45 +0100 Subject: Add position parameter of sample selection to settings. --- src/sample_selection.cc | 6 +++--- src/settings.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sample_selection.cc b/src/sample_selection.cc index eb023c5..eb13e55 100644 --- a/src/sample_selection.cc +++ b/src/sample_selection.cc @@ -69,16 +69,16 @@ const Sample* SampleSelection::get(level_t level, float position, std::size_t po float pos_opt{0.f}; float value_opt{std::numeric_limits::max()}; // the following three values are mostly for debugging - float random_opt = 0.; float close_opt = 0.; - float diverse_opt = 0.; float closepos_opt = 0.; + float random_opt = 0.; + float diverse_opt = 0.; // Note the magic values in front of the settings factors. const float f_close = 4.*settings.sample_selection_f_close.load(); + const float f_position = 1000.*settings.sample_selection_f_position.load(); // FIXME: huge factor for now const float f_diverse = (1./2.)*settings.sample_selection_f_diverse.load(); const float f_random = (1./3.)*settings.sample_selection_f_random.load(); - const float f_position = 1000.; // FIXME: get from settings float power_range = powerlist.getMaxPower() - powerlist.getMinPower(); // If all power values are the same then power_range is invalid but we want diff --git a/src/settings.h b/src/settings.h index fb93d79..a423ae3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -77,12 +77,14 @@ struct Settings static float constexpr velocity_modifier_weight_default = 0.25f; static float constexpr velocity_stddev_default = .45f; static float constexpr sample_selection_f_close_default = .85f; + static float constexpr sample_selection_f_position_default = 1.f; static float constexpr sample_selection_f_diverse_default = .16f; static float constexpr sample_selection_f_random_default = .07f; Atomic velocity_modifier_falloff{velocity_modifier_falloff_default}; Atomic velocity_modifier_weight{velocity_modifier_weight_default}; Atomic velocity_stddev{velocity_stddev_default}; Atomic sample_selection_f_close{sample_selection_f_close_default}; + Atomic sample_selection_f_position{sample_selection_f_position_default}; Atomic sample_selection_f_diverse{sample_selection_f_diverse_default}; Atomic sample_selection_f_random{sample_selection_f_random_default}; @@ -201,6 +203,7 @@ struct SettingsGetter SettingRef velocity_modifier_weight; SettingRef velocity_stddev; SettingRef sample_selection_f_close; + SettingRef sample_selection_f_position; SettingRef sample_selection_f_diverse; SettingRef sample_selection_f_random; @@ -276,6 +279,7 @@ struct SettingsGetter , velocity_modifier_weight{settings.velocity_modifier_weight} , velocity_stddev{settings.velocity_stddev} , sample_selection_f_close{settings.sample_selection_f_close} + , sample_selection_f_position{settings.sample_selection_f_position} , sample_selection_f_diverse{settings.sample_selection_f_diverse} , sample_selection_f_random{settings.sample_selection_f_random} , sample_selection_retry_count(settings.sample_selection_retry_count) @@ -346,6 +350,7 @@ public: Notifier velocity_modifier_weight; Notifier velocity_stddev; Notifier sample_selection_f_close; + Notifier sample_selection_f_position; Notifier sample_selection_f_diverse; Notifier sample_selection_f_random; Notifier sample_selection_retry_count; @@ -425,6 +430,7 @@ public: EVAL(velocity_modifier_weight); EVAL(velocity_stddev); EVAL(sample_selection_f_close); + EVAL(sample_selection_f_position); EVAL(sample_selection_f_diverse); EVAL(sample_selection_f_random); EVAL(sample_selection_retry_count); -- cgit v1.2.3