//-------------------------------------------------------------- void testApp::update() { for ( int i = 0; i < numParticles; i++ ) { particles[i].position += particles[i].speed * speedMult; if ( particles[i].position.x> ofGetWidth() + particles[i].radius*radiusMult ) { particles[i].position.x = -particles[i].radius*radiusMult; } if ( particles[i].position.y > ofGetHeight() + particles[i].radius*radiusMult ) { particles[i].position.y = -particles[i].radius*radiusMult; } if ( particles[i].position.x < - particles[i].radius*radiusMult ) { particles[i].position.x = ofGetWidth() + particles[i].radius*radiusMult; } if ( particles[i].position.y < - particles[i].radius*radiusMult ) { particles[i].position.y = ofGetHeight() + particles[i].radius*radiusMult; } } //particle.position.x += particle.speed.x; //particle.position.y += particle.speed.y //cout << midiMessage.control << endl; if ( midiMessage.control == 1 ) { speedMult.x = midiMessage.value / 127.0f * speedMultMax.x; } if ( midiMessage.control == 2 ) { speedMult.y = midiMessage.value / 127.0f * speedMultMax.y; } if ( midiMessage.control == 3 ) { ofSetCircleResolution( 3+midiMessage.value ); } if ( midiMessage.control == 4 ) { radiusMult = midiMessage.value / 127.0f * radiusMultMax; } checkController(); }
//-------------------------------------------------------------- void testApp::update() { if ( midiMessage.control == 1 ) { freq = midiMessage.value / 127.0f * freqMax; } if ( midiMessage.control == 2 ) { size.x = midiMessage.value / 127.0f * ofGetWidth(); } if ( midiMessage.control == 3 ) { size.y = midiMessage.value / 127.0f * ofGetHeight(); } float frameDuration = 1.0f / freq; float diffTime = ofGetElapsedTimef() - prevUpdateTime; if ( diffTime >= frameDuration ) { triggerStrobe(); prevUpdateTime = ofGetElapsedTimef(); } checkController(); }
qlonglong MprisManager::position() const { return checkController(Q_FUNC_INFO) ? m_currentController->position() : 0; }
bool MprisManager::setPosition(qlonglong position) const { return checkController(Q_FUNC_INFO) && m_currentController->setPosition(position); }
void CDummyRepeaterThread::receive() { m_clockCount = 0U; m_busy = false; unsigned int hangCount = 0U; // While receiving and not exitting while (m_transmit == CLIENT_RECEIVE && !m_killed) { // Get the audio from the RX NETWORK_TYPE type; for (;;) { type = m_protocol->read(); if (type == NETWORK_NONE) { break; } else if (type == NETWORK_HEADER) { CHeaderData* header = m_protocol->readHeader(); if (header != NULL) { processHeader(header); m_watchdog.start(); m_clockCount = 0U; hangCount = 0U; m_busy = true; } break; } else if (type == NETWORK_DATA) { unsigned char buffer[DV_FRAME_LENGTH_BYTES]; unsigned char seqNo; unsigned int length = m_protocol->readData(buffer, DV_FRAME_LENGTH_BYTES, seqNo); if (length != 0U) { bool end = processFrame(buffer, seqNo); if (end) hangCount = 30U; else hangCount = 0U; m_watchdog.reset(); m_clockCount = 0U; } break; } else if (type == NETWORK_TEXT) { wxString text, reflector; LINK_STATUS status; m_protocol->readText(text, status, reflector); ::wxGetApp().showSlowData(text); } else if (type == NETWORK_TEMPTEXT) { wxString text; m_protocol->readTempText(text); } else if (type == NETWORK_STATUS1) { wxString text = m_protocol->readStatus1(); ::wxGetApp().showStatus1(text); } else if (type == NETWORK_STATUS2) { wxString text = m_protocol->readStatus2(); ::wxGetApp().showStatus2(text); } else if (type == NETWORK_STATUS3) { wxString text = m_protocol->readStatus3(); ::wxGetApp().showStatus3(text); } else if (type == NETWORK_STATUS4) { wxString text = m_protocol->readStatus4(); ::wxGetApp().showStatus4(text); } else if (type == NETWORK_STATUS5) { wxString text = m_protocol->readStatus5(); ::wxGetApp().showStatus5(text); } } // Have we missed a data frame? if (type == NETWORK_NONE && m_busy) { m_clockCount++; if (m_clockCount == 8U) { // Create a silence frame unsigned char buffer[DV_FRAME_LENGTH_BYTES]; ::memcpy(buffer, NULL_FRAME_DATA_BYTES, DV_FRAME_LENGTH_BYTES); processFrame(buffer, m_networkSeqNo); m_clockCount = 0U; } } if (m_watchdog.isRunning() && m_watchdog.hasExpired()) { wxLogMessage(wxT("Network watchdog has expired")); m_dongle->setMode(DVDMODE_IDLE); m_protocol->reset(); resetReceiver(); } if (hangCount > 0U) { hangCount--; if (hangCount == 0U) { m_dongle->setMode(DVDMODE_IDLE); resetReceiver(); } } checkController(); Sleep(DSTAR_FRAME_TIME_MS / 4UL); } }
bool MprisManager::openUri(const QUrl &uri) const { return checkController(Q_FUNC_INFO) && m_currentController->openUri(uri); }
double MprisManager::volume() const { return checkController(Q_FUNC_INFO) ? m_currentController->volume() : 0; }
void MprisManager::setRate(double rate) { if (checkController(Q_FUNC_INFO)) { m_currentController->setRate(rate); } }
QString MprisManager::identity() const { return checkController(Q_FUNC_INFO) ? m_currentController->identity() : QString(); }
bool MprisManager::hasTrackList() const { return checkController(Q_FUNC_INFO) && m_currentController->hasTrackList(); }
void MprisManager::setFullscreen(bool fullscreen) { if (checkController(Q_FUNC_INFO)) { m_currentController->setFullscreen(fullscreen); } }
bool MprisManager::fullscreen() const { return checkController(Q_FUNC_INFO) && m_currentController->fullscreen(); }
QString MprisManager::desktopEntry() const { return checkController(Q_FUNC_INFO) ? m_currentController->desktopEntry() : QString(); }
bool MprisManager::setPosition(const QString &trackId, qlonglong position) const { return checkController(Q_FUNC_INFO) && m_currentController->setPosition(trackId, position); }
void MprisManager::requestPosition() const { if (checkController(Q_FUNC_INFO)) { m_currentController->requestPosition(); } }
double MprisManager::rate() const { return checkController(Q_FUNC_INFO) ? m_currentController->rate() : 1; }
QStringList MprisManager::supportedMimeTypes() const { return checkController(Q_FUNC_INFO) ? m_currentController->supportedMimeTypes() : QStringList(); }
void MprisManager::setShuffle(bool shuffle) { if (checkController(Q_FUNC_INFO)) { m_currentController->setShuffle(shuffle); } }
bool MprisManager::canSeek() const { return checkController(Q_FUNC_INFO) && m_currentController->canSeek(); }
void MprisManager::setVolume(double volume) { if (checkController(Q_FUNC_INFO)) { m_currentController->setVolume(volume); } }
Mpris::LoopStatus MprisManager::loopStatus() const { return checkController(Q_FUNC_INFO) ? m_currentController->loopStatus() : Mpris::None; }
bool MprisManager::pause() const { return checkController(Q_FUNC_INFO) && m_currentController->pause(); }
void MprisManager::setLoopStatus(Mpris::LoopStatus loopStatus) { if (checkController(Q_FUNC_INFO)) { m_currentController->setLoopStatus(loopStatus); } }
QVariantMap MprisManager::metadata() const { return checkController(Q_FUNC_INFO) ? m_currentController->metadata() : QVariantMap(); }
Mpris::PlaybackStatus MprisManager::playbackStatus() const { return checkController(Q_FUNC_INFO) ? m_currentController->playbackStatus() : Mpris::Stopped; }
void CDummyRepeaterThread::transmit() { m_encodeData.clear(); m_dongle->setMode(DVDMODE_ENCODE); // Pause until all the silence data has been processed by the AMBE2020 for (unsigned int startCount = 30U; startCount > 0U; startCount--) { unsigned char frame[DV_FRAME_LENGTH_BYTES]; unsigned int n = 0U; do { n += m_encodeData.getData(frame + n, VOICE_FRAME_LENGTH_BYTES - n); if (n < VOICE_FRAME_LENGTH_BYTES) Sleep(DSTAR_FRAME_TIME_MS / 4UL); } while (n < VOICE_FRAME_LENGTH_BYTES); serviceNetwork(); checkController(); } CHeaderData* header = new CHeaderData(m_callsign1, m_callsign2, m_your, m_rpt2, m_rpt1); wxLogMessage(wxT("Transmitting to - My: %s/%s Your: %s Rpt1: %s Rpt2: %s"), header->getMyCall1().c_str(), header->getMyCall2().c_str(), header->getYourCall().c_str(), header->getRptCall1().c_str(), header->getRptCall2().c_str()); m_slowDataEncoder.reset(); m_slowDataEncoder.setHeaderData(*header); serviceNetwork(); checkController(); if (!m_message.IsEmpty()) m_slowDataEncoder.setMessageData(m_message); m_protocol->writeHeader(*header); delete header; serviceNetwork(); checkController(); m_frameCount = 20U; unsigned int endCount = 30U; // While transmitting and not exiting for (;;) { unsigned char frame[DV_FRAME_LENGTH_BYTES]; unsigned int n = 0U; do { n += m_encodeData.getData(frame + n, VOICE_FRAME_LENGTH_BYTES - n); if (n < VOICE_FRAME_LENGTH_BYTES) Sleep(DSTAR_FRAME_TIME_MS / 4UL); } while (n < VOICE_FRAME_LENGTH_BYTES); serviceNetwork(); checkController(); if (m_frameCount == 20U) { // Put in the data resync pattern ::memcpy(frame + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES); m_frameCount = 0U; } else { // Tack the slow data on the end m_slowDataEncoder.getData(frame + VOICE_FRAME_LENGTH_BYTES); m_frameCount++; } if (m_transmit != CLIENT_TRANSMIT) endCount--; // Send the AMBE and slow data frame if (endCount == 0U || m_killed) { m_protocol->writeData(frame, DV_FRAME_LENGTH_BYTES, 0U, true); break; } else { m_protocol->writeData(frame, DV_FRAME_LENGTH_BYTES, 0U, false); } serviceNetwork(); checkController(); } m_dongle->setMode(DVDMODE_IDLE); resetReceiver(); m_transmit = CLIENT_RECEIVE; serviceNetwork(); checkController(); }
bool MprisManager::seek(qlonglong offset) const { return checkController(Q_FUNC_INFO) && m_currentController->seek(offset); }