Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrestrained multi-threaded analysis #2142

Merged
merged 1 commit into from
Jun 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/analyzer/plugins/analyzerqueenmarykey.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <dsp/keydetection/GetKeyMode.h>

#include <QMutex>

// Class header comes after library includes here since our preprocessor
// definitions interfere with qm-dsp's headers.
#include "analyzer/plugins/analyzerqueenmarykey.h"
Expand All @@ -21,12 +19,6 @@ constexpr int kChromaWindowLength = 10;
// Tuning frequency of concert A in Hertz. Default value from VAMP plugin.
constexpr int kTuningFrequencyHertz = 440;

// NOTE(2019-01-26, uklotzde) Temporary workaround until multi-threading
// issues when using the qm-dsp key detector have been solved. Synchronizes
// all invocations of initialize()/process()/finalize().
// See also: https://bugs.launchpad.net/mixxx/+bug/1813413
QMutex s_mutex;

} // namespace

AnalyzerQueenMaryKey::AnalyzerQueenMaryKey()
Expand All @@ -45,7 +37,6 @@ bool AnalyzerQueenMaryKey::initialize(int samplerate) {
size_t windowSize = m_pKeyMode->getBlockSize();
size_t stepSize = m_pKeyMode->getHopSize();

QMutexLocker locked(&s_mutex);
return m_helper.initialize(
windowSize, stepSize, [this](double* pWindow, size_t) {
int iKey = m_pKeyMode->process(pWindow);
Expand Down Expand Up @@ -75,13 +66,11 @@ bool AnalyzerQueenMaryKey::process(const CSAMPLE* pIn, const int iLen) {

const size_t numInputFrames = iLen / kAnalysisChannels;
m_currentFrame += numInputFrames;
QMutexLocker locked(&s_mutex);
return m_helper.processStereoSamples(pIn, iLen);
}

bool AnalyzerQueenMaryKey::finalize() {
// TODO(rryan) do we need a flush?
QMutexLocker locked(&s_mutex);
m_helper.finalize();
m_pKeyMode.reset();
return true;
Expand Down