diff options
author | André Nusser <anusser@mpi-inf.mpg.de> | 2021-02-13 12:25:50 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-07-22 11:21:57 +0200 |
commit | 6732ac4278bae1bf5bfeb9d4ca9e0fdfa1aaf369 (patch) | |
tree | a9befeffa60e51e669db563fc60f9d89c372106d | |
parent | bbfd9c379044e140cf03d00c27a3e695678d5f50 (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 53417b8..eb023c5 100644 --- a/src/sample_selection.cc +++ b/src/sample_selection.cc @@ -141,8 +141,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) { |