void AnalysisFeature::bindWidget(WLibrary* libraryWidget, MixxxKeyboard* keyboard) { m_pAnalysisView = new DlgAnalysis(libraryWidget, m_pConfig, m_pTrackCollection); connect(m_pAnalysisView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAnalysisView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); connect(m_pAnalysisView, SIGNAL(analyzeTracks(QList<int>)), this, SLOT(analyzeTracks(QList<int>))); connect(m_pAnalysisView, SIGNAL(stopAnalysis()), this, SLOT(stopAnalysis())); connect(m_pAnalysisView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); connect(this, SIGNAL(analysisActive(bool)), m_pAnalysisView, SLOT(analysisActive(bool))); connect(this, SIGNAL(trackAnalysisStarted(int)), m_pAnalysisView, SLOT(trackAnalysisStarted(int))); m_pAnalysisView->installEventFilter(keyboard); // Let the DlgAnalysis know whether or not analysis is active. bool bAnalysisActive = m_pAnalyserQueue != NULL; emit(analysisActive(bAnalysisActive)); libraryWidget->registerView(m_sAnalysisViewName, m_pAnalysisView); }
void AnalysisFeature::analyzeTracks(QList<int> trackIds) { if (m_pAnalyserQueue == NULL) { // Save the old BPM detection prefs setting (on or off) m_iOldBpmEnabled = m_pConfig->getValueString(ConfigKey("[BPM]","BPMDetectionEnabled")).toInt(); // Force BPM detection to be on. m_pConfig->set(ConfigKey("[BPM]","BPMDetectionEnabled"), ConfigValue(1)); // Note: this sucks... we should refactor the prefs/analyser to fix this hacky bit ^^^^. m_pAnalyserQueue = AnalyserQueue::createAnalysisFeatureAnalyserQueue(m_pConfig, m_pTrackCollection); connect(m_pAnalyserQueue, SIGNAL(trackProgress(int)), m_pAnalysisView, SLOT(trackAnalysisProgress(int))); connect(m_pAnalyserQueue, SIGNAL(trackFinished(int)), m_pAnalysisView, SLOT(trackAnalysisFinished(int))); connect(m_pAnalyserQueue, SIGNAL(queueEmpty()), this, SLOT(cleanupAnalyser())); emit(analysisActive(true)); } foreach(int trackId, trackIds) { TrackPointer pTrack = m_pTrackCollection->getTrackDAO().getTrack(trackId); if (pTrack) { //qDebug() << this << "Queueing track for analysis" << pTrack->getLocation(); m_pAnalyserQueue->queueAnalyseTrack(pTrack); } }
void AnalysisFeature::analyzeTracks(QList<int> trackIds) { if (m_pAnalyserQueue == NULL) { // Save the old BPM detection prefs setting (on or off) m_iOldBpmEnabled = m_pConfig->getValueString(ConfigKey("[BPM]","BPMDetectionEnabled")).toInt(); // Force BPM detection to be on. m_pConfig->set(ConfigKey("[BPM]","BPMDetectionEnabled"), ConfigValue(1)); // Note: this sucks... we should refactor the prefs/analyser to fix this hacky bit ^^^^. m_pAnalyserQueue = AnalyserQueue::createAnalysisFeatureAnalyserQueue(m_pConfig, m_pTrackCollection); connect(m_pAnalyserQueue, SIGNAL(trackProgress(int)), m_pAnalysisView, SLOT(trackAnalysisProgress(int))); connect(m_pAnalyserQueue, SIGNAL(trackFinished(int)), this, SLOT(slotProgressUpdate(int))); connect(m_pAnalyserQueue, SIGNAL(trackFinished(int)), m_pAnalysisView, SLOT(trackAnalysisFinished(int))); connect(m_pAnalyserQueue, SIGNAL(queueEmpty()), this, SLOT(cleanupAnalyser())); emit(analysisActive(true)); }