diff options
author | André Nusser <anusser@mpi-inf.mpg.de> | 2021-02-13 12:25:50 +0100 |
---|---|---|
committer | André Nusser <anusser@mpi-inf.mpg.de> | 2021-02-13 12:25:50 +0100 |
commit | a7bd23a0744def7d3dc34779a789591589561097 (patch) | |
tree | 99b6aca06b6cb55956a20b8e151a53ee0d8ce966 | |
parent | f520e84d8be8018556a93fcf4a894403be829423 (diff) |
Small cleaning up and comment.
-rw-r--r-- | src/sample_selection.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sample_selection.cc b/src/sample_selection.cc index 4ebbf2f..cec90b1 100644 --- a/src/sample_selection.cc +++ b/src/sample_selection.cc @@ -142,8 +142,9 @@ const Sample* SampleSelection::get(level_t level, float position, std::size_t po auto random = rand.floatInRange(0.,1.); auto close = (samples[current_index].power - level)/power_range; auto diverse = 1./(1. + (float)(pos - last[current_index])/settings.samplerate); - auto closepos = (position - samples[current_index].sample->getPosition()); - auto value = f_close*pow2(close) + f_diverse*diverse + f_random*random + f_position*pow2(closepos); + auto closepos = samples[current_index].sample->getPosition() - position; + // note that the value below for close and closepos is actually the weighted squared l2 distance in 2d + auto value = f_close*pow2(close) + f_position*pow2(closepos) + f_diverse*diverse + f_random*random; if (value < value_opt) { |