Skip to content

Commit

Permalink
Merge pull request #1624 from uklotzde/lp1737537_analysis_revamp
Browse files Browse the repository at this point in the history
Analysis Revamp
  • Loading branch information
Be-ing authored Dec 30, 2018
2 parents 7faf5e0 + 78d2db8 commit b9c9b7f
Show file tree
Hide file tree
Showing 43 changed files with 1,869 additions and 894 deletions.
7 changes: 5 additions & 2 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,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 @@ -986,7 +987,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 @@ -1157,6 +1158,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
25 changes: 25 additions & 0 deletions src/analyzer/analyzerprogress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#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);
const auto analyzerProgressClamped =
math_min(analyzerProgress, kAnalyzerProgressDone);
return static_cast<int>(std::round(
100 * (analyzerProgressClamped - kAnalyzerProgressNone) /
(kAnalyzerProgressDone - kAnalyzerProgressNone)));
}
Loading

0 comments on commit b9c9b7f

Please sign in to comment.