DlgAnalysis::DlgAnalysis(QWidget* parent, ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection) : QWidget(parent), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), m_bAnalysisActive(false), m_tracksInQueue(0), m_currentTrack(0) { setupUi(this); m_songsButtonGroup.addButton(radioButtonRecentlyAdded); m_songsButtonGroup.addButton(radioButtonAllSongs); m_pAnalysisLibraryTableView = new WAnalysisLibraryTableView(this, pConfig, pTrackCollection); connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); connect(m_pAnalysisLibraryTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); DEBUG_ASSERT_AND_HANDLE(box) { // Assumes the form layout is a QVBox/QHBoxLayout! } else {
bool Player::loadFile() { reed->close(); tracklist.clear(); if(!reed->readerOpen(fi)) { std::cerr << "Aborted reading.\n"; emit this->updatedTrackList(); return false; } for(uint16_t i = (reed->getFileType() == midi::MultiTrack?1:0), e = reed->getTrackCount(); i < e; ++i) tracklist.push_back(reed->getTrackName(i)); if (reed->getFileType() == midi::MultiTrack) { if(!loadTrack(1)) { emit this->updatedTrackList(); return false; } } else { if(!loadTrack(0)) { emit this->updatedTrackList(); return false; } } emit this->updatedTrackList(); return true; }
DlgRecording::DlgRecording(QWidget* parent, UserSettingsPointer pConfig, Library* pLibrary, TrackCollection* pTrackCollection, RecordingManager* pRecordingManager, KeyboardEventFilter* pKeyboard) : QWidget(parent), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), m_browseModel(this, m_pTrackCollection, pRecordingManager), m_proxyModel(&m_browseModel), m_bytesRecordedStr("--"), m_durationRecordedStr("--:--"), m_pRecordingManager(pRecordingManager) { setupUi(this); m_pTrackTableView = new WTrackTableView(this, pConfig, m_pTrackCollection, true); m_pTrackTableView->installEventFilter(pKeyboard); connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), m_pTrackTableView, SLOT(setTrackTableFont(QFont))); connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); connect(m_pRecordingManager, SIGNAL(isRecording(bool)), this, SLOT(slotRecordingEnabled(bool))); connect(m_pRecordingManager, SIGNAL(bytesRecorded(int)), this, SLOT(slotBytesRecorded(int))); connect(m_pRecordingManager, SIGNAL(durationRecorded(QString)), this, SLOT(slotDurationRecorded(QString))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); VERIFY_OR_DEBUG_ASSERT(box) { //Assumes the form layout is a QVBox/QHBoxLayout! } else {
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); }
/** Loads all tracks from the track directory (data/track). */ void TrackManager::loadTrackList() { m_all_track_dirs.clear(); m_track_group_names.clear(); m_track_groups.clear(); m_arena_group_names.clear(); m_soccer_arena_group_names.clear(); m_arena_groups.clear(); m_soccer_arena_groups.clear(); m_track_avail.clear(); m_tracks.clear(); for(unsigned int i=0; i<m_track_search_path.size(); i++) { const std::string &dir = m_track_search_path[i]; // First test if the directory itself contains a track: // ---------------------------------------------------- if(loadTrack(dir)) continue; // track found, no more tests // Then see if a subdir of this dir contains tracks // ------------------------------------------------ std::set<std::string> dirs; file_manager->listFiles(dirs, dir); for(std::set<std::string>::iterator subdir = dirs.begin(); subdir != dirs.end(); subdir++) { if(*subdir=="." || *subdir=="..") continue; loadTrack(dir+*subdir+"/"); } // for dir in dirs } // for i <m_track_search_path.size() } // loadTrackList
DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, Library* pLibrary, AutoDJProcessor* pProcessor, TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) : QWidget(parent), Ui::DlgAutoDJ(), m_pAutoDJProcessor(pProcessor), // no sorting m_pTrackTableView(new WTrackTableView(this, pConfig, pTrackCollection, false)), m_pAutoDJTableModel(NULL) { setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), m_pTrackTableView, SLOT(setTrackTableFont(QFont))); connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SLOT(updateSelectionInfo())); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); DEBUG_ASSERT_AND_HANDLE(box) { //Assumes the form layout is a QVBox/QHBoxLayout! } else {
void AutoDJFeature::bindWidget(WLibrary* libraryWidget, MixxxKeyboard* keyboard) { m_pAutoDJView = new DlgAutoDJ(libraryWidget, m_pConfig, m_pTrackCollection, keyboard); libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); }
void PluginTrack::onRequestFinished() { if (m_request->status() == ResourcesRequest::Ready) { loadTrack(m_request->service(), m_request->result().toMap()); } emit statusChanged(status()); }
TEST_F(CueControlTest, LoadAutodetectedCues_QuantizeDisabled) { m_pQuantizeEnabled->set(0); TrackPointer pTrack = createTestTrack(); pTrack->setSampleRate(44100); pTrack->setBpm(120.0); pTrack->setCuePoint(CuePosition(240.0, Cue::AUTOMATIC)); auto pIntro = pTrack->createAndAddCue(); pIntro->setType(Cue::INTRO); pIntro->setSource(Cue::AUTOMATIC); pIntro->setPosition(210.0); pIntro->setLength(120.0); auto pOutro = pTrack->createAndAddCue(); pOutro->setType(Cue::OUTRO); pOutro->setSource(Cue::AUTOMATIC); pOutro->setPosition(770.0); pOutro->setLength(220.0); loadTrack(pTrack); EXPECT_DOUBLE_EQ(240.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(210.0, m_pIntroStartPosition->get()); EXPECT_DOUBLE_EQ(330.0, m_pIntroEndPosition->get()); EXPECT_DOUBLE_EQ(770.0, m_pOutroStartPosition->get()); EXPECT_DOUBLE_EQ(990.0, m_pOutroEndPosition->get()); }
TEST_F(CueControlTest, LoadAutodetectedCues_QuantizeEnabled) { m_pQuantizeEnabled->set(1); TrackPointer pTrack = createTestTrack(); pTrack->setSampleRate(44100); pTrack->setBpm(120.0); const int frameSize = 2; const int sampleRate = pTrack->getSampleRate(); const double bpm = pTrack->getBpm(); const double beatLength = (60.0 * sampleRate / bpm) * frameSize; pTrack->setCuePoint(CuePosition(1.9 * beatLength, Cue::AUTOMATIC)); auto pIntro = pTrack->createAndAddCue(); pIntro->setType(Cue::INTRO); pIntro->setSource(Cue::AUTOMATIC); pIntro->setPosition(2.1 * beatLength); pIntro->setLength(1.2 * beatLength); auto pOutro = pTrack->createAndAddCue(); pOutro->setType(Cue::OUTRO); pOutro->setSource(Cue::AUTOMATIC); pOutro->setPosition(11.1 * beatLength); pOutro->setLength(4.4 * beatLength); loadTrack(pTrack); EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pIntroStartPosition->get()); EXPECT_DOUBLE_EQ(4.0 * beatLength, m_pIntroEndPosition->get()); EXPECT_DOUBLE_EQ(11.0 * beatLength, m_pOutroStartPosition->get()); EXPECT_DOUBLE_EQ(16.0 * beatLength, m_pOutroEndPosition->get()); }
PluginTrack::PluginTrack(const QString &service, const QVariantMap &track, QObject *parent) : MKTrack(parent), m_request(new ResourcesRequest(this)) { loadTrack(service, track); connect(m_request, SIGNAL(finished()), this, SLOT(onRequestFinished())); }
void CachingReader::run() { TrackPointer pLoadTrack; m_newTrackMutex.lock(); if (m_newTrack) { pLoadTrack = m_newTrack; m_newTrack = TrackPointer(); } m_newTrackMutex.unlock(); if (pLoadTrack) { loadTrack(pLoadTrack); } else { // Read the requested chunks. ChunkReadRequest request; ReaderStatusUpdate status; while (m_chunkReadRequestFIFO.read(&request, 1) == 1) { processChunkReadRequest(&request, &status); m_readerStatusFIFO.writeBlocking(&status, 1); } } // Notify the EngineWorkerScheduler that the work we did is done. setActive(false); }
TEST_F(CueControlTest, LoadTrackWithDetectedCues) { TrackPointer pTrack = createTestTrack(); pTrack->setCuePoint(CuePosition(100.0, Cue::AUTOMATIC)); auto pIntro = pTrack->createAndAddCue(); pIntro->setType(Cue::INTRO); pIntro->setSource(Cue::AUTOMATIC); pIntro->setPosition(100.0); pIntro->setLength(0.0); auto pOutro = pTrack->createAndAddCue(); pOutro->setType(Cue::OUTRO); pOutro->setSource(Cue::AUTOMATIC); pOutro->setPosition(-1.0); pOutro->setLength(200.0); loadTrack(pTrack); EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(100.0, m_pIntroStartPosition->get()); EXPECT_DOUBLE_EQ(-1.0, m_pIntroEndPosition->get()); EXPECT_DOUBLE_EQ(-1.0, m_pOutroStartPosition->get()); EXPECT_DOUBLE_EQ(200.0, m_pOutroEndPosition->get()); EXPECT_TRUE(m_pIntroStartEnabled->toBool()); EXPECT_FALSE(m_pIntroEndEnabled->toBool()); EXPECT_FALSE(m_pOutroStartEnabled->toBool()); EXPECT_TRUE(m_pOutroEndEnabled->toBool()); }
void CachingReaderWorker::run() { unsigned static id = 0; //the id of this thread, for debugging purposes QThread::currentThread()->setObjectName(QString("CachingReaderWorker %1").arg(++id)); CachingReaderChunkReadRequest request; Event::start(m_tag); while (!load_atomic(m_stop)) { if (m_newTrack) { TrackPointer pLoadTrack; { // locking scope QMutexLocker locker(&m_newTrackMutex); pLoadTrack = m_newTrack; m_newTrack = TrackPointer(); } // implicitly unlocks the mutex loadTrack(pLoadTrack); } else if (m_pChunkReadRequestFIFO->read(&request, 1) == 1) { // Read the requested chunk and send the result const ReaderStatusUpdate update(processReadRequest(request)); m_pReaderStatusFIFO->writeBlocking(&update, 1); } else { Event::end(m_tag); m_semaRun.acquire(); Event::start(m_tag); } } }
void CachingReaderWorker::run() { unsigned static id = 0; //the id of this thread, for debugging purposes QThread::currentThread()->setObjectName(QString("CachingReaderWorker %1").arg(++id)); TrackPointer pLoadTrack; ChunkReadRequest request; ReaderStatusUpdate status; Event::start(m_tag); while (!load_atomic(m_stop)) { if (m_newTrack) { m_newTrackMutex.lock(); pLoadTrack = m_newTrack; m_newTrack = TrackPointer(); m_newTrackMutex.unlock(); loadTrack(pLoadTrack); } else if (m_pChunkReadRequestFIFO->read(&request, 1) == 1) { // Read the requested chunks. processChunkReadRequest(&request, &status); m_pReaderStatusFIFO->writeBlocking(&status, 1); } else { Event::end(m_tag); m_semaRun.acquire(); Event::start(m_tag); } } }
TEST_F(CueControlTest, LoadTrackWithIntroEndAndOutroStart) { TrackPointer pTrack = createTestTrack(); auto pIntro = pTrack->createAndAddCue(); pIntro->setType(Cue::INTRO); pIntro->setSource(Cue::MANUAL); pIntro->setPosition(-1.0); pIntro->setLength(150.0); auto pOutro = pTrack->createAndAddCue(); pOutro->setType(Cue::OUTRO); pOutro->setSource(Cue::MANUAL); pOutro->setPosition(250.0); pOutro->setLength(0.0); loadTrack(pTrack); EXPECT_DOUBLE_EQ(-1.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(-1.0, m_pIntroStartPosition->get()); EXPECT_DOUBLE_EQ(150.0, m_pIntroEndPosition->get()); EXPECT_DOUBLE_EQ(250.0, m_pOutroStartPosition->get()); EXPECT_DOUBLE_EQ(-1.0, m_pOutroEndPosition->get()); EXPECT_FALSE(m_pIntroStartEnabled->toBool()); EXPECT_TRUE(m_pIntroEndEnabled->toBool()); EXPECT_TRUE(m_pOutroStartEnabled->toBool()); EXPECT_FALSE(m_pOutroEndEnabled->toBool()); }
void FMODMusic::beginScene() { random_shuffle( mTracks.begin(), mTracks.end() ); mIterator = mTracks.begin(); if ( mIterator != mTracks.end() ) loadTrack( &( *mIterator ) ); }
TEST_F(CueControlTest, SeekOnLoadZeroPos) { m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_ZERO_POS); TrackPointer pTrack = createTestTrack(); pTrack->setCuePoint(CuePosition(100.0, Cue::MANUAL)); loadTrack(pTrack); EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(0.0, getCurrentSample()); }
void BaseTrackPlayer::slotLoadTrack(TrackPointer track, bool bPlay) { //Disconnect the old track's signals. if (m_pLoadedTrack) { // Save the loops that are currently set in a loop cue. If no loop cue is // currently on the track, then create a new one. int loopStart = m_pLoopInPoint->get(); int loopEnd = m_pLoopOutPoint->get(); if (loopStart != -1 && loopEnd != -1 && even(loopStart) && even(loopEnd) && loopStart <= loopEnd) { Cue* pLoopCue = NULL; QList<Cue*> cuePoints = m_pLoadedTrack->getCuePoints(); QListIterator<Cue*> it(cuePoints); while (it.hasNext()) { Cue* pCue = it.next(); if (pCue->getType() == Cue::LOOP) { pLoopCue = pCue; } } if (!pLoopCue) { pLoopCue = m_pLoadedTrack->addCue(); pLoopCue->setType(Cue::LOOP); } pLoopCue->setPosition(loopStart); pLoopCue->setLength(loopEnd - loopStart); } // WARNING: Never. Ever. call bare disconnect() on an object. Mixxx // relies on signals and slots to get tons of things done. Don't // randomly disconnect things. // m_pLoadedTrack->disconnect(); disconnect(m_pLoadedTrack.data(), 0, m_pBPM, 0); disconnect(m_pLoadedTrack.data(), 0, this, 0); m_pReplayGain->slotSet(0); // Causes the track's data to be saved back to the library database. emit(unloadingTrack(m_pLoadedTrack)); } m_pLoadedTrack = track; // Listen for updates to the file's BPM connect(m_pLoadedTrack.data(), SIGNAL(bpmUpdated(double)), m_pBPM, SLOT(slotSet(double))); // Listen for updates to the file's Replay Gain connect(m_pLoadedTrack.data(), SIGNAL(ReplayGainUpdated(double)), this, SLOT(slotSetReplayGain(double))); //Request a new track from the reader emit(loadTrack(track, bPlay)); }
void RecordingFeature::bindWidget(WLibrary *libraryWidget, MixxxKeyboard *keyboard) { //The view will be deleted by LibraryWidget DlgRecording* pRecordingView = new DlgRecording(libraryWidget, m_pConfig, m_pTrackCollection, m_pRecordingManager, keyboard); pRecordingView->installEventFilter(keyboard); libraryWidget->registerView(m_sRecordingViewName, pRecordingView); connect(pRecordingView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(pRecordingView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(this, SIGNAL(refreshBrowseModel()), pRecordingView, SLOT(refreshBrowseModel())); connect(this, SIGNAL(requestRestoreSearch()), pRecordingView, SLOT(slotRestoreSearch())); connect(pRecordingView, SIGNAL(restoreSearch(QString)), this, SIGNAL(restoreSearch(QString))); }
void AutoDJFeature::bindWidget(WLibrary* libraryWidget, MixxxKeyboard* keyboard) { m_pAutoDJView = new DlgAutoDJ(libraryWidget, m_pConfig, m_pTrackCollection, keyboard); libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); #ifdef __AUTODJCRATES__ // Be informed when the user wants to add another random track. connect(m_pAutoDJView, SIGNAL(addRandomButton(bool)), this, SLOT(slotAddRandomTrack(bool))); connect(this, SIGNAL(enableAddRandom(bool)), m_pAutoDJView, SLOT(enableRandomButton(bool))); // Let subscribers know whether it's possible to add a random track. emit(enableAddRandom(m_crateList.length() > 0)); #endif // __AUTODJCRATES__ }
TEST_F(CueControlTest, SeekOnLoadDefault_CueRecallDisabled) { m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_DEFAULT); // Note: CueRecall uses inverse logic (0 means enabled). config()->set(ConfigKey("[Controls]", "CueRecall"), ConfigValue(1)); TrackPointer pTrack = createTestTrack(); pTrack->setCuePoint(CuePosition(100.0, Cue::MANUAL)); loadTrack(pTrack); EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(0.0, getCurrentSample()); }
void AutoDJFeature::bindWidget(WLibrary* libraryWidget, KeyboardEventFilter* keyboard) { m_pAutoDJView = new DlgAutoDJ(libraryWidget, m_pConfig, m_pLibrary, m_pAutoDJProcessor, m_pTrackCollection, keyboard); libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(m_pAutoDJView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); // Be informed when the user wants to add another random track. connect(m_pAutoDJProcessor,SIGNAL(randomTrackRequested(int)), this,SLOT(slotRandomQueue(int))); connect(m_pAutoDJView, SIGNAL(addRandomButton(bool)), this, SLOT(slotAddRandomTrack(bool))); }
void Library::addFeature(LibraryFeature* feature) { Q_ASSERT(feature); m_features.push_back(feature); m_pSidebarModel->addLibraryFeature(feature); connect(feature, SIGNAL(showTrackModel(QAbstractItemModel*)), this, SLOT(slotShowTrackModel(QAbstractItemModel*))); connect(feature, SIGNAL(switchToView(const QString&)), this, SLOT(slotSwitchToView(const QString&))); connect(feature, SIGNAL(loadTrack(TrackPointer)), this, SLOT(slotLoadTrack(TrackPointer))); connect(feature, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SLOT(slotLoadTrackToPlayer(TrackPointer, QString, bool))); connect(feature, SIGNAL(restoreSearch(const QString&)), this, SLOT(slotRestoreSearch(const QString&))); }
//-------------------------------------------------------------- void ofApp::keyReleased(int key){ if( key == ' '){ doFind = !doFind; } if( key == 'p'){ peng(); } if( key == 'f'){ ofToggleFullscreen(); } // if( key == '1'){ // finder.setMode( T_TM_SQDIFF ); // }else if( key == '2'){ // finder.setMode( T_TM_SQDIFF_NORMED ); // }else if( key == '3'){ // finder.setMode( T_TM_CCORR ); // }else if( key == '4'){ // finder.setMode( T_TM_CCORR_NORMED ); // }else if( key == '5'){ // finder.setMode( T_TM_CCOEFF ); // }else if( key == '6'){ // finder.setMode( T_TM_CCOEFF_NORMED ); // if( key == '1'){ loadTrack( 0 ); }else if( key == '2'){ loadTrack( 1 ); }else if( key == '3'){ loadTrack( 2 ); }else if( key == '4'){ loadTrack( 3 ); }else if( key == '5'){ loadTrack( 4 ); }else if( key == '6'){ loadTrack( 5 ); }else if( key == '7'){ loadTrack( 6 ); }else if( key == OF_KEY_RIGHT ){ tracks.gotoNextMeasure(); }else if( key == OF_KEY_LEFT ){ tracks.gotoPrevMeasure(); }else if( key == OF_KEY_DOWN ){ tracks.gotoNextPage(); }else if( key == OF_KEY_UP ){ tracks.gotoPrevPage(); } ofLog() << " KEY : " << key; }
FMOD_RESULT F_CALLBACK FMODMusic::syncPointCallback( FMOD_CHANNEL* channel, FMOD_CHANNEL_CALLBACKTYPE type, void* data1, void* data2 ) { if ( type == FMOD_CHANNEL_CALLBACKTYPE_SYNCPOINT ) { auto mp = (FMODMusic*)( &Locator::getMusic() ); if ( ++mp->mIterator == mp->mTracks.end() ) { random_shuffle( mp->mTracks.begin(), mp->mTracks.end() ); mp->mIterator = mp->mTracks.begin(); } mp->loadTrack( &( *mp->mIterator ) ); } return FMOD_OK; }
TEST_F(CueControlTest, SeekOnLoadDefault_NoCue) { m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_DEFAULT); TrackPointer pTrack = createTestTrack(); loadTrack(pTrack); EXPECT_DOUBLE_EQ(-1.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(0.0, getCurrentSample()); // Set cue and check if track is seeked to it. pTrack->setCuePoint(CuePosition(200.0, Cue::MANUAL)); ProcessBuffer(); EXPECT_DOUBLE_EQ(200.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(200.0, getCurrentSample()); }
void PlayerManager::bindToLibrary(Library* pLibrary) { QMutexLocker locker(&m_mutex); connect(pLibrary, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SLOT(slotLoadTrackToPlayer(TrackPointer, QString, bool))); connect(pLibrary, SIGNAL(loadTrack(TrackPointer)), this, SLOT(slotLoadTrackIntoNextAvailableDeck(TrackPointer))); connect(this, SIGNAL(loadLocationToPlayer(QString, QString)), pLibrary, SLOT(slotLoadLocationToPlayer(QString, QString))); m_pAnalyzerQueue = new AnalyzerQueue(pLibrary->dbConnectionPool(), m_pConfig); // Connect the player to the analyzer queue so that loaded tracks are // analysed. foreach(Deck* pDeck, m_decks) { connect(pDeck, SIGNAL(newTrackLoaded(TrackPointer)), m_pAnalyzerQueue, SLOT(slotAnalyseTrack(TrackPointer))); }
TEST_F(CueControlTest, SeekOnLoadMainCue) { m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_MAIN_CUE); TrackPointer pTrack = createTestTrack(); pTrack->setCuePoint(CuePosition(100.0, Cue::MANUAL)); loadTrack(pTrack); EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(100.0, getCurrentSample()); // Move cue and check if track is following it. pTrack->setCuePoint(CuePosition(200.0, Cue::MANUAL)); ProcessBuffer(); EXPECT_DOUBLE_EQ(200.0, m_pCuePoint->get()); EXPECT_DOUBLE_EQ(200.0, getCurrentSample()); }
void CachingReaderWorker::run() { TrackPointer pLoadTrack; ChunkReadRequest request; ReaderStatusUpdate status; while (!deref(m_stop)) { if (m_newTrack) { m_newTrackMutex.lock(); pLoadTrack = m_newTrack; m_newTrack = TrackPointer(); m_newTrackMutex.unlock(); loadTrack(pLoadTrack); } else if (m_pChunkReadRequestFIFO->read(&request, 1) == 1) { // Read the requested chunks. processChunkReadRequest(&request, &status); m_pReaderStatusFIFO->writeBlocking(&status, 1); } else { m_semaRun.acquire(); } } }