HAlbumContext::HAlbumContext(HAlbum& rep, QWidget *parent) : QWidget(parent), s_rep(rep), s_albumLoadCount(0), s_trackLoadCount(0), s_tagLoadCount(0), s_artistLoadCount(0), s_shoutLoadCount(0), s_cachedPlayCount(-1),s_cachedListenerCount(-1),s_cachedUserPlayCount(-1), s_shoutsToLoad(5), s_pw(0), s_ge(0), ui(new Ui::HAlbumContext) { s_showTime=QTime::currentTime(); ui->setupUi(this); ui->label_album->setText(s_rep.getAlbumName()); s_priority[0].push_back(s_rep.sendSummary(this,"setSummary")); s_priority[0].push_back(s_rep.sendPlayCount(this,"setPlayCount")); s_priority[0].push_back(s_rep.sendListenerCount(this,"setListenerCount")); s_priority[0].push_back(s_rep.sendUserPlayCount(this,"setUserPlayCount")); connect(ui->label_moreDescription,SIGNAL(linkActivated(QString)),this,SLOT(showMoreBio())); ui->widget_artist->setLayout(new QVBoxLayout); ui->widget_tags->setLayout(new QVBoxLayout); ui->widget_tracks->setLayout(new QVBoxLayout); ui->widget_comments->setLayout(new QVBoxLayout); ui->widget_comments->layout()->setSpacing(0); connect(ui->label_moreTracks,SIGNAL(linkActivated(QString)),this,SLOT(loadTracks())); connect(ui->label_moreTags,SIGNAL(linkActivated(QString)),this,SLOT(loadTags())); // connect(ui->label_moreArtists,SIGNAL(linkActivated(QString)),this,SLOT(loadSimilar())); connect(ui->label_moreShoutbox,SIGNAL(linkActivated(QString)),this,SLOT(loadShouts())); connect(ui->textEdit_shout,SIGNAL(textChanged()),this,SLOT(evalShout())); connect(ui->pushButton_post,SIGNAL(clicked()),this,SLOT(sendShout())); ui->label_albumPic->adjustSize(); ui->frame_art->adjustSize(); ui->frame_header->adjustSize(); connect(ui->button_play,SIGNAL(clicked()),this,SLOT(play())); s_albumLoadCount=0; s_trackLoadCount=0; s_tagLoadCount=0; loadArtist(); loadTracks(); loadTags(); readjustPriorities(); }
int main(int argc, char** argv) { init(argc, argv); std::string index_tracks_file = argv[1]; std::string features_format = argv[2]; std::string views_file = argv[3]; // TODO: Use number of frames instead of reading until failure. //int num_frames = boost::lexical_cast<int>(argv[4]); std::string feature_tracks_file = argv[5]; // Load names of views. std::vector<std::string> views; bool ok = readLines(views_file, views); MultiviewTrackList<IndexSet> index_multitracks; if (FLAGS_input_multitracks) { // Load multi-tracks from file. DefaultReader<int> index_reader; VectorReader<int> reader(index_reader); ok = loadMultiviewTrackList(index_tracks_file, index_multitracks, reader); CHECK(ok) << "Could not load multi-tracks"; } else { // Load tracks from file. MultiviewTrackList<int> tracks; DefaultReader<int> reader; ok = loadMultiviewTrackList(index_tracks_file, tracks, reader); CHECK(ok) << "Could not load tracks"; // Convert to multitracks. tracksToMultitracks(tracks, index_multitracks); } MultiviewTrackList<FeatureSet> multitracks; // Convert to multitracks of features for reconstructing/visualizing. if (FLAGS_input_keypoints) { ok = loadKeypoints(index_multitracks, features_format, views, multitracks); CHECK(ok) << "Could not load keypoints"; } else { ok = loadTracks(index_multitracks, features_format, views, multitracks); CHECK(ok) << "Could not load feature tracks"; } if (!FLAGS_input_multitracks && FLAGS_input_keypoints) { // If we input valid tracks and used keypoints not tracks, // then we can write out valid tracks. MultiviewTrackList<SiftPosition> tracks; multitracksToTracks(multitracks, tracks); SiftPositionWriter writer; saveMultiviewTrackList(feature_tracks_file, tracks, writer); } else { // Save multitracks. SiftPositionWriter feature_writer; VectorWriter<SiftPosition> writer(feature_writer); saveMultiviewTrackList(feature_tracks_file, multitracks, writer); } return 0; }
void ViProjectLoader::loadProjects(QList<ViProject*> projects) { ViProject *project; for(int i = 0; i < projects.size(); ++i) { ++mProjectCount; project = projects[i]; QObject::connect(project, SIGNAL(loaded()), this, SLOT(loadTracks()), Qt::UniqueConnection); if(!project->load()) { --mProjectCount; LOG("The project (" + projects[i]->filePath() + ") could not be loaded."); } } ViLoadingWidget::stop(); QString message = "The project"; if(mProjectMode == ViProjectLoader::MultipleProjects) { message += "s were"; } else { message += " was"; } LOG(message + " loaded."); if(projects.size() > 0) { emit projectChanged(); } }
/* Loads an existing project */ void ProjectManager::loadExistingProject() { //Let the user choose a .mor file then begin processing if (_loadChooser.browseForFileToOpen()) { //Update the project File _projectFile = _loadChooser.getResult(); //Parse the project file into projectElements projectElements = XmlDocument::parse(_projectFile); loadTracks(); } }
void SqlPlaylist::removeTrack( int position ) { if( !m_tracksLoaded ) loadTracks(); if( position < 0 || position >= m_tracks.size() ) return; Meta::TrackPtr track = m_tracks.takeAt( position ); unsubscribeFrom( track ); saveToDb( true ); notifyObserversTrackRemoved( position ); }
void SqlPlaylist::addTrack( Meta::TrackPtr track, int position ) { if( !m_tracksLoaded ) loadTracks(); if( position < 0 ) position = m_tracks.count(); else position = qMin( position, m_tracks.count() ); subscribeTo( track ); //keep track of metadata changes. m_tracks.insert( position, track ); saveToDb( true ); notifyObserversTrackAdded( track, position ); }
//pass in default options for music and sfx from options screen, and any mute option from //command line, which overrides music and sfx options. void Audio::setup(bool bSfx, bool bMusic, const std::string &baseTrackDir, bool bMute) { if (_init) return; //open audio with chunksize of 128 for gp2x, as smaller this is, //the more often the sound hooks will be called, reducing lag //e.g Mix_OpenAudio(22050, AUDIO_S16, 2, 2048) if (Mix_OpenAudio(SOUND_FREQUENCY, SOUND_FORMAT, SOUND_CHANELS, SOUND_CHUNK) == -1) { //setLastError("Warning: Couldn't set audio\nReason: %s\n"); return; //not set _init } _opt._bMusic = bMusic && !bMute; //music on or off _opt._bSfx = bSfx && !bMute; //sfx on or off _volTest = Mix_LoadWAV(std::string(RES_SOUNDS + "ping.wav").c_str()); //also used in game setVolume((MIX_MAX_VOLUME / 2), false); //no test sound musicMute(!bMusic); sfxMute(!bSfx); //#ifdef _USE_MIKMOD // if (_gd->_options._bMusic) // { // MikMod_RegisterAllDrivers(); // MikMod_RegisterAllLoaders(); // md_mode |= DMODE_SOFT_MUSIC; // if(MikMod_Init("")) // { // //setLastError("Warning: Couldn't init MikMod audio\nReason: %s\n"); // return; //failed // } // std::cout << "Using MikMod audio directly" << std::endl; // modStart(); //#endif //_USE_MIKMOD setBaseTrackDir(baseTrackDir); if (bMusic) loadTracks(_baseTrackDir); std::cout << "Standard audio initialised" << std::endl; _init = true; }
void SqlPlaylist::metadataChanged( Meta::TrackPtr track ) { //TODO: do we really need to observe track changes? Metadata will be properly saved //on exit and proxy tracks are loaded with uidUrl. So at worse the save metadata in //playlist_tracks will be outdated until real track is loaded. if( !m_tracksLoaded ) loadTracks(); //When AFT detects a moved file it will update the track and make it signal it's observers. if( !m_tracks.contains( track ) ) { error() << "Got a metadataChanged for a track that is not in the playlist."; return; } //force update of tracks in database saveToDb(); }
void Game::init() { m_audioThread.start(); m_audioWorker->moveToThread(&m_audioThread); QMetaObject::invokeMethod(m_audioWorker, "init"); QMetaObject::invokeMethod(m_audioWorker, "loadSounds"); m_assetManager->load(); if (loadTracks()) { initScene(); } else { throw std::runtime_error("Couldn't load tracks."); } start(); }
void ViProjectLoader::loadTracks() { ViProject *project = (ViProject*) sender(); QObject::disconnect(project, SIGNAL(loaded()), this, SLOT(loadTracks())); mProjects.enqueue(project); mUi->tracksComboBox->clear(); ViAudioObjectQueue objects = project->objects(); ViAudio::Type resources; for(int i = 0; i < objects.size(); ++i) { resources = objects[i]->availableResources(); if(resources != ViAudio::Undefined) { mObjects.enqueue(objects[i]); if(mProjectMode == ViProjectLoader::SingleTrack) { mUi->tracksComboBox->addItem(objects[i]->fileName(true, true)); } } else { LOG("Track (side " + QString::number(objects[i]->sideNumber()) + ", track " + QString::number(objects[i]->trackNumber()) + ") does not have any data and will be removed from the list."); } } if(mProjectMode == ViProjectLoader::SingleTrack && !mObjects.isEmpty()) { mUi->tracksLabel->show(); mUi->tracksComboBox->show(); } --mProjectCount; if(mProjectCount == 0) { emit finished(); } if(mProjectMode != ViProjectLoader::SingleTrack) emit changed(); }
void SqlPlaylist::triggerTrackLoad() { if( !m_tracksLoaded ) loadTracks(); }
void SourceInfoWidget::onCollectionChanged() { loadTracks(); loadRecentAdditions(); }