MusicPlayer::MusicPlayer(QObject *parent) : QObject(parent) { downIcon = QIcon(QLatin1String(":/files/images/arrow-270.png")); upIcon = QIcon(QLatin1String(":/files/images/arrow-090.png")); removeIcon = QIcon(QLatin1String(":/files/images/cross-circle.png")); lastRowClicked = -1; currentSource = 0; audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); audioOutput->setVolume(.5f); mediaObject = new Phonon::MediaObject(this); metaInformationResolver = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(metaStateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(sourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); Phonon::createPath(mediaObject, audioOutput); }
//![0] MainWindow::MainWindow ( QWidget * parent ) { audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); metaInformationResolver = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); //![0] //![2] connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(metaStateChanged(Phonon::State, Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(const Phonon::MediaSource &)), this, SLOT(sourceChanged(const Phonon::MediaSource &))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); //![2] //![1] Phonon::createPath(mediaObject, audioOutput); //![1] setupActions(); setupMenus(); setupUi(); timeLcd->display("00:00"); }
/* * -------------------------------------------------------------- * -------------------------------------------------------------- */ MyPlayerView::MyPlayerView() { audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)),this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)),this, SLOT(sourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); connect(mediaObject, SIGNAL(bufferStatus(int)), this, SLOT(setBufferingValue(int))); Phonon::createPath(mediaObject, audioOutput); playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); playAction->setDisabled(true); pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); pauseAction->setDisabled(true); stopAction = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this); stopAction->setDisabled(true); connect(playAction, SIGNAL(triggered()), mediaObject, SLOT(play())); connect(pauseAction, SIGNAL(triggered()), mediaObject, SLOT(pause()) ); connect(stopAction, SIGNAL(triggered()), mediaObject, SLOT(stop())); setupUi(); }
AudioPlayer::AudioPlayer(Library* library, Backend backend, bool testing, QObject* parent) : QObject(parent) , library_(library) , mainWindow_(nullptr) , replaygain_(ReplayGainMode::None) , preamp_with_rg_(10) , playbackOrder_(PlaybackOrder::Default) , lengthHack_(false) , testing_(testing) { if (backend == Backend::mpv) audioOutput_.reset(new MpvAudioOutput); else audioOutput_.reset(new PhononAudioOutput); QObject::connect(audioOutput_.get(), SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); QObject::connect(audioOutput_.get(), SIGNAL(currentSourceChanged()), this, SLOT(currentSourceChanged())); QObject::connect(audioOutput_.get(), SIGNAL(tick(qint64)), this, SLOT(slotTick(qint64))); QObject::connect(audioOutput_.get(), SIGNAL(stateChanged(AudioState)), this, SLOT(slotAudioStateChanged(AudioState))); QObject::connect(audioOutput_.get(), SIGNAL(finished()), this, SLOT(slotFinished())); QObject::connect(audioOutput_.get(), SIGNAL(durationChanged(double)), this, SLOT(durationChanged(double))); QObject::connect(audioOutput_.get(), SIGNAL(metadataChanged(QString, QString, int)), this, SLOT(metadataChanged(QString, QString, int))); // Not using Phono totalTimeChanged() signal because it returns 0 when used with enqueue() // TODO: report bug to phonon // QObject::connect(audioOutput_, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); readSettings(); instance = this; }
void MediaView::setMediaObject(Phonon::MediaObject *mediaObject) { this->mediaObject = mediaObject; Phonon::createPath(mediaObject, videoWidget); connect(mediaObject, SIGNAL(finished()), SLOT(playbackFinished())); connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(stateChanged(Phonon::State, Phonon::State))); connect(mediaObject, SIGNAL(aboutToFinish()), SLOT(aboutToFinish())); }
void Widget::CreateMusicPlayer() { MainLayout = new QGridLayout; //创建播放音乐器 mediaObject = new Phonon::MediaObject(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(mediaObject, audioOutput); //创建控制播放进度的滑块 seekSlider = new Phonon::SeekSlider(mediaObject, this); //音量控制部件 volumeSlider = new Phonon::VolumeSlider(audioOutput, this); volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); //单击获取选中的歌曲行号 connect(PlayList,SIGNAL(cellClicked(int,int)),this,SLOT(ChangRow(int))); //若双击了播放列表里的歌曲就播放该歌曲 connect(PlayList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(tableClicked(int))); //创建用来解析媒体的信息的元信息解析器 metaInformationResolver = new Phonon::MediaObject(this); //需要与AudioOutput;连接后才能使用metaInformationResolver Phonon::AudioOutput *metaInformationAudioPutput = new Phonon::AudioOutput(Phonon::MusicCategory,this); Phonon::createPath(metaInformationResolver,metaInformationAudioPutput); //歌曲改变后把状态传给metaStateChanged函数 connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(metaStateChanged(Phonon::State))); //歌曲播放源发生改变时传给SourceChanged函数 connect(mediaObject,SIGNAL(currentSourceChanged(Phonon::MediaSource)),this, SLOT(SourceChanged(Phonon::MediaSource))); //当歌曲播放完后传给aboutTofinish函数播放下一首歌 connect(mediaObject,SIGNAL(aboutToFinish()),this,SLOT(aboutToFinish())); //获取下一首歌曲的名字 connect(mediaObject,SIGNAL(tick(qint64)),this,SLOT(GetNextMusicName())); //关联媒体对象的tick()信号来更新播放时间的显示 mediaObject->setTickInterval(1000);//设置信号发射时间间隔 //媒体对象mediaObject后在指定的时间间隔发射tick信号,信号的值是音乐当时播放的时间 connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(updateTime(qint64))); //获取歌曲播放的状态用来改变歌曲名字 connect(mediaObject,SIGNAL(stateChanged(Phonon::State,Phonon::State)), this,SLOT(GetMusicName(Phonon::State))); //控制界面布局 MainLayout->addWidget(TitleLabel,0,0); MainLayout->addWidget(seekSlider,1,0,1,2); MainLayout->addLayout(LabelLayout,2,0,1,2); MainLayout->addLayout(ButtonLayout,3,0); MainLayout->addWidget(volumeSlider,3,1); MainLayout->setSizeConstraint(QLayout::SetFixedSize);//用户无法改变窗口的大小,保持窗口相对固定 //总体布局 Layout = new QVBoxLayout(this); Layout->addLayout(MainLayout); Layout->addWidget(PlayList); }
TrackListDBusHandler::TrackListDBusHandler(QObject *parent, Phonon::MediaObject *media) : QObject(parent), m_currentTrack(0), m_random(false), m_loop(false) { m_media = media; setObjectName("TrackListDBusHandler"); new TrackListAdaptor( this ); QDBusConnection::sessionBus().registerObject("/TrackList", this); connect (m_media, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); }
disqteca::disqteca(QWidget *parent) : QMainWindow(parent), ui(new Ui::disqteca) { audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory, this); videoWidget = new Phonon::VideoWidget(); videoWidget->setGeometry(0, 0, 1920, 1080); videoWidget->setMinimumWidth(320); videoWidget->setMinimumHeight(240); mediaObject = new Phonon::MediaObject(this); metaInformationResolver = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(metaStateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(sourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); // Nunca referenciar nenhum objeto da UI antes dessa linha ui->setupUi(this); // Liga objetos de busca, volume e os widgets de áudio e video ui->seekSlider->setMediaObject(mediaObject); ui->volumeSlider->setAudioOutput(audioOutput); Phonon::createPath(mediaObject, audioOutput); Phonon::createPath(mediaObject, videoWidget); DivisorVideoMixteca = new QSplitter; DivisorVideoMixteca->addWidget(videoWidget); DivisorVideoMixteca->addWidget(ui->Mixteca); QVBoxLayout *DivisorCentral = new QVBoxLayout; DivisorCentral->addWidget(DivisorVideoMixteca); DivisorCentral->addWidget(ui->controlesWidget); QWidget *Central = new QWidget; Central->setLayout(DivisorCentral); setCentralWidget(Central); QStringList Cabecalhos; Cabecalhos << tr("Titulo") << tr("Artista") << tr("Disco") << tr("Ano"); ui->Mixteca->setHorizontalHeaderLabels(Cabecalhos); ui->sairAction->setShortcuts(QKeySequence::Quit); }
void SourceObject::HandleAboutToFinish () { qDebug () << Q_FUNC_INFO; auto timeoutIndicator = std::make_shared<std::atomic_bool> (false); NextSrcMutex_.lock (); if (NextSource_.IsEmpty ()) { emit aboutToFinish (timeoutIndicator); NextSrcWC_.wait (&NextSrcMutex_, 500); } qDebug () << "wait finished; next source:" << NextSource_.ToUrl () << "; current source:" << CurrentSource_.ToUrl (); std::shared_ptr<void> mutexGuard (nullptr, [this] (void*) { NextSrcMutex_.unlock (); }); if (NextSource_.IsEmpty ()) { *timeoutIndicator = true; qDebug () << Q_FUNC_INFO << "no next source set, will stop playing"; return; } SetCurrentSource (NextSource_); }
int MusicPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateTime((*reinterpret_cast< qint64(*)>(_a[1]))); break; case 1: playOrpause(); break; case 2: openFile(); break; case 3: setMod(); break; case 4: previousSong(); break; case 5: nextSong(); break; case 6: whatiLike(); break; case 7: showLrc(); break; case 8: setPlayer(); break; case 9: showPlayList(); break; case 10: metaStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 11: tableWidgetClicked((*reinterpret_cast< int(*)>(_a[1]))); break; case 12: aboutToFinish(); break; case 13: clearSources(); break; case 14: saveAndQuit(); break; case 15: trayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break; default: ; } _id -= 16; } return _id; }
int Playengine::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: volume((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: statusChanged((*reinterpret_cast< Playengine::STATUS(*)>(_a[1]))); break; case 2: buffering((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: tick((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 4: togglePause(); break; case 5: play((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 6: stop(); break; case 7: setVolume((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: stateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 9: tickslot((*reinterpret_cast< qint64(*)>(_a[1]))); break; case 10: sourceChanged((*reinterpret_cast< const Phonon::MediaSource(*)>(_a[1]))); break; case 11: metaStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 12: aboutToFinish(); break; case 13: bufferPercent((*reinterpret_cast< int(*)>(_a[1]))); break; case 14: volumeChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; default: ; } _id -= 15; } return _id; }
void ThreadedAssignment::setFinished(bool isFinished) { if (_isFinished != isFinished) { _isFinished = isFinished; if (_isFinished) { qDebug() << "ThreadedAssignment::setFinished(true) called - finishing up."; auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver(); // we should de-register immediately for any of our packets packetReceiver.unregisterListener(this); // we should also tell the packet receiver to drop packets while we're cleaning up packetReceiver.setShouldDropPackets(true); if (_domainServerTimer) { _domainServerTimer->stop(); } if (_statsTimer) { _statsTimer->stop(); } // call our virtual aboutToFinish method - this gives the ThreadedAssignment subclass a chance to cleanup aboutToFinish(); emit finished(); } } }
int _movie::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { typedef Phonon::VideoWidget QMocSuperClass; _id = QMocSuperClass::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: stateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 1: aboutToFinish(); break; case 2: finished(); break; case 3: SoundOnEvent(); break; case 4: EVENT_OnEvent(); break; case 5: EVENT_OnTick((*reinterpret_cast< t_long(*)>(_a[1]))); break; case 6: EVENT_OnStateChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 7: EVENT_OnAboutToFinish(); break; case 8: EVENT_OnFinished(); break; case 9: EVENT_OnMutedChanged((*reinterpret_cast< t_boolean(*)>(_a[1]))); break; case 10: EVENT_OnVolumeChanged((*reinterpret_cast< t_integer(*)>(_a[1]))); break; case 11: EVENT_OnPlayingTitleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 12: EVENT_OnBufferStatus((*reinterpret_cast< t_integer(*)>(_a[1]))); break; case 13: EVENT_OnTotalTimeChanged((*reinterpret_cast< t_long(*)>(_a[1]))); break; case 14: frameChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 15: cursoranimation_frameChanged((*reinterpret_cast< int(*)>(_a[1]))); break; } _id -= 16; } return _id; }
MadaoWindow::MadaoWindow() { audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); musicGetter = new Phonon::MediaObject(this); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(autoNext())); connect(musicGetter, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(metaStateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(sourceChanged(Phonon::MediaSource))); Phonon::createPath(mediaObject, audioOutput); setAllActions(); setGui(); resize(720,480); setMinimumSize(720,480); playing = false; set = false; currentSong = 0; songsNumber = 0; addToTable = 0; lastRow = 0; QIcon icon("Data/taizo_hasegawa_2564.jpg"); setWindowIcon(icon); }
Backend::Backend(QObject *parent): QObject(parent), noise(new Phonon::MediaObject(this)), audio_output(new Phonon::AudioOutput(Phonon::MusicCategory, this)), alarm_playing(false), is_vibrating(false), volume(1.0) { QSettings settings; max_volume = 0.01 * settings.value("max_volume", MAX_VOLUME).toInt(); //setting is in percent use_vibration = settings.value("use_vibration", USE_VIBRATION).toBool(); QString sound_filename = settings.value("sound_filename", SOUND_FILE).toString(); connect(noise, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(handleAudioStateChange(Phonon::State))); connect(noise, SIGNAL(aboutToFinish()), this, SLOT(repeatSound())); Phonon::createPath(noise, audio_output); noise->setCurrentSource(Phonon::MediaSource(sound_filename)); QTimer *hangcheck_timer = new QTimer(this); hangcheck_timer->setInterval(500); connect(hangcheck_timer, SIGNAL(timeout()), this, SLOT(checkForHang())); hangcheck_timer->start(); }
FooPhononAudioEngine::FooPhononAudioEngine (QObject* parent) : FooAudioEnginePlugin(parent) { qDebug() << "FooPhononAudioEngine"; audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); metaInformation = new Phonon::MediaObject(this); Phonon::createPath(mediaObject, audioOutput); // this is needed - default = 0 => no ticks mediaObject->setTickInterval(10); connect(mediaObject, SIGNAL(tick(qint64)), this, SIGNAL(progress(qint64))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SIGNAL(aboutToFinish())); }
void AudioPlayer::enqueueTracks(PModel model, QModelIndexList tracks) { bool queue_was_empty = queue_.isEmpty(); queue_.pushTracks(model, tracks); if (queue_was_empty) aboutToFinish(); }
void ThreadedAssignment::setFinished(bool isFinished) { _isFinished = isFinished; if (_isFinished) { aboutToFinish(); NodeList* nodeList = NodeList::getInstance(); // if we have a datagram processing thread, quit it and wait on it to make sure that // the node socket is back on the same thread as the NodeList if (_datagramProcessingThread) { // tell the datagram processing thread to quit and wait until it is done, then return the node socket to the NodeList _datagramProcessingThread->quit(); _datagramProcessingThread->wait(); // set node socket parent back to NodeList nodeList->getNodeSocket().setParent(nodeList); } // move the NodeList back to the QCoreApplication instance's thread nodeList->moveToThread(QCoreApplication::instance()->thread()); emit finished(); } }
MusicPlayer::MusicPlayer(QWidget *parent) : QWidget(parent), m_ui(new Ui::MusicPlayer), m_query(new QSqlQuery) { m_ui->setupUi(this); mediaObject = new Phonon::MediaObject(this); audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(mediaObject, audioOutput); mediaObject->setTickInterval(1000); connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(enqueueNextSource())); dlgAddMusic = new AddMusic ( this ); connect ( dlgAddMusic, SIGNAL(selected_artistid(quint64)), this, SLOT(playlist_add_artistid(quint64))); connect ( dlgAddMusic, SIGNAL(selected_albumid(quint64)), this, SLOT(playlist_add_albumid(quint64))); connect ( dlgAddMusic, SIGNAL(selected_songid(quint64)), this, SLOT(playlist_add_songid(quint64))); connect ( dlgAddMusic, SIGNAL(selected_file(QString)), this, SLOT(playlist_add_file(QString))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), cur_scene(main) { ui->setupUi(this); ui->verticalLayout->setAlignment(Qt::AlignCenter); setStyleSheet(QString("QPushButton { font-family: 'Avenir Next'; font-size: 40px; font-weight: bold; }")); timer = new QTimer(this); sound_menu = new Phonon::MediaObject(this); createPath(sound_menu, new Phonon::AudioOutput(Phonon::MusicCategory, this)); sound_menu->setCurrentSource(Phonon::MediaSource(":/sound/menu.mp3")); QObject::connect(sound_menu, SIGNAL(aboutToFinish()), SLOT(menu_sound_finished())); sound_menu->setTransitionTime(-270); sound_menu->play(); musiclist = new QListWidget(this); musiclist->show(); musiclist->setVisible(false); musiclist->setStyleSheet(QString("font-family: 'Avenir Next'; font-size: 40px; font-weight: bold;")); ui->scoreLabel->setVisible(false); ui->nameEdit->setVisible(false); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); scene=new QGraphicsScene(this); med=new Phonon::MediaObject(this); med->setCurrentSource(Phonon::MediaSource(":/audio/Track1.mp3")); aout=new Phonon::AudioOutput(Phonon::MusicCategory,this); ui->graphicsView->setScene(scene); ui->graphicsView->setRenderHint(QPainter::Antialiasing); scene->setSceneRect(-100,-100,400,400); QPen mypen=QPen(Qt::black); QLineF TopLine(scene->sceneRect().topLeft(),scene->sceneRect().topRight()); QLineF LeftLine(scene->sceneRect().topLeft(),scene->sceneRect().bottomLeft()); QLineF RightLine(scene->sceneRect().topRight(),scene->sceneRect().bottomRight()); QLineF BottomLine(scene->sceneRect().bottomLeft(),scene->sceneRect().bottomRight()); scene->addLine(TopLine,mypen); scene->addLine(LeftLine,mypen); scene->addLine(RightLine,mypen); scene->addLine(BottomLine,mypen); Phonon::createPath(med,aout); int itemcount=20; for(int i=0;i<itemcount;i++) { Box *b=new Box(); scene->addItem(b);; } timer=new QTimer(this); connect(timer,SIGNAL(timeout()),scene,SLOT(advance())); connect(med,SIGNAL(aboutToFinish()),this,SLOT(loop())); med->play(); }
void ThreadedAssignment::setFinished(bool isFinished) { if (_isFinished != isFinished) { _isFinished = isFinished; if (_isFinished) { qCDebug(networking) << "ThreadedAssignment::setFinished(true) called - finishing up."; auto nodeList = DependencyManager::get<NodeList>(); auto& packetReceiver = nodeList->getPacketReceiver(); // we should de-register immediately for any of our packets packetReceiver.unregisterListener(this); // we should also tell the packet receiver to drop packets while we're cleaning up packetReceiver.setShouldDropPackets(true); // send a disconnect packet to the domain nodeList->getDomainHandler().disconnect(); // stop our owned timers _domainServerTimer.stop(); _statsTimer.stop(); // call our virtual aboutToFinish method - this gives the ThreadedAssignment subclass a chance to cleanup aboutToFinish(); emit finished(); } } }
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags), d(new MainWindowPrivate) { d->selector = new QDocumentSelector(this); d->selector->setFilter(QContentFilter(QContent::Document) & (QContentFilter::mimeType("video/*") | QContentFilter::mimeType("audio/*"))); connect(d->selector, SIGNAL(documentSelected(QContent)), SLOT(documentSelected(QContent))); setCentralWidget(d->selector); d->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); d->videoWidget = new Phonon::VideoWidget(this); d->mediaObject = new Phonon::MediaObject(this); // metaInformationResolver = new Phonon::MediaObject(this); d->mediaObject->setTickInterval(1000); // MediaObject connect(d->mediaObject, SIGNAL(currentSourceChanged(const Phonon::MediaSource &)), SLOT(currentSourceChanged(const Phonon::MediaSource &))); connect(d->mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(stateChanged(Phonon::State, Phonon::State))); connect(d->mediaObject, SIGNAL(tick(qint64)), SLOT(tick(qint64))); /* connect(d->mediaObject, SIGNAL(metaDataChanged(QMultiMap<QString,QString>)), SLOT(metaDataChanged(QMultiMap<QString,QString>))); */ connect(d->mediaObject, SIGNAL(seekableChanged(bool)), SLOT(seekableChanged(bool))); connect(d->mediaObject, SIGNAL(hasVideoChanged(bool)), SLOT(hasVideoChanged(bool))); connect(d->mediaObject, SIGNAL(finished()), SLOT(finished())); connect(d->mediaObject, SIGNAL(prefinishMarkReached(qint32)), SLOT(prefinishMarkReached(qint32))); connect(d->mediaObject, SIGNAL(aboutToFinish()), SLOT(aboutToFinish())); connect(d->mediaObject, SIGNAL(totalTimeChanged(qint64)), SLOT(totalTimeChanged(qint64))); connect(d->mediaObject, SIGNAL(bufferStatus(int)), SLOT(bufferStatus(int))); // Meta info /* connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State,Phonon::State)), SLOT(metaStateChanged(Phonon::State, Phonon::State))); */ Phonon::createPath(d->mediaObject, d->audioOutput); Phonon::createPath(d->mediaObject, d->videoWidget); }
PhononEngine::PhononEngine(QObject * parent) : AbstractAudioPlugin(parent) { d = new PhononEnginePrivate; d->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); d->mediaObject = new Phonon::MediaObject(this); d->metaInformation = new Phonon::MediaObject(this); Phonon::createPath(d->mediaObject, d->audioOutput); d->mediaObject->setTickInterval(DEFAUL_INTERVAL); connect(d->mediaObject, SIGNAL (tick(qint64)), this, SIGNAL (progress(qint64))); connect(d->mediaObject, SIGNAL(aboutToFinish()), this, SIGNAL(aboutToFinish())); }
void ThreadedAssignment::setFinished(bool isFinished) { _isFinished = isFinished; if (_isFinished) { aboutToFinish(); emit finished(); } }
PhononEngine::PhononEngine(QObject * parent) : FooAudioEngine(parent) { d = new PhononEnginePrivate; d->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); d->mediaObject = new Phonon::MediaObject(this); d->metaInformation = new Phonon::MediaObject(this); Phonon::createPath(d->mediaObject, d->audioOutput); d->mediaObject->setTickInterval(DEFAUL_INTERVAL); connect(d->mediaObject, SIGNAL(tick(qint64)), this, SIGNAL (progress(qint64))); connect(d->mediaObject, SIGNAL(aboutToFinish()), this, SIGNAL(aboutToFinish())); connect(d->mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SIGNAL(changeTotalTime(qint64))); connect(d->metaInformation, SIGNAL(metaDataChanged()), this, SLOT(newMetaData())); connect(d->audioOutput, SIGNAL(mutedChanged(bool)), this, SIGNAL(muteChanged(bool))); connect(this, SIGNAL(seek(qint64)), d->mediaObject, SLOT(seek(qint64))); }
SpectRadio::SpectRadio() { audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(sourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); Phonon::createPath(mediaObject, audioOutput); playlistCurrentRow = -1; setupActions(); setupUi(); timeLcd->display("00:00"); setAcceptDrops(true); }
void AudioPlayer::clearQueue() { // bool peeked = queue.peeked(); queue_.clear(); // We can't buffer next song 'cause gstreamer is bugged // if (peeked) { // // buffer next song // playingModel_->enqueueNextTrack(); // } aboutToFinish(); }
void ThreadedAssignment::setFinished(bool isFinished) { _isFinished = isFinished; if (_isFinished) { aboutToFinish(); emit finished(); // move the NodeList back to the QCoreApplication instance's thread NodeList::getInstance()->moveToThread(QCoreApplication::instance()->thread()); } }
void EngineController::initializePhonon() { DEBUG_BLOCK delete m_media; delete m_audio; delete m_preamp; PERF_LOG( "EngineController: loading phonon objects" ) m_media = new Phonon::MediaObject( this ); m_audio = new Phonon::AudioOutput( Phonon::MusicCategory, this ); m_path = Phonon::createPath( m_media, m_audio ); // HACK we turn off replaygain manually on OSX, until the phonon coreaudio backend is fixed. // as the default is specified in the .cfg file, we can't just tell it to be a different default on OSX #ifdef Q_WS_MAC AmarokConfig::setReplayGainMode( AmarokConfig::EnumReplayGainMode::Off ); #endif // only create pre-amp if we have replaygain on, preamp can cause phonon issues if( AmarokConfig::replayGainMode() != AmarokConfig::EnumReplayGainMode::Off ) { m_preamp = new Phonon::VolumeFaderEffect( this ); m_path.insertEffect( m_preamp ); } m_media->setTickInterval( 100 ); debug() << "Tick Interval (actual): " << m_media->tickInterval(); PERF_LOG( "EngineController: loaded phonon objects" ) // Get the next track when there is 2 seconds left on the current one. m_media->setPrefinishMark( 2000 ); connect( m_media, SIGNAL( finished() ), SLOT( slotQueueEnded() ) ); connect( m_media, SIGNAL( aboutToFinish()), SLOT( slotAboutToFinish() ) ); connect( m_media, SIGNAL( metaDataChanged() ), SLOT( slotMetaDataChanged() ) ); connect( m_media, SIGNAL( stateChanged( Phonon::State, Phonon::State ) ), SLOT( slotStateChanged( Phonon::State, Phonon::State ) ) ); connect( m_media, SIGNAL( tick( qint64 ) ), SLOT( slotTick( qint64 ) ) ); connect( m_media, SIGNAL( totalTimeChanged( qint64 ) ), SLOT( slotTrackLengthChanged( qint64 ) ) ); connect( m_media, SIGNAL( currentSourceChanged( const Phonon::MediaSource & ) ), SLOT( slotNewTrackPlaying( const Phonon::MediaSource & ) ) ); //TODO: The xine engine does not support crossfading. Cannot get the gstreamer engine to work, will test this once I do. #if 0 if( AmarokConfig::trackDelayLength() > -1 ) m_media->setTransitionTime( AmarokConfig::trackDelayLength() ); // Also Handles gapless. else if( AmarokConfig::crossfadeLength() > 0 ) // TODO: Handle the possible options on when to crossfade.. the values are not documented anywhere however m_media->setTransitionTime( -AmarokConfig::crossfadeLength() ); #endif }