diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-11-05 12:49:16 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-11-05 12:49:16 +0100 |
commit | 424075047c41b06945801baca104a9ffb23032a3 (patch) | |
tree | dcd99c984adaa68c167892d46e6b018512df1b57 /src/powerlist.cc | |
parent | f287d6244133c935f9b22f0e6302e42149ed88f3 (diff) |
Add stddev scalar to sample selection.
Diffstat (limited to 'src/powerlist.cc')
-rw-r--r-- | src/powerlist.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/powerlist.cc b/src/powerlist.cc index b5e7c84..37a13a3 100644 --- a/src/powerlist.cc +++ b/src/powerlist.cc @@ -38,6 +38,9 @@ #endif #include <math.h> +#include "random.h" +#include "settings.h" + /** * Minimum sample set size. * Smaller means wider 'velocity groups'. @@ -50,8 +53,9 @@ unsigned int const MIN_SAMPLE_SET_SIZE = 26u; //#define AUTO_CALCULATE_POWER unsigned int const LOAD_SIZE = 500u; -PowerList::PowerList(Random& rand) +PowerList::PowerList(Random& rand, Settings& settings) : rand(rand) + , settings(settings) { power_max = 0; power_min = 100000000; @@ -204,6 +208,8 @@ void PowerList::finalise() Sample* PowerList::get(level_t level) { + auto velocity_stddev = settings.velocity_stddev.load(); + if(!samples.size()) { return nullptr; // No samples to choose from. @@ -226,6 +232,7 @@ Sample* PowerList::get(level_t level) // Cut off mean value with stddev/2 in both ends in order to make room for // downwards expansion on velocity 0 and upwards expansion on velocity 1. float mean = level * (power_span - stddev) + (stddev / 2.0); + stddev *= velocity_stddev; float power{0.f}; |