summaryrefslogtreecommitdiffstats
path: root/src/analyzer
diff options
context:
space:
mode:
authorJan Holthuis <jholthuis@mixxx.org>2021-07-02 11:45:55 +0200
committerJan Holthuis <jholthuis@mixxx.org>2021-07-02 11:45:55 +0200
commite671a6c00d96300733901efe840be9b3bcea4c05 (patch)
tree56cc7e22e4e5ed0355374ddab2d3788e5f72eb0c /src/analyzer
parent35a5ccdb8e5bacead6e3f4508e6fecfb09f5a3cb (diff)
AnalyzerQueenMaryBeats: Rename m_stepSize to m_stepSizeFrames
Diffstat (limited to 'src/analyzer')
-rw-r--r--src/analyzer/plugins/analyzerqueenmarybeats.cpp21
-rw-r--r--src/analyzer/plugins/analyzerqueenmarybeats.h2
2 files changed, 12 insertions, 11 deletions
diff --git a/src/analyzer/plugins/analyzerqueenmarybeats.cpp b/src/analyzer/plugins/analyzerqueenmarybeats.cpp
index 03c89ea19f..7ee5ba5d87 100644
--- a/src/analyzer/plugins/analyzerqueenmarybeats.cpp
+++ b/src/analyzer/plugins/analyzerqueenmarybeats.cpp
@@ -22,12 +22,12 @@ constexpr float kStepSecs = 0.01161f;
// results in 43 Hz @ 44.1 kHz / 47 Hz @ 48 kHz / 47 Hz @ 96 kHz
constexpr int kMaximumBinSizeHz = 50; // Hz
-DFConfig makeDetectionFunctionConfig(int stepSize, int windowSize) {
+DFConfig makeDetectionFunctionConfig(int stepSizeFrames, int windowSize) {
// These are the defaults for the VAMP beat tracker plugin we used in Mixxx
// 2.0.
DFConfig config;
config.DFType = DF_COMPLEXSD;
- config.stepSize = stepSize;
+ config.stepSize = stepSizeFrames;
config.frameLength = windowSize;
config.dbRise = 3;
config.adaptiveWhitening = false;
@@ -41,7 +41,7 @@ DFConfig makeDetectionFunctionConfig(int stepSize, int windowSize) {
AnalyzerQueenMaryBeats::AnalyzerQueenMaryBeats()
: m_iSampleRate(0),
m_windowSize(0),
- m_stepSize(0) {
+ m_stepSizeFrames(0) {
}
AnalyzerQueenMaryBeats::~AnalyzerQueenMaryBeats() {
@@ -50,14 +50,14 @@ AnalyzerQueenMaryBeats::~AnalyzerQueenMaryBeats() {
bool AnalyzerQueenMaryBeats::initialize(int samplerate) {
m_detectionResults.clear();
m_iSampleRate = samplerate;
- m_stepSize = static_cast<int>(m_iSampleRate * kStepSecs);
+ m_stepSizeFrames = static_cast<int>(m_iSampleRate * kStepSecs);
m_windowSize = MathUtilities::nextPowerOfTwo(m_iSampleRate / kMaximumBinSizeHz);
m_pDetectionFunction = std::make_unique<DetectionFunction>(
- makeDetectionFunctionConfig(m_stepSize, m_windowSize));
- qDebug() << "input sample rate is " << m_iSampleRate << ", step size is " << m_stepSize;
+ makeDetectionFunctionConfig(m_stepSizeFrames, m_windowSize));
+ qDebug() << "input sample rate is " << m_iSampleRate << ", step size is " << m_stepSizeFrames;
m_helper.initialize(
- m_windowSize, m_stepSize, [this](double* pWindow, size_t) {
+ m_windowSize, m_stepSizeFrames, [this](double* pWindow, size_t) {
// TODO(rryan) reserve?
m_detectionResults.push_back(
m_pDetectionFunction->processTimeDomain(pWindow));
@@ -97,7 +97,7 @@ bool AnalyzerQueenMaryBeats::finalize() {
beatPeriod.push_back(0.0);
}
- TempoTrackV2 tt(m_iSampleRate, m_stepSize);
+ TempoTrackV2 tt(m_iSampleRate, m_stepSizeFrames);
tt.calculateBeatPeriod(df, beatPeriod, tempi);
std::vector<double> beats;
@@ -105,9 +105,10 @@ bool AnalyzerQueenMaryBeats::finalize() {
m_resultBeats.reserve(static_cast<int>(beats.size()));
for (size_t i = 0; i < beats.size(); ++i) {
- // we add the halve m_stepSize here, because the beat
+ // we add the halve m_stepSizeFrames here, because the beat
// is detected between the two samples.
- const auto result = mixxx::audio::FramePos((beats.at(i) * m_stepSize) + m_stepSize / 2);
+ const auto result = mixxx::audio::FramePos(
+ (beats.at(i) * m_stepSizeFrames) + m_stepSizeFrames / 2);
m_resultBeats.push_back(result);
}
diff --git a/src/analyzer/plugins/analyzerqueenmarybeats.h b/src/analyzer/plugins/analyzerqueenmarybeats.h
index 46b1cae6d5..59dc754275 100644
--- a/src/analyzer/plugins/analyzerqueenmarybeats.h
+++ b/src/analyzer/plugins/analyzerqueenmarybeats.h
@@ -49,7 +49,7 @@ class AnalyzerQueenMaryBeats : public AnalyzerBeatsPlugin {
DownmixAndOverlapHelper m_helper;
int m_iSampleRate;
int m_windowSize;
- int m_stepSize;
+ int m_stepSizeFrames;
std::vector<double> m_detectionResults;
QVector<mixxx::audio::FramePos> m_resultBeats;
};