Skip to content

Commit

Permalink
Fix and enable multi-threaded analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Oct 30, 2018
1 parent db7fe92 commit c236956
Show file tree
Hide file tree
Showing 38 changed files with 1,718 additions and 861 deletions.
7 changes: 5 additions & 2 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,8 @@ def sources(self, build):
"src/engine/cachingreaderchunk.cpp",
"src/engine/cachingreaderworker.cpp",

"src/analyzer/analyzerqueue.cpp",
"src/analyzer/trackanalysisscheduler.cpp",
"src/analyzer/analyzerthread.cpp",
"src/analyzer/analyzerwaveform.cpp",
"src/analyzer/analyzergain.cpp",
"src/analyzer/analyzerebur128.cpp",
Expand Down Expand Up @@ -982,7 +983,7 @@ def sources(self, build):
"src/library/bpmdelegate.cpp",
"src/library/previewbuttondelegate.cpp",
"src/library/coverartdelegate.cpp",
"src/library/tableitemdelegate.cpp",
"src/library/tableitemdelegate.cpp",

"src/library/treeitemmodel.cpp",
"src/library/treeitem.cpp",
Expand Down Expand Up @@ -1153,6 +1154,8 @@ def sources(self, build):
"src/util/indexrange.cpp",
"src/util/desktophelper.cpp",
"src/util/widgetrendertimer.cpp",
"src/util/workerthread.cpp",
"src/util/workerthreadscheduler.cpp",
]

proto_args = {
Expand Down
4 changes: 4 additions & 0 deletions src/analyzer/analyzerebur128.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class AnalyzerEbur128 : public Analyzer {
AnalyzerEbur128(UserSettingsPointer pConfig);
virtual ~AnalyzerEbur128();

static bool isEnabled(const ReplayGainSettings& rgSettings) {
return rgSettings.isAnalyzerEnabled(2);
}

bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override;
bool isDisabledOrLoadStoredSuccess(TrackPointer tio) const override;
void process(const CSAMPLE* pIn, const int iLen) override;
Expand Down
4 changes: 4 additions & 0 deletions src/analyzer/analyzergain.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class AnalyzerGain : public Analyzer {
AnalyzerGain(UserSettingsPointer pConfig);
virtual ~AnalyzerGain();

static bool isEnabled(const ReplayGainSettings& rgSettings) {
return rgSettings.isAnalyzerEnabled(1);
}

bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override;
bool isDisabledOrLoadStoredSuccess(TrackPointer tio) const override;
void process(const CSAMPLE* pIn, const int iLen) override;
Expand Down
22 changes: 22 additions & 0 deletions src/analyzer/analyzerprogress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include "util/math.h"


typedef double AnalyzerProgress;

constexpr AnalyzerProgress kAnalyzerProgressUnknown = -1.0;
constexpr AnalyzerProgress kAnalyzerProgressNone = 0.0; // 0.0 %
constexpr AnalyzerProgress kAnalyzerProgressHalf = 0.5; // 50.0 %
constexpr AnalyzerProgress kAnalyzerProgressFinalizing = 0.95; // 95.0 %
constexpr AnalyzerProgress kAnalyzerProgressDone = 1.0; // 100.0%

Q_DECLARE_METATYPE(AnalyzerProgress);

// Integer [0, 100]
inline
int analyzerProgressPercent(AnalyzerProgress analyzerProgress) {
DEBUG_ASSERT(analyzerProgress >= kAnalyzerProgressNone);
return int((100 * (math_min(analyzerProgress, kAnalyzerProgressDone) - kAnalyzerProgressNone)) /
(kAnalyzerProgressDone - kAnalyzerProgressNone));
}
Loading

0 comments on commit c236956

Please sign in to comment.