void MainWindow::OnUpMenu(wxCommandEvent& event) { if (awaiting_input) { showAwaitingInputDialog(); return; } UpLevelClickUserData * userData = (UpLevelClickUserData*)(event.m_callbackUserData); DRUID::SerialUIUserPtr serial_user = connection->serialUser(); touchLastInteraction(); if (! doUpMenu(serial_user)) return; DRUIDString lastMsg(serial_user->lastMessage()); DRUID_DEBUG2("******** executing command appending buffer: ", lastMsg); outputTextCtrl->AppendText(DRUID_STDSTRING_TOWX(lastMsg)); enableSUIWindow(userData->cur_menu->parent()->uid()); SetStatusText(DRUID_STDSTRING_TOWX(userData->cur_menu->parent()->name())); }
void LSThread::processMessagesByType(int type)/*{{{*/ { switch(type) { case 0: //Output { while(m_process->canReadLine()) { QString messages = QString::fromUtf8(m_process->readLine().constData()); messages = messages.trimmed().simplified(); if(messages.isEmpty()) continue; if(debugMsg) qDebug("LinuxSampler::INFO: %s", messages.toUtf8().constData()); } } break; case 1: //Error { QByteArray ba = m_process->readAllStandardError(); QTextStream in(&ba); QString messages = in.readLine(); QString lastMsg(""); while(!messages.isNull()) { if(messages.isEmpty() || messages == lastMsg) { messages = in.readLine(); continue; } qDebug("LinuxSampler::ERROR: %s", messages.toUtf8().constData()); lastMsg = messages; messages = in.readLine(); } } break; } }/*}}}*/
void Composer::run() { int ret; Frame *f = NULL; ItcMsg lastMsg( ItcMsg::RENDERSTOP ); hiddenContext->makeCurrent(); while ( running ) { itcMutex.lock(); if ( !itcMsgList.isEmpty() ) lastMsg = itcMsgList.takeFirst(); itcMutex.unlock(); switch ( lastMsg.msgType ) { case ItcMsg::RENDERPLAY: { ret = process( &f ); if ( ret == PROCESSEND ) { while ( !sampler->getMetronom()->videoFrames.queueEmpty() ) { usleep( 5000 ); } lastMsg.msgType = ItcMsg::RENDERSTOP; break; } else if ( ret == PROCESSWAITINPUT ) usleep( 1000 ); break; } case ItcMsg::RENDERSETPLAYBACKBUFFER: { double pts = sampler->fromComposerSetPlaybackBuffer( lastMsg.backward ); sampler->fromComposerSeekTo( pts, lastMsg.backward, false ); sampler->getMetronom()->play( true, lastMsg.backward ); playing = true; skipFrame = 0; audioSampleDelta = 0; lastMsg.msgType = ItcMsg::RENDERPLAY; break; } case ItcMsg::RENDERFRAMEBYFRAMESETPLAYBACKBUFFER: { double pts = sampler->fromComposerSetPlaybackBuffer( lastMsg.backward ); sampler->fromComposerSeekTo( pts, lastMsg.backward, false ); runOneShot( f ); lastMsg.msgType = ItcMsg::RENDERSTOP; break; } case ItcMsg::RENDERFRAMEBYFRAME: { bool shown = false; Metronom *m = sampler->getMetronom(); if ( !m->videoFrames.isEmpty() ) { do { f = m->videoFrames.dequeue(); if ( f->type() == Frame::GLTEXTURE ) { emit newFrame( f ); shown = true; } else sampler->fromComposerReleaseVideoFrame( f ); } while ( !m->videoFrames.isEmpty() && !shown ); } if ( !shown ) { runOneShot( f ); } lastMsg.msgType = ItcMsg::RENDERSTOP; break; } case ItcMsg::RENDERSKIPBY: { f = sampler->getMetronom()->getLastFrame(); if ( f ) { sampler->fromComposerSeekTo( f->pts() + (f->profile.getVideoFrameDuration() * lastMsg.step) ); runOneShot( f ); } lastMsg.msgType = ItcMsg::RENDERSTOP; break; } case ItcMsg::RENDERSEEK: { sampler->fromComposerSeekTo( lastMsg.pts, lastMsg.backward, lastMsg.seek ); runOneShot( f ); lastMsg.msgType = ItcMsg::RENDERSTOP; break; } case ItcMsg::RENDERUPDATE: { f = sampler->getMetronom()->getAndLockLastFrame(); Frame *dst = sampler->getMetronom()->freeVideoFrames.dequeue(); if ( f && dst ) { dst->sample = new ProjectSample(); dst->sample->copyVideoSample( f->sample ); dst->setPts( f->pts() ); if ( sampler->fromComposerUpdateFrame( dst ) ) { sampler->getMetronom()->unlockLastFrame(); movitRender( dst, true ); if ( dst->fence() ) glClientWaitSync( dst->fence()->fence(), 0, GL_TIMEOUT_IGNORED ); dst->isDuplicate = true; emit newFrame( dst ); } else { sampler->getMetronom()->unlockLastFrame(); dst->release(); sampler->fromComposerSeekTo( f->pts() ); f = NULL; runOneShot( f ); } } else { sampler->getMetronom()->unlockLastFrame(); if ( dst ) dst->release(); } lastMsg.msgType = ItcMsg::RENDERSTOP; break; } default: { if ( playing ) { sampler->getMetronom()->play( false ); playing = false; emit paused( true ); skipFrame = 0; audioSampleDelta = 0; } usleep( 1000 ); } } } hiddenContext->doneCurrent(); #if QT_VERSION >= 0x050000 hiddenContext->context()->moveToThread( qApp->thread() ); #endif }