diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-03-30 11:15:57 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-03-30 11:15:57 +0200 |
commit | 011143d37aa438a7204c6a4a407db5c49e3fc6c5 (patch) | |
tree | 7fabae02245367c697f5fe3fe35009d3cb55f960 /src/powerlist.cc | |
parent | f271a3905a0e8d16f9258ba0b8743a8fd689e787 (diff) | |
parent | c852a24fc978ca7916c0f5819bfed870a1d9519e (diff) |
Merge branch 'master' of http://git.drumgizmo.org/drumgizmo
Diffstat (limited to 'src/powerlist.cc')
-rw-r--r-- | src/powerlist.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/powerlist.cc b/src/powerlist.cc index 4f02892..cf843a3 100644 --- a/src/powerlist.cc +++ b/src/powerlist.cc @@ -168,16 +168,22 @@ void PowerList::finalise() master->load(); float power = 0; - size_t s = 0; - for(; s < SIZE && s < master->size; s++) { - power += master->data[s] * master->data[s]; - } + if(sample->power == -1) { // Power not defined. Calculate it! + DEBUG(powerlist, "Calculating power\n"); + size_t s = 0; + for(; s < SIZE && s < master->size; s++) { + power += master->data[s] * master->data[s]; + } - power = sqrt(power); + power = sqrt(power); - if(power > power_max) power_max = power; + if(power > power_max) power_max = power; - item.power = power; + item.power = power; + } else { // Power defined in xml + DEBUG(powerlist, "Using power from xml\n"); + power = sample->power; + } DEBUG(rand, " - power: %f\n", power); |