当前位置: 首页>>代码示例>>C++>>正文


C++ MediaObject::stop方法代码示例

本文整理汇总了C++中phonon::MediaObject::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject::stop方法的具体用法?C++ MediaObject::stop怎么用?C++ MediaObject::stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phonon::MediaObject的用法示例。


在下文中一共展示了MediaObject::stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: togglePlayPause

void UBGraphicsAudioItemDelegate::togglePlayPause()
{
    if ( mDelegated && mDelegated->mediaObject() )
    {
        Phonon::MediaObject* media = mDelegated->mediaObject();

        if ( media->state() == Phonon::StoppedState ) {
            media->play();
        } else if ( media->state() == Phonon::PlayingState ) {
            if ( media->remainingTime() <= 0 ) {
                media->stop();
                media->play();
            } else {
                media->pause();
                if ( mDelegated->scene() )
                    mDelegated->scene()->setModified ( true );
            }
        } else if ( media->state() == Phonon::PausedState ) {
            if ( media->remainingTime() <= 0 ) {
                media->stop();
            }
            media->play();
        } else  if ( media->state() == Phonon::LoadingState ) {
            mDelegated->mediaObject()->setCurrentSource(mDelegated->mediaFileUrl());
            media->play();
        } else if (media->state() == Phonon::ErrorState){
            qDebug() << "Error appeared." << media->errorString();
        }
    }
}
开发者ID:Vetal3000,项目名称:Sankore-3.1,代码行数:30,代码来源:UBGraphicsAudioItemDelegate.cpp

示例2: stop

 void VideoWidget::stop()
 {
     Phonon::MediaObject* mo = player->media0bject();
     if (mo->state() == Phonon::PausedState)
     {
         mo->seek(0);
         mo->stop();
     }
     else
     {
         mo->stop();
     }
 }
开发者ID:biwin,项目名称:ktorrent,代码行数:13,代码来源:videowidget.cpp

示例3: reset

void AudioOutputPrivate::reset()
{
    if ( m_output ) {
        m_output->stop();
        m_output->setCurrentSource( Phonon::MediaSource() );
        m_output->clearQueue();
    }

    m_voiceNavigation.reset();
}
开发者ID:calincru,项目名称:marble,代码行数:10,代码来源:AudioOutput.cpp

示例4: togglePlayPause

void UBGraphicsVideoItemDelegate::togglePlayPause()
{
    if (delegated() && delegated()->mediaObject())
    {
        Phonon::MediaObject* media = delegated()->mediaObject();

        if (media->state() == Phonon::StoppedState)
        {
            media->play();
        }
        else if (media->state() == Phonon::PlayingState)
        {
            if (media->remainingTime() <= 0)
            {
                media->stop();
                media->play();
            }
            else
            {
                media->pause();
                if(delegated()->scene())
                        delegated()->scene()->setModified(true);
            }
        }
        else if (media->state() == Phonon::PausedState)
        {
            if (media->remainingTime() <= 0)
            {
                media->stop();
            }

            media->play();
        }
		else  if ( media->state() == Phonon::LoadingState ){
            delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
            media->play();
        }
        else{
          qDebug() << "Media state "<< media->state() << " not supported";
        }
    }
}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:42,代码来源:UBGraphicsVideoItemDelegate.cpp

示例5: playSound

/*#
void LayerSound::playSound(int frame) {
	for(int i=0; i < sound.size(); i++) {
		if (frame == framesPosition.at(i)) {
			if (sound.at(i) != NULL && visible) sound[i]->play();
		}
	}
}
#*/
void LayerSound::playSound(int frame,int fps)
{
    //QSettings settings("Pencil","Pencil");
    //int fps = settings.value("fps").toInt();

    for (int i = 0; i < sound.size(); ++i)
    {
        Phonon::MediaObject* media = sound.at(i);
        if (media != NULL && visible)
        {
            int position = framesPosition.at(i);
            if (frame < position)
            {
                media->stop();
            }
            else
            {
                Phonon::AudioOutput* audioOutput = NULL;
                if (outputDevices.size() <= i)
                {
                    audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
                    outputDevices.push_back(audioOutput);
                }
                else
                {
                    audioOutput = outputDevices.at(i);
                }

                int offsetInMs = floor((frame - position) * float(1000) / fps);
                if (media->state() == Phonon::PlayingState)
                {
                    if (fabs((float)media->currentTime() - offsetInMs) > 500.0f)
                        media->seek(offsetInMs);
                }
                else
                {
                    if (frame > position)
                    {
                        media->pause();
                        media->seek(offsetInMs);
                    }
                    if (offsetInMs < soundSize[i])
                    {
                        Phonon::createPath(media, outputDevices.at(i));
                        media->play();
                    }
                }
            }
        }
    }
}
开发者ID:shoshon,项目名称:pencil,代码行数:60,代码来源:layersound.cpp

示例6: loadSoundAtFrame

void LayerSound::loadSoundAtFrame(QString filePathString, int frameNumber)
{
//	if (getIndexAtFrame(frameNumber) == -1) addImageAtFrame(frameNumber);
    int index = getIndexAtFrame(frameNumber);
    if (index == -1)
        addImageAtFrame(frameNumber);
    index = getIndexAtFrame(frameNumber);

    QFileInfo fi(filePathString);
    if (fi.exists())
    {
//		sound[index] = new QSound(filePathString, NULL);
        Phonon::MediaObject* media = new Phonon::MediaObject();
        connect(media, SIGNAL(totalTimeChanged(qint64)), this, SLOT(addTimelineKey(qint64)));
        media->setCurrentSource(filePathString);
        // quick and dirty trick to calculate soundSize
        // totalTime() return a value only after a call to media.play()
        //  ( and when signal totaltimechanged is emitted totalTime() returns the correct value )
        Phonon::AudioOutput* audioOutput;
        audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
        Phonon::createPath(media, audioOutput);
        media->play();
        media->stop();
        soundSize[index] = media->totalTime(); // totalTime() returns 0 now
        sound[index] = media;
        soundFilepath[index] = filePathString;
        framesFilename[index] = fi.fileName();
        framesModified[index] = true;
    }
    else
    {
        sound[index] = NULL;
        soundFilepath[index] = "Wrong file";
        framesFilename[index] = "Wrong file" + filePathString;
    }
}
开发者ID:shoshon,项目名称:pencil,代码行数:36,代码来源:layersound.cpp


注:本文中的phonon::MediaObject::stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。