예제 #1
0
//--------------------------------------------------------------
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();
}
예제 #2
0
//--------------------------------------------------------------
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();
}
예제 #3
0
qlonglong MprisManager::position() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->position() : 0;
}
예제 #4
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);
	}
}
예제 #6
0
bool MprisManager::openUri(const QUrl &uri) const
{
    return checkController(Q_FUNC_INFO) && m_currentController->openUri(uri);
}
예제 #7
0
double MprisManager::volume() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->volume() : 0;
}
예제 #8
0
void MprisManager::setRate(double rate)
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->setRate(rate);
    }
}
예제 #9
0
QString MprisManager::identity() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->identity() : QString();
}
예제 #10
0
bool MprisManager::hasTrackList() const
{
    return checkController(Q_FUNC_INFO) && m_currentController->hasTrackList();
}
예제 #11
0
void MprisManager::setFullscreen(bool fullscreen)
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->setFullscreen(fullscreen);
    }
}
예제 #12
0
bool MprisManager::fullscreen() const
{
    return checkController(Q_FUNC_INFO) && m_currentController->fullscreen();
}
예제 #13
0
QString MprisManager::desktopEntry() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->desktopEntry() : QString();
}
예제 #14
0
bool MprisManager::setPosition(const QString &trackId, qlonglong position) const
{
    return checkController(Q_FUNC_INFO) && m_currentController->setPosition(trackId, position);
}
예제 #15
0
void MprisManager::requestPosition() const
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->requestPosition();
    }
}
예제 #16
0
double MprisManager::rate() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->rate() : 1;
}
예제 #17
0
QStringList MprisManager::supportedMimeTypes() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->supportedMimeTypes() : QStringList();
}
예제 #18
0
void MprisManager::setShuffle(bool shuffle)
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->setShuffle(shuffle);
    }
}
예제 #19
0
bool MprisManager::canSeek() const
{
    return checkController(Q_FUNC_INFO) && m_currentController->canSeek();
}
예제 #20
0
void MprisManager::setVolume(double volume)
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->setVolume(volume);
    }
}
예제 #21
0
Mpris::LoopStatus MprisManager::loopStatus() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->loopStatus() : Mpris::None;
}
예제 #22
0
bool MprisManager::pause() const
{
    return checkController(Q_FUNC_INFO) && m_currentController->pause();
}
예제 #23
0
void MprisManager::setLoopStatus(Mpris::LoopStatus loopStatus)
{
    if (checkController(Q_FUNC_INFO)) {
        m_currentController->setLoopStatus(loopStatus);
    }
}
예제 #24
0
QVariantMap MprisManager::metadata() const
{
    return checkController(Q_FUNC_INFO) ? m_currentController->metadata() : QVariantMap();
}
예제 #25
0
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();
}
예제 #27
0
bool MprisManager::seek(qlonglong offset) const
{
    return checkController(Q_FUNC_INFO) && m_currentController->seek(offset);
}