diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2014-11-15 21:41:17 +0100 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2014-11-16 12:56:40 +0100 |
commit | 2cd93b3a074c3fc9e963541524c04c5a3900fc12 (patch) | |
tree | 4c02777193f51809f97dd78a42b1a4b827e86ee1 /src/analyserqueue.cpp | |
parent | 456c2e06b33608de6d8b86ccc54a80fc5b194f5f (diff) |
Eliminate inappropriate inheritance: SoundSourceProxy is-not-a SoundSource
Diffstat (limited to 'src/analyserqueue.cpp')
-rw-r--r-- | src/analyserqueue.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/analyserqueue.cpp b/src/analyserqueue.cpp index 699d6f3f18..44d31efa9b 100644 --- a/src/analyserqueue.cpp +++ b/src/analyserqueue.cpp @@ -160,7 +160,7 @@ TrackPointer AnalyserQueue::dequeueNextBlocking() { } // This is called from the AnalyserQueue thread -bool AnalyserQueue::doAnalysis(TrackPointer tio, SoundSourceProxy* pSoundSource) { +bool AnalyserQueue::doAnalysis(TrackPointer tio, const Mixxx::SoundSourcePointer& pSoundSource) { int totalSamples = pSoundSource->length(); //qDebug() << tio->getFilename() << " has " << totalSamples << " samples."; int processedSamples = 0; @@ -300,13 +300,18 @@ void AnalyserQueue::run() { Trace trace("AnalyserQueue analyzing track"); // Get the audio - SoundSourceProxy soundSource(nextTrack); - soundSource.open(); //Open the file for reading - int iNumSamples = soundSource.length(); - int iSampleRate = soundSource.getSampleRate(); + SoundSourceProxy soundSourceProxy(nextTrack); + if (OK != soundSourceProxy.open()) { //Open the file for reading + qWarning() << "Failed to open file for analyzing:" << soundSourceProxy.getFilename(); + continue; + } + + Mixxx::SoundSourcePointer pSoundSource(soundSourceProxy.getSoundSource()); + int iNumSamples = pSoundSource->length(); + int iSampleRate = pSoundSource->getSampleRate(); if (iNumSamples == 0 || iSampleRate == 0) { - qDebug() << "Skipping invalid file:" << nextTrack->getLocation(); + qWarning() << "Skipping invalid file:" << nextTrack->getLocation(); continue; } @@ -325,7 +330,7 @@ void AnalyserQueue::run() { if (processTrack) { emitUpdateProgress(nextTrack, 0); - bool completed = doAnalysis(nextTrack, &soundSource); + bool completed = doAnalysis(nextTrack, pSoundSource); if (!completed) { //This track was cancelled QListIterator<Analyser*> itf(m_aq); |