1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

SDRdaemonSink: apply settings

This commit is contained in:
f4exb 2017-05-21 20:13:17 +02:00
parent e14d0179c5
commit 3d691ab416
2 changed files with 51 additions and 13 deletions

View File

@ -156,9 +156,26 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
QMutexLocker mutexLocker(&m_mutex);
bool forwardChange = false;
if (force || (m_settings.m_address != settings.m_address) || (m_settings.m_dataPort != settings.m_dataPort))
{
m_settings.m_address = settings.m_address;
m_settings.m_dataPort = settings.m_dataPort;
if (m_sdrDaemonSinkThread != 0)
{
m_sdrDaemonSinkThread->setRemoteAddress(m_settings.m_address, m_settings.m_dataPort);
}
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency))
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
if (m_sdrDaemonSinkThread != 0)
{
m_sdrDaemonSinkThread->setCenterFrequency(m_settings.m_centerFrequency);
}
forwardChange = true;
}
@ -177,23 +194,41 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
if (force || (m_settings.m_log2Interp != settings.m_log2Interp))
{
m_settings.m_log2Interp = settings.m_log2Interp;
if (m_sdrDaemonSinkThread != 0)
{
m_sdrDaemonSinkThread->setSamplerate(m_settings.m_sampleRate);
}
forwardChange = true;
}
// TODO: manage sending to control port
if (force || (m_settings.m_txDelay != settings.m_txDelay))
{
m_settings.m_txDelay = settings.m_txDelay;
if (m_sdrDaemonSinkThread != 0)
{
m_sdrDaemonSinkThread->setTxDelay(m_settings.m_txDelay);
}
}
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks))
{
m_settings.m_nbFECBlocks = settings.m_nbFECBlocks;
if (m_sdrDaemonSinkThread != 0)
{
m_sdrDaemonSinkThread->setNbBlocksFEC(m_settings.m_nbFECBlocks);
}
}
mutexLocker.unlock();
qDebug("FileSinkOutput::applySettings: %s m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d m_txDelay: %d m_nbFECBlocks: %d",
forwardChange ? "forward change" : "",
m_settings.m_centerFrequency,
m_settings.m_sampleRate,
m_settings.m_log2Interp,
m_settings.m_txDelay,
m_settings.m_nbFECBlocks);
if (forwardChange)
{
qDebug("FileSinkOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d",
m_settings.m_centerFrequency,
m_settings.m_sampleRate,
m_settings.m_log2Interp);
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
}

View File

@ -45,12 +45,15 @@ public:
void startWork();
void stopWork();
void setCenterFrequency(uint64_t centerFrequency) { m_udpSinkFEC.setCenterFrequency(centerFrequency); }
void setSamplerate(int samplerate);
void setBuffer(std::size_t chunksize);
void setNbBlocksFEC(uint32_t nbBlocksFEC) { m_udpSinkFEC.setNbBlocksFEC(nbBlocksFEC); };
void setTxDelay(uint32_t txDelay) { m_udpSinkFEC.setTxDelay(txDelay); };
void setRemoteAddress(const QString& address, uint16_t port) { m_udpSinkFEC.setRemoteAddress(address, port); }
bool isRunning() const { return m_running; }
bool isRunning() const { return m_running; }
std::size_t getSamplesCount() const { return m_samplesCount; }
void setSamplesCount(int samplesCount) { m_samplesCount = samplesCount; }