1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

SDRDaemonSink: refactoring (2)

This commit is contained in:
f4exb 2018-08-29 22:08:58 +02:00
parent af5e61ca48
commit a8d45fd253
2 changed files with 5 additions and 48 deletions

View File

@ -43,7 +43,6 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_deviceUISet(deviceUISet), m_deviceUISet(deviceUISet),
m_settings(), m_settings(),
m_deviceSampleSink(0), m_deviceSampleSink(0),
m_sampleRate(0),
m_samplesCount(0), m_samplesCount(0),
m_tickCount(0), m_tickCount(0),
m_nbSinceLastFlowCheck(0), m_nbSinceLastFlowCheck(0),
@ -193,9 +192,9 @@ void SDRdaemonSinkGui::handleInputMessages()
if (DSPSignalNotification::match(*message)) if (DSPSignalNotification::match(*message))
{ {
DSPSignalNotification* notif = (DSPSignalNotification*) message; DSPSignalNotification* notif = (DSPSignalNotification*) message;
qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
m_sampleRate = notif->getSampleRate(); m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency(); m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("SDRdaemonSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency(); updateSampleRateAndFrequency();
delete message; delete message;
@ -224,9 +223,9 @@ void SDRdaemonSinkGui::updateTxDelayTooltip()
void SDRdaemonSinkGui::displaySettings() void SDRdaemonSinkGui::displaySettings()
{ {
blockApplySettings(true);
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_sampleRate); 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->txDelay->setValue(m_settings.m_txDelay*100);
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100)); ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100));
ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks); 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->apiPort->setText(tr("%1").arg(m_settings.m_apiPort));
ui->dataAddress->setText(m_settings.m_dataAddress); ui->dataAddress->setText(m_settings.m_dataAddress);
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort)); ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
blockApplySettings(false);
} }
void SDRdaemonSinkGui::sendSettings() void SDRdaemonSinkGui::sendSettings()
@ -447,7 +447,7 @@ void SDRdaemonSinkGui::tick()
{ {
SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming* message = SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming::create(); SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming* message = SDRdaemonSinkOutput::MsgConfigureSDRdaemonSinkStreamTiming::create();
m_deviceSampleSink->getInputMessageQueue()->push(message); m_deviceSampleSink->getInputMessageQueue()->push(message);
displayEventTimer(); displayEventTimer();
} }
} }

View File

@ -86,6 +86,7 @@ void SDRdaemonSinkThread::setSamplerate(int samplerate)
m_samplerate = samplerate; m_samplerate = samplerate;
m_samplesChunkSize = (m_samplerate * m_throttlems) / 1000; m_samplesChunkSize = (m_samplerate * m_throttlems) / 1000;
m_udpSinkFEC.setSampleRate(m_samplerate);
if (wasRunning) { if (wasRunning) {
startWork(); startWork();
@ -126,12 +127,6 @@ void SDRdaemonSinkThread::tick()
m_throttleToggle = !m_throttleToggle; m_throttleToggle = !m_throttleToggle;
} }
// if (m_throttlems > m_maxThrottlems)
// {
// qDebug("FileSinkThread::tick: m_maxThrottlems: %d", m_maxThrottlems);
// m_maxThrottlems = m_throttlems;
// }
SampleVector::iterator readUntil; SampleVector::iterator readUntil;
m_sampleFifo->readAdvance(readUntil, m_samplesChunkSize); // pull samples m_sampleFifo->readAdvance(readUntil, m_samplesChunkSize); // pull samples
@ -139,43 +134,5 @@ void SDRdaemonSinkThread::tick()
m_samplesCount += m_samplesChunkSize; m_samplesCount += m_samplesChunkSize;
m_udpSinkFEC.write(beginRead, m_samplesChunkSize); m_udpSinkFEC.write(beginRead, m_samplesChunkSize);
// m_ofstream->write(reinterpret_cast<char*>(&(*beginRead)), m_samplesChunkSize*sizeof(Sample)); // send samples
// interpolation is done on the far side
// if (m_log2Interpolation == 0)
// {
// m_ofstream->write(reinterpret_cast<char*>(&(*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<<m_log2Interpolation)*2);
// break;
// case 2:
// m_interpolators.interpolate4_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
// break;
// case 3:
// m_interpolators.interpolate8_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
// break;
// case 4:
// m_interpolators.interpolate16_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
// break;
// case 5:
// m_interpolators.interpolate32_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
// break;
// case 6:
// m_interpolators.interpolate64_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
// break;
// default:
// break;
// }
//
// m_ofstream->write(reinterpret_cast<char*>(m_buf), m_samplesChunkSize*(1<<m_log2Interpolation)*2*sizeof(int16_t)); // send samples
// }
} }
} }