From a8d45fd25373694f165f03586facd9271f21bc57 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 29 Aug 2018 22:08:58 +0200 Subject: [PATCH] SDRDaemonSink: refactoring (2) --- .../sdrdaemonsink/sdrdaemonsinkgui.cpp | 8 ++-- .../sdrdaemonsink/sdrdaemonsinkthread.cpp | 45 +------------------ 2 files changed, 5 insertions(+), 48 deletions(-) diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp index f3e48d9b5..60c9170b8 100644 --- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp +++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp @@ -43,7 +43,6 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceUISet *deviceUISet, QWidget* parent) : m_deviceUISet(deviceUISet), m_settings(), m_deviceSampleSink(0), - m_sampleRate(0), m_samplesCount(0), m_tickCount(0), m_nbSinceLastFlowCheck(0), @@ -193,9 +192,9 @@ void SDRdaemonSinkGui::handleInputMessages() if (DSPSignalNotification::match(*message)) { DSPSignalNotification* notif = (DSPSignalNotification*) message; - qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); m_sampleRate = notif->getSampleRate(); m_deviceCenterFrequency = notif->getCenterFrequency(); + qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); updateSampleRateAndFrequency(); delete message; @@ -224,9 +223,9 @@ void SDRdaemonSinkGui::updateTxDelayTooltip() void SDRdaemonSinkGui::displaySettings() { + blockApplySettings(true); ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->sampleRate->setValue(m_settings.m_sampleRate); - ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate) / 1000)); ui->txDelay->setValue(m_settings.m_txDelay*100); ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100)); ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks); @@ -239,6 +238,7 @@ void SDRdaemonSinkGui::displaySettings() ui->apiPort->setText(tr("%1").arg(m_settings.m_apiPort)); ui->dataAddress->setText(m_settings.m_dataAddress); ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort)); + blockApplySettings(false); } void SDRdaemonSinkGui::sendSettings() @@ -447,7 +447,7 @@ void SDRdaemonSinkGui::tick() { SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming* message = SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming::create(); m_deviceSampleSink->getInputMessageQueue()->push(message); - + displayEventTimer(); } } diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkthread.cpp b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkthread.cpp index 76b96d566..be7bda63d 100644 --- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkthread.cpp +++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkthread.cpp @@ -86,6 +86,7 @@ void SDRdaemonSinkThread::setSamplerate(int samplerate) m_samplerate = samplerate; m_samplesChunkSize = (m_samplerate * m_throttlems) / 1000; + m_udpSinkFEC.setSampleRate(m_samplerate); if (wasRunning) { startWork(); @@ -126,12 +127,6 @@ void SDRdaemonSinkThread::tick() m_throttleToggle = !m_throttleToggle; } -// if (m_throttlems > m_maxThrottlems) -// { -// qDebug("FileSinkThread::tick: m_maxThrottlems: %d", m_maxThrottlems); -// m_maxThrottlems = m_throttlems; -// } - SampleVector::iterator readUntil; m_sampleFifo->readAdvance(readUntil, m_samplesChunkSize); // pull samples @@ -139,43 +134,5 @@ void SDRdaemonSinkThread::tick() m_samplesCount += m_samplesChunkSize; m_udpSinkFEC.write(beginRead, m_samplesChunkSize); -// m_ofstream->write(reinterpret_cast(&(*beginRead)), m_samplesChunkSize*sizeof(Sample)); // send samples - - // interpolation is done on the far side -// if (m_log2Interpolation == 0) -// { -// m_ofstream->write(reinterpret_cast(&(*beginRead)), m_samplesChunkSize*sizeof(Sample)); // send samples -// } -// else -// { -// int chunkSize = std::min((int) m_samplesChunkSize, m_samplerate); -// -// switch (m_log2Interpolation) -// { -// case 1: -// m_interpolators.interpolate2_cen(&beginRead, m_buf, chunkSize*(1<write(reinterpret_cast(m_buf), m_samplesChunkSize*(1<