summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Glöckner <cgloeckner@freenet.de>2016-05-09 10:48:44 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-23 14:47:57 +0200
commit2f2cde95bce634f26e43cdcb94cae7b27e378544 (patch)
tree6442a4b1eba4ade7a1d36caf86274a59f681ca73
parent3c6f5986adfb2ca4bf2ae7cb15d26793d4fa74fd (diff)
Initial Refactoring on PowerList
-rw-r--r--src/powerlist.cc9
-rw-r--r--src/powerlist.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/powerlist.cc b/src/powerlist.cc
index b502d03..bd8f447 100644
--- a/src/powerlist.cc
+++ b/src/powerlist.cc
@@ -48,7 +48,9 @@ unsigned int const MIN_SAMPLE_SET_SIZE = 26u;
// Enable to calculate power on old samples without power attribute
//#define AUTO_CALCULATE_POWER
-unsigned int const LOAD_SIZE = 500u;
+unsigned int const SIZE = 500u;
+
+float const THRES = 1.f;
PowerList::PowerList(Random& rand)
: rand(rand)
@@ -82,7 +84,7 @@ Channel* PowerList::getMasterChannel()
Channel* c = pair.first;
AudioFile* af = pair.second;
- af->load(LOAD_SIZE);
+ af->load(SIZE);
float silence{0.f};
std::size_t silence_length{4u};
@@ -176,7 +178,8 @@ void PowerList::finalise()
DEBUG(powerlist, "Calculating power\n");
float power{0.f};
- for(auto s = 0u; s < LOAD_SIZE && s < master->size; ++s)
+
+ for(auto s = 0u; s < SIZE && s < master->size; ++s)
{
power += master->data[s] * master->data[s];
}
diff --git a/src/powerlist.h b/src/powerlist.h
index ff360b4..f194fb0 100644
--- a/src/powerlist.h
+++ b/src/powerlist.h
@@ -49,7 +49,7 @@ private:
};
Random& rand;
-
+
std::vector<PowerListItem> samples;
float power_max;
float power_min;