all source and sink plugins except FileSource and SDRdaemonSource: apply settings with force on construction

pull/127/head
f4exb 2017-12-24 11:05:16 +01:00
rodzic 351651c3e5
commit 8e07820e8e
13 zmienionych plików z 34 dodań i 8 usunięć

Wyświetl plik

@ -47,6 +47,8 @@ BladerfOutput::BladerfOutput(DeviceSinkAPI *deviceAPI) :
m_sampleSourceFifo.resize(16*BLADERFOUTPUT_BLOCKSIZE); m_sampleSourceFifo.resize(16*BLADERFOUTPUT_BLOCKSIZE);
openDevice(); openDevice();
m_deviceAPI->setBuddySharedPtr(&m_sharedParams); m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
applySettings(m_settings, true);
} }
BladerfOutput::~BladerfOutput() BladerfOutput::~BladerfOutput()

Wyświetl plik

@ -49,6 +49,7 @@ FileSinkOutput::FileSinkOutput(DeviceSinkAPI *deviceAPI) :
m_startingTimeStamp(0), m_startingTimeStamp(0),
m_masterTimer(deviceAPI->getMasterTimer()) m_masterTimer(deviceAPI->getMasterTimer())
{ {
applySettings(m_settings, true);
} }
FileSinkOutput::~FileSinkOutput() FileSinkOutput::~FileSinkOutput()

Wyświetl plik

@ -47,6 +47,8 @@ HackRFOutput::HackRFOutput(DeviceSinkAPI *deviceAPI) :
{ {
openDevice(); openDevice();
m_deviceAPI->setBuddySharedPtr(&m_sharedParams); m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
applySettings(m_settings, true);
} }
HackRFOutput::~HackRFOutput() HackRFOutput::~HackRFOutput()

Wyświetl plik

@ -45,6 +45,8 @@ PlutoSDROutput::PlutoSDROutput(DeviceSinkAPI *deviceAPI) :
suspendBuddies(); suspendBuddies();
openDevice(); openDevice();
resumeBuddies(); resumeBuddies();
applySettings(m_settings, true);
} }
PlutoSDROutput::~PlutoSDROutput() PlutoSDROutput::~PlutoSDROutput()
@ -346,7 +348,7 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
<< " <-FIR- " << m_deviceSampleRates.m_firRate; << " <-FIR- " << m_deviceSampleRates.m_firRate;
forwardChangeOtherDSP = true; forwardChangeOtherDSP = true;
forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate); forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force;
} }
if ((m_settings.m_log2Interp != settings.m_log2Interp) || force) if ((m_settings.m_log2Interp != settings.m_log2Interp) || force)

Wyświetl plik

@ -47,6 +47,7 @@ SDRdaemonSinkOutput::SDRdaemonSinkOutput(DeviceSinkAPI *deviceAPI) :
m_startingTimeStamp(0), m_startingTimeStamp(0),
m_masterTimer(deviceAPI->getMasterTimer()) m_masterTimer(deviceAPI->getMasterTimer())
{ {
applySettings(m_settings, true);
} }
SDRdaemonSinkOutput::~SDRdaemonSinkOutput() SDRdaemonSinkOutput::~SDRdaemonSinkOutput()

Wyświetl plik

@ -52,6 +52,8 @@ AirspyInput::AirspyInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true);
} }
AirspyInput::~AirspyInput() AirspyInput::~AirspyInput()

Wyświetl plik

@ -53,6 +53,8 @@ BladerfInput::BladerfInput(DeviceSourceAPI *deviceAPI) :
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
m_deviceAPI->setBuddySharedPtr(&m_sharedParams); m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
applySettings(m_settings, false);
} }
BladerfInput::~BladerfInput() BladerfInput::~BladerfInput()

Wyświetl plik

@ -54,6 +54,8 @@ FCDProInput::FCDProInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true);
} }
FCDProInput::~FCDProInput() FCDProInput::~FCDProInput()
@ -224,7 +226,7 @@ bool FCDProInput::handleMessage(const Message& message)
void FCDProInput::applySettings(const FCDProSettings& settings, bool force) void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
{ {
bool signalChange = false; bool forwardChange = false;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_transverterMode != settings.m_transverterMode) || (m_settings.m_transverterMode != settings.m_transverterMode)
@ -242,8 +244,9 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
qDebug() << "FCDProInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz" qDebug() << "FCDProInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"; << " device center freq: " << deviceCenterFrequency << " Hz";
forwardChange = (m_settings.m_centerFrequency != settings.m_centerFrequency) || force;
m_settings.m_centerFrequency = settings.m_centerFrequency; m_settings.m_centerFrequency = settings.m_centerFrequency;
signalChange = true;
} }
if ((m_settings.m_lnaGainIndex != settings.m_lnaGainIndex) || force) if ((m_settings.m_lnaGainIndex != settings.m_lnaGainIndex) || force)
@ -428,7 +431,7 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection); m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection);
} }
if (signalChange) if (forwardChange)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.m_centerFrequency); DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.m_centerFrequency);
m_fileSink->handleMessage(*notif); // forward to file sink m_fileSink->handleMessage(*notif); // forward to file sink

Wyświetl plik

@ -53,6 +53,8 @@ FCDProPlusInput::FCDProPlusInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true);
} }
FCDProPlusInput::~FCDProPlusInput() FCDProPlusInput::~FCDProPlusInput()
@ -218,7 +220,7 @@ bool FCDProPlusInput::handleMessage(const Message& message)
void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool force) void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool force)
{ {
bool signalChange = false; bool forwardChange = false;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_transverterMode != settings.m_transverterMode) || (m_settings.m_transverterMode != settings.m_transverterMode)
@ -236,8 +238,9 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for
qDebug() << "FCDProPlusInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz" qDebug() << "FCDProPlusInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"; << " device center freq: " << deviceCenterFrequency << " Hz";
forwardChange = (m_settings.m_centerFrequency != settings.m_centerFrequency) || force;
m_settings.m_centerFrequency = settings.m_centerFrequency; m_settings.m_centerFrequency = settings.m_centerFrequency;
signalChange = true;
} }
if ((m_settings.m_lnaGain != settings.m_lnaGain) || force) if ((m_settings.m_lnaGain != settings.m_lnaGain) || force)
@ -322,7 +325,7 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for
m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqImbalance); m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqImbalance);
} }
if (signalChange) if (forwardChange)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<ProPlus>::sampleRate, m_settings.m_centerFrequency); DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<ProPlus>::sampleRate, m_settings.m_centerFrequency);
m_fileSink->handleMessage(*notif); // forward to file sink m_fileSink->handleMessage(*notif); // forward to file sink

Wyświetl plik

@ -56,6 +56,8 @@ HackRFInput::HackRFInput(DeviceSourceAPI *deviceAPI) :
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
m_deviceAPI->setBuddySharedPtr(&m_sharedParams); m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
applySettings(m_settings, true);
} }
HackRFInput::~HackRFInput() HackRFInput::~HackRFInput()

Wyświetl plik

@ -52,6 +52,8 @@ PlutoSDRInput::PlutoSDRInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true);
} }
PlutoSDRInput::~PlutoSDRInput() PlutoSDRInput::~PlutoSDRInput()
@ -381,7 +383,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
<< " -FIR-> " << m_deviceSampleRates.m_firRate; << " -FIR-> " << m_deviceSampleRates.m_firRate;
forwardChangeOtherDSP = true; forwardChangeOtherDSP = true;
forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate); forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force;
} }
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)

Wyświetl plik

@ -59,6 +59,8 @@ RTLSDRInput::RTLSDRInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true);
} }
RTLSDRInput::~RTLSDRInput() RTLSDRInput::~RTLSDRInput()

Wyświetl plik

@ -53,6 +53,8 @@ SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr)); m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_deviceAPI->addSink(m_fileSink); m_deviceAPI->addSink(m_fileSink);
applySettings(m_settings, true, true);
} }
SDRPlayInput::~SDRPlayInput() SDRPlayInput::~SDRPlayInput()