本文整理汇总了C++中playing函数的典型用法代码示例。如果您正苦于以下问题:C++ playing函数的具体用法?C++ playing怎么用?C++ playing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了playing函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
MediaController::MediaController(kt::MediaPlayer* player, KActionCollection* ac, QWidget* parent) : QWidget(parent)
{
setupUi(this);
info_label->setText(i18n("Ready to play"));
seek_slider->setMediaObject(player->media0bject());
volume->setAudioOutput(player->output());
volume->setOrientation(Qt::Horizontal);
connect(player, SIGNAL(stopped()), this, SLOT(stopped()));
connect(player, SIGNAL(playing(MediaFileRef)), this, SLOT(playing(MediaFileRef)));
play->setDefaultAction(ac->action("media_play"));
play->setAutoRaise(true);
pause->setDefaultAction(ac->action("media_pause"));
pause->setAutoRaise(true);
stop->setDefaultAction(ac->action("media_stop"));
stop->setAutoRaise(true);
prev->setDefaultAction(ac->action("media_prev"));
prev->setAutoRaise(true);
next->setDefaultAction(ac->action("media_next"));
next->setAutoRaise(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
}
示例2: Player
KSB_MediaWidget::KSB_MediaWidget(QWidget *parent):KSB_MediaWidget_skel(parent)
{
player = new Player(this);
empty();
QFont labelFont = time->font();
labelFont.setPointSize(18);
labelFont.setBold(true);
time->setFont(labelFont);
connect(Play, SIGNAL(clicked()), player, SLOT(play()));
connect(Pause, SIGNAL(clicked()), player, SLOT(pause()));
connect(Stop, SIGNAL(clicked()), player, SLOT(stop()));
connect(player, SIGNAL(timeout()), this, SLOT(playerTimeout()));
connect(player, SIGNAL(finished()), this, SLOT(playerFinished()));
connect(player, SIGNAL(playing()), this, SLOT(playing()));
connect(player, SIGNAL(paused()), this, SLOT(paused()));
connect(player, SIGNAL(stopped()), this, SLOT(stopped()));
connect(player, SIGNAL(empty()), this, SLOT(empty()));
connect(Position, SIGNAL(userChanged(int)), this, SLOT(skipToWrapper(int)));
connect(this, SIGNAL(skipTo(unsigned long)), player, SLOT(skipTo(unsigned long)));
setAcceptDrops(true);
pretty="";
needLengthUpdate=false;
QToolTip::add(Play,i18n("Play"));
QToolTip::add(Pause,i18n("Pause"));
QToolTip::add(Stop,i18n("Stop"));
}
示例3: state
void VlcMediaPlayer::emitStatus()
{
Vlc::State s = state();
bool audio_count;
bool video_count;
if (s == Vlc::Buffering ||
s == Vlc::Playing ||
s == Vlc::Paused) {
audio_count = _vlcAudio->trackCount() > 0;
video_count = _vlcVideo->trackCount() > 0;
} else {
audio_count = false;
video_count = false;
}
VlcError::errmsg();
emit currentState(s);
emit hasAudio(audio_count);
emit hasVideo(video_count);
// Deprecated
bool play = s == Vlc::Playing;
bool buffering = s == Vlc::Buffering;
emit playing(play, buffering);
}
示例4: QTimer
void WorkPreviewerThread::playFile(QString file) {
if(mFillTimer == NULL) {
mFillTimer = new QTimer(this);
//connect us up
QObject::connect(mFillTimer,
SIGNAL(timeout()),
this,
SLOT(fillBuffer()));
}
mFillTimer->stop();
try {
if(mSoundFile)
delete mSoundFile;
mSoundFile = new SoundFile(file.toStdString());
if(*mSoundFile) {
//run every millisecond
mFillTimer->start(1);
} else {
delete mSoundFile;
mSoundFile = NULL;
emit(playing(false));
}
} catch (...) {
mSoundFile = NULL;
}
}
示例5: viewport
void
WPiano::capture_mouse(bool capture)
{
if (capture == mouse_captured_)
return;
if (capture && playing())
return;
if (capture) {
#ifdef Q_WS_WIN
QRect v = viewport();
QPoint p1 = mapToGlobal(v.topLeft());
QPoint p2 = mapToGlobal(v.bottomRight());
RECT rect = {p1.x(), p1.y(), p2.x(), p2.y()};
ClipCursor(&rect);
// be sure that cursor doesn't reach the clip boundary
update_timer_.start(update_freq, this);
#else
grabMouse();
#endif
drop_pivot();
setCursor(Qt::BlankCursor);
} else {
#ifdef Q_WS_WIN
ClipCursor(NULL);
update_timer_.stop();
#else
releaseMouse();
#endif
setCursor(Qt::ArrowCursor);
}
mouse_captured_ = capture;
setMouseTracking(mouse_captured_);
}
示例6: isFinished
bool SoundManager::isFinished(WSound *sound) const
{
if (current_ == sound)
return !playing();
else
return true;
}
示例7: while
void PlayerGst::timerUpdate()
{
GstMessage* message;
while(!usePlaybin && (message = gst_bus_pop(bus), message)) {
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR: {
GError *err;
gchar *debug;
gst_message_parse_error (message, &err, &debug);
QString str;
str = "Error #"+QString::number(err->code)+" in module "+QString::number(err->domain)+"\n"+QString::fromUtf8(err->message);
if(err->code == 6 && err->domain == 851) {
str += "\nMay be you should to install gstreamer0.10-plugins-ugly or gstreamer0.10-plugins-bad";
}
QMessageBox::warning(0, "Gstreamer error", str);
g_error_free (err);
g_free (debug);
break;
}
case GST_MESSAGE_EOS:
need_finish();
//QMessageBox::information(0, "", "EOS");
return;
default:
break;
}
}
if(playing()) {
gint64 p;
GstFormat fmt = GST_FORMAT_TIME;
gst_element_query_position(pipeline, &fmt, &p);
emit position((double)(p - Gstart) / Glength);
}
}
示例8: lock
AUD_Handle* AUD_SoftwareDevice::play(AUD_IReader* reader, bool keep)
{
// prepare the reader
reader = m_mixer->prepare(reader);
if(reader == NULL)
return NULL;
// play sound
AUD_SoftwareHandle* sound = new AUD_SoftwareHandle;
sound->keep = keep;
sound->reader = reader;
sound->volume = 1.0f;
sound->loopcount = 0;
sound->stop = NULL;
sound->stop_data = NULL;
lock();
m_playingSounds.push_back(sound);
if(!m_playback)
playing(m_playback = true);
unlock();
return sound;
}
示例9: playing
void AUD_SoftwareDevice::destroy()
{
if(m_playback)
playing(m_playback = false);
delete m_mixer;
AUD_SoftwareHandle* handle;
// delete all playing sounds
while(!m_playingSounds.empty())
{
handle = m_playingSounds.front();
m_playingSounds.pop_front();
delete handle->reader;
delete handle;
}
// delete all paused sounds
while(!m_pausedSounds.empty())
{
handle = m_pausedSounds.front();
m_pausedSounds.pop_front();
delete handle->reader;
delete handle;
}
pthread_mutex_destroy(&m_mutex);
}
示例10: updateScope
void AnimationPlayer::play()
{
PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand);
if (!playing())
m_startTime = nullValue();
if (playStateInternal() == Idle) {
// We may not go into the pending state, but setting it to something other
// than Idle here will force an update.
ASSERT(isNull(m_startTime));
m_playState = Pending;
m_held = true;
m_holdTime = 0;
}
m_finished = false;
unpauseInternal();
if (!m_content)
return;
double currentTime = this->currentTimeInternal();
if (m_playbackRate > 0 && (currentTime < 0 || currentTime >= sourceEnd()))
setCurrentTimeInternal(0, TimingUpdateOnDemand);
else if (m_playbackRate < 0 && (currentTime <= 0 || currentTime > sourceEnd()))
setCurrentTimeInternal(sourceEnd(), TimingUpdateOnDemand);
}
示例11: hexagon
void CritterObject::think()
{
if (movementQueue()->size() > 0)
{
if (!_moving)
{
_moving = true;
delete _ui;
_orientation = hexagon()->orientationTo(movementQueue()->back());
auto animation = _generateMovementAnimation();
animation->setActionFrame(_running ? 2 : 4);
animation->addEventHandler("actionFrame", std::bind(&CritterObject::onMovementAnimationEnded, this, std::placeholders::_1));
animation->addEventHandler("animationEnded", std::bind(&CritterObject::onMovementAnimationEnded, this, std::placeholders::_1));
animation->play();
_ui = animation;
}
}
else
{
auto anim = (UI::Animation*)ui();
if (!_moving && (!anim || !anim->playing()))
{
if (SDL_GetTicks() > _nextIdleAnim)
{
setActionAnimation("aa");
_setupNextIdleAnim();
}
}
}
Object::think();
}
示例12: lower
void DynamicPlaylist::lower(QWidget *top)
{
if(top == this)
return;
if(playing()) {
PlaylistList l;
l.append(this);
for(PlaylistList::Iterator it = m_playlists.begin();
it != m_playlists.end(); ++it)
{
(*it)->synchronizePlayingItems(l, true);
}
}
PlaylistItemList list = PlaylistItem::playingItems();
for(PlaylistItemList::Iterator it = list.begin(); it != list.end(); ++it) {
if((*it)->playlist() == this) {
list.erase(it);
break;
}
}
if(!list.isEmpty())
TrackSequenceManager::instance()->setCurrentPlaylist(list.front()->playlist());
}
示例13: GenericRenderer
ClipRenderer::ClipRenderer() :
GenericRenderer(),
m_clipLoaded( false ),
m_vlcMedia( NULL ),
m_selectedClip( NULL ),
m_begin( 0 ),
m_end( -1 ),
m_mediaChanged( false )
{
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SIGNAL( paused() ) );
connect( m_mediaPlayer, SIGNAL( playing() ), this, SIGNAL( playing() ) );
connect( m_mediaPlayer, SIGNAL( volumeChanged() ), this, SIGNAL( volumeChanged() ) );
connect( m_mediaPlayer, SIGNAL( timeChanged( qint64 ) ),this, SLOT( __timeChanged( qint64 ) ) );
connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( __endReached() ) );
}
示例14: requestMessage
void StateManager::Internals::addedToEntity()
{
StateManager* man = &mState;
requestMessage("Get.Input", [man](Kunlaboro::Message& msg){ msg.payload = man->mInput; msg.handled = true; });
requestMessage("Get.Settings", [man](Kunlaboro::Message& msg){ msg.payload = man->mSettings; msg.handled = true; });
requestMessage("Get.Sounds", [man](Kunlaboro::Message& msg){ msg.payload = man->mSound; msg.handled = true; });
requestMessage("Get.Font", [man](Kunlaboro::Message& msg){ msg.payload = &man->mGlobalFont; msg.handled = true; });
requestMessage("Get.GameView", [man](Kunlaboro::Message& msg){ msg.payload = man->mGameView; msg.handled = true; });
requestMessage("Get.UiView", [man](Kunlaboro::Message& msg){ msg.payload = man->mUiView; msg.handled = true; });
requestMessage("Now Playing", [this](const Kunlaboro::Message& msg)
{
mCurrentSong = boost::any_cast<std::string>(msg.payload);
mSongPopout = 0;
mSongTimeout = 2;
});
requestMessage("LD26.Update", [this](const Kunlaboro::Message& msg)
{
float dt = boost::any_cast<float>(msg.payload);
if (mSongTimeout > 0)
mSongTimeout = std::max(0.f, mSongTimeout - dt);
if (!mCurrentSong.empty() && mSongTimeout > 0 && mSongPopout < 1)
mSongPopout = std::min(1.f, mSongPopout + dt);
else if (mSongTimeout == 0 && mSongPopout > 0)
mSongPopout = std::max(0.f, mSongPopout - dt);
else if (mSongTimeout == 0 && mSongPopout == 0 && !mCurrentSong.empty())
mCurrentSong.clear();
});
changeRequestPriority("LD26.Update", -11);
requestMessage("LD26.DrawUi", [this](const Kunlaboro::Message& msg)
{
sf::RenderTarget& target = *boost::any_cast<sf::RenderTarget*>(msg.payload);
sf::RectangleShape rect;
rect.setSize(sf::Vector2f(512, 96));
rect.setOrigin(rect.getSize()/2.f);
rect.setFillColor(sf::Color::Black);
rect.setOutlineColor(sf::Color::White);
rect.setOutlineThickness(6.f);
rect.setPosition(target.getSize().x + 262 - (512 * mSongPopout), target.getSize().y - 100);
target.draw(rect);
sf::Text playing("Now Playing:", mState.mGlobalFont);
sf::FloatRect bounds = playing.getLocalBounds();
playing.setPosition(rect.getPosition() - sf::Vector2f(350, 72) + sf::Vector2f(bounds.left + bounds.width/2, bounds.top + bounds.height/2));
target.draw(playing);
playing.setString(mCurrentSong);
playing.move(0, bounds.height + 16);
playing.setCharacterSize(20U);
target.draw(playing);
});
}
示例15: playing
bool AnimationPlayer::canStartAnimationOnCompositor()
{
// FIXME: Timeline playback rates should be compositable
if (m_playbackRate == 0 || (std::isinf(sourceEnd()) && m_playbackRate < 0) || (timeline() && timeline()->playbackRate() != 1))
return false;
return m_timeline && m_content && m_content->isAnimation() && playing();
}