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


C++ QMediaPlayer::setPosition方法代码示例

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


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

示例1: playSegment

void WaveformView::playSegment(LipsyncPhrase *fPhrase, LipsyncWord *fWord, LipsyncPhoneme *fPhoneme, int32 fScrubFrame)
{
    bool playSegment = false;
    QMediaPlayer *audioPlayer = fDoc->GetAudioPlayer();
    int32 startFrame;
    fAudioStopFrame = -1;
    if (audioPlayer)
    {
        if (fPhrase)
        {
            playSegment = true;
            startFrame = fPhrase->fStartFrame;
            fAudioStopFrame = fPhrase->fEndFrame + 1;
        }
        else if (fWord)
        {
            playSegment = true;
            startFrame = fWord->fStartFrame;
            fAudioStopFrame = fWord->fEndFrame + 1;
        }
        else if (fPhoneme)
        {
            playSegment = true;
            startFrame = fPhoneme->fFrame;
            fAudioStopFrame = startFrame + 1;
        }
        if (playSegment)
        {
            float f = ((real)startFrame / (real)fDoc->Fps()) * 1000.0f;
            audioPlayer->setPosition(PG_ROUND(f));
            audioPlayer->play();
            emit(frameChanged(fScrubFrame));
        }
    }
}
开发者ID:muddcliff,项目名称:Papagayo,代码行数:35,代码来源:waveformview.cpp

示例2: QGraphicsPixmapItem

Bullet::Bullet()
    :QObject(),
     QGraphicsPixmapItem()
{
    setPixmap(QPixmap(":/images/rocket.png"));

    QTimer *timer = new QTimer();
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(move()));

    timer->start(50);

    //sound bullet
    QMediaPlayer *bulletSound = new QMediaPlayer();
    bulletSound->setMedia(QUrl("qrc:/sounds/shoot.wav"));

    //sound
    if (bulletSound->state() == QMediaPlayer::PlayingState)
    {
        bulletSound->setPosition(0); //rewind
    }
    else bulletSound->play(); //it should be in QMediaPlayer::StoppedState
}
开发者ID:samuxiii,项目名称:planes,代码行数:22,代码来源:Bullet.cpp

示例3: mouseMoveEvent


//.........这里部分代码省略.........
				fDoc->fCurrentVoice->RepositionPhrase(fSelectedPhrase, fDoc->Duration());
				needUpdate = true;
			}
		}
		else if (fDraggingEnd == 1)
		{
			if (frame != fSelectedPhrase->fEndFrame)
			{
				fDoc->fDirty = true;
				fSelectedPhrase->fEndFrame = frame;
				if (fSelectedPhrase->fEndFrame < fSelectedPhrase->fStartFrame + 1)
					fSelectedPhrase->fEndFrame = fSelectedPhrase->fStartFrame + 1;
				fDoc->fCurrentVoice->RepositionPhrase(fSelectedPhrase, fDoc->Duration());
				needUpdate = true;
			}
		}
		else if (fDraggingEnd == 2)
		{
			if (frame != fOldFrame)
			{
				fDoc->fDirty = true;
				fSelectedPhrase->fStartFrame += frame - fOldFrame;
				fSelectedPhrase->fEndFrame += frame - fOldFrame;
				if (fSelectedPhrase->fEndFrame < fSelectedPhrase->fStartFrame + 1)
					fSelectedPhrase->fEndFrame = fSelectedPhrase->fStartFrame + 1;
				fDoc->fCurrentVoice->RepositionPhrase(fSelectedPhrase, fDoc->Duration());
				needUpdate = true;
			}
		}
	}
	else if (fSelectedWord)
	{
		if (fDraggingEnd == 0)
		{
			if (frame != fSelectedWord->fStartFrame)
			{
				fDoc->fDirty = true;
				fSelectedWord->fStartFrame = frame;
				if (fSelectedWord->fStartFrame > fSelectedWord->fEndFrame - 1)
					fSelectedWord->fStartFrame = fSelectedWord->fEndFrame - 1;
				fParentPhrase->RepositionWord(fSelectedWord);
				needUpdate = true;
			}
		}
		else if (fDraggingEnd == 1)
		{
			if (frame != fSelectedWord->fEndFrame)
			{
				fDoc->fDirty = true;
				fSelectedWord->fEndFrame = frame;
				if (fSelectedWord->fEndFrame < fSelectedWord->fStartFrame + 1)
					fSelectedWord->fEndFrame = fSelectedWord->fStartFrame + 1;
				fParentPhrase->RepositionWord(fSelectedWord);
				needUpdate = true;
			}
		}
		else if (fDraggingEnd == 2)
		{
			if (frame != fOldFrame)
			{
				fDoc->fDirty = true;
				fSelectedWord->fStartFrame += frame - fOldFrame;
				fSelectedWord->fEndFrame += frame - fOldFrame;
				if (fSelectedWord->fEndFrame < fSelectedWord->fStartFrame + 1)
					fSelectedWord->fEndFrame = fSelectedWord->fStartFrame + 1;
				fParentPhrase->RepositionWord(fSelectedWord);
				needUpdate = true;
			}
		}
	}
	else if (fSelectedPhoneme)
	{
		if (fDraggingEnd == 0)
		{
			if (frame != fSelectedPhoneme->fFrame)
			{
				fDoc->fDirty = true;
				fSelectedPhoneme->fFrame = frame;
				fParentWord->RepositionPhoneme(fSelectedPhoneme);
				needUpdate = true;
			}
		}
	}

	fOldFrame = frame;

	QMediaPlayer *audioPlayer = fDoc->GetAudioPlayer();
	if (frame != fScrubFrame)
	{
		fScrubFrame = frame;
		fCurFrame = fScrubFrame;
		f = ((real)fScrubFrame / (real)fDoc->Fps()) * 1000.0f;
		audioPlayer->setPosition(PG_FLOOR(f));
		audioPlayer->play();
		emit(frameChanged(fScrubFrame));
		needUpdate = true;
	}
	if (needUpdate)
		update();
}
开发者ID:muddcliff,项目名称:Papagayo,代码行数:101,代码来源:waveformview.cpp


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