summaryrefslogtreecommitdiffstats
path: root/src/engine/bpmcontrol.cpp
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2018-11-01 01:12:05 -0500
committerBe <be@mixxx.org>2018-11-01 01:12:05 -0500
commit14192541f5078e86dfbbb49b0ec647a3a736ddad (patch)
tree58f07c93052692c3a5c3dc290ff9925a4fb84072 /src/engine/bpmcontrol.cpp
parent7f49d733123c650781a0bafda638efc013ef394f (diff)
minor code cleanup
Diffstat (limited to 'src/engine/bpmcontrol.cpp')
-rw-r--r--src/engine/bpmcontrol.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/engine/bpmcontrol.cpp b/src/engine/bpmcontrol.cpp
index 1fcbd16d7d..e2427dbe4c 100644
--- a/src/engine/bpmcontrol.cpp
+++ b/src/engine/bpmcontrol.cpp
@@ -14,6 +14,7 @@
#include "util/math.h"
#include "util/duration.h"
+namespace {
const int kMinBpm = 30;
// Maximum allowed interval between beats (calculated from kMinBpm).
const mixxx::Duration kMaxInterval = mixxx::Duration::fromMillis(1000.0 * (60.0 / kMinBpm));
@@ -21,6 +22,8 @@ const int kFilterLength = 5;
// The local_bpm is calculated forward and backward this number of beats, so
// the actual number of beats is this x2.
const int kLocalBpmSpan = 4;
+const SINT kSamplesPerFrame = 2;
+}
BpmControl::BpmControl(QString group,
UserSettingsPointer pConfig) :
@@ -849,8 +852,9 @@ void BpmControl::collectFeatures(GroupFeatureState* pGroupFeatures) const {
dThisPrevBeat, dThisNextBeat,
&dThisBeatLength, &dThisBeatFraction)) {
pGroupFeatures->has_beat_length_sec = true;
- // Note: dThisBeatLength is fractional frames count * 2 (stereo samples)
- pGroupFeatures->beat_length_sec = dThisBeatLength / m_pTrack->getSampleRate() / 2 / calcRateRatio();
+ // Note: dThisBeatLength is fractional frames count * 2 (stereo samples)
+ pGroupFeatures->beat_length_sec = dThisBeatLength / kSamplesPerFrame
+ / m_pTrack->getSampleRate() / calcRateRatio();
pGroupFeatures->has_beat_fraction = true;
pGroupFeatures->beat_fraction = dThisBeatFraction;