void PageRunner::finished(bool ok) { // bind nativeio if (!ok) { qApp->exit(1); } if (!scriptMode) { mainFrame()->evaluateJavaScript(getRuntimeBindings()); } // connect signals connect(this, SIGNAL(contentsChanged()), this, SLOT(noteChange())); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(noteChange())); connect(this, SIGNAL(repaintRequested(QRect)), this, SLOT(noteChange())); connect(mainFrame(), SIGNAL(pageChanged()), this, SLOT(noteChange())); connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(noteChange())); QTimer::singleShot(150, this, SLOT(reallyFinished())); changed = false; time.start(); }
void PlayerHandler::process(const jack_nframes_t nframes) { void* outPortBuf = jack_port_get_buffer(m_outputPort, nframes); jack_midi_clear_buffer(outPortBuf); jack_position_t pos; const jack_transport_state_t state = jack_transport_query(m_client, &pos); switch (state) { case JackTransportStopped: { if (m_previousState != state) { // stop them all now allNotesOff(outPortBuf, 0); // reset position m_position = 0; } break; } case JackTransportRolling: { const jack_nframes_t framesAtStart = jack_last_frame_time(m_client); const jack_nframes_t lastFrame = framesAtStart + nframes; const jack_nframes_t startFrame = framesAtStart - pos.frame; while (m_position < m_master.size() && startFrame + m_master[m_position].m_time >= framesAtStart && startFrame + m_master[m_position].m_time < lastFrame) { const MidiEvent & event = m_master[m_position]; const jack_nframes_t newOffset = event.m_time - pos.frame; jack_midi_event_write(outPortBuf, newOffset, event.m_data, event.m_size); noteChange(event.m_data); ++m_position; } break; } default: { break; } } m_previousState = state; }