Skip to content

Commit

Permalink
Merge pull request #11873 from fwcd/fix-analyzer-track-use
Browse files Browse the repository at this point in the history
AnalyzerThread: Pass `AnalyzerTrack` correctly again
  • Loading branch information
daschuer authored Aug 27, 2023
2 parents aa4b9d5 + 884e90a commit 2e169e1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/analyzer/analyzerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void AnalyzerThread::doRun() {
for (auto&& analyzer : m_analyzers) {
// Make sure not to short-circuit initialize(...)
if (analyzer.initialize(
m_currentTrack->getTrack(),
*m_currentTrack,
audioSource->getSignalInfo().getSampleRate(),
audioSource->frameLength())) {
processTrack = true;
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzertrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AnalyzerTrack {
std::optional<bool> useFixedTempo;
};

AnalyzerTrack(TrackPointer track, Options options = Options());
explicit AnalyzerTrack(TrackPointer track, Options options = Options());

/// Fetches the (not-null) track to be analyzed.
const TrackPointer& getTrack() const;
Expand Down
3 changes: 2 additions & 1 deletion src/test/analyserwaveformtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QtDebug>
#include <vector>

#include "analyzer/analyzertrack.h"
#include "analyzer/analyzerwaveform.h"
#include "library/dao/analysisdao.h"
#include "test/mixxxtest.h"
Expand Down Expand Up @@ -100,7 +101,7 @@ class AnalyzerWaveformTest : public MixxxTest {

// Basic test to make sure we don't alter the input buffer and don't step out of bounds.
TEST_F(AnalyzerWaveformTest, canary) {
m_aw.initialize(m_pTrack,
m_aw.initialize(AnalyzerTrack(m_pTrack),
m_pTrack->getSampleRate(),
kBigBufSize / kChannelCount);
m_aw.processSamples(&m_canaryBigBuf[kCanarySize], kBigBufSize);
Expand Down
3 changes: 2 additions & 1 deletion src/test/analyzersilence_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <vector>

#include "analyzer/analyzertrack.h"
#include "engine/engine.h"
#include "test/mixxxtest.h"
#include "track/track.h"
Expand Down Expand Up @@ -37,7 +38,7 @@ class AnalyzerSilenceTest : public MixxxTest {
}

void analyzeTrack() {
analyzerSilence.initialize(pTrack,
analyzerSilence.initialize(AnalyzerTrack(pTrack),
pTrack->getSampleRate(),
kTrackLengthFrames);
analyzerSilence.processSamples(pTrackSampleData.data(), nTrackSampleDataLength);
Expand Down

0 comments on commit 2e169e1

Please sign in to comment.