diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 4ec996a92..5f3bf9eed 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -78,7 +78,6 @@ AMDemod::AMDemod(DeviceAPI *deviceAPI) : this, &AMDemod::handleIndexInDeviceSetChanged ); - start(); } AMDemod::~AMDemod() diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index ab475ee79..078d25f43 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -78,8 +78,6 @@ NFMDemod::NFMDemod(DeviceAPI *devieAPI) : this, &NFMDemod::handleIndexInDeviceSetChanged ); - - start(); } NFMDemod::~NFMDemod() @@ -593,11 +591,11 @@ void NFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples); response.getNfmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); - int nbCtcssToneFrequencies; if (m_running) { - const Real *ctcssToneFrequencies = m_basebandSink->getCtcssToneSet(nbCtcssToneFrequencies); + int nbCtcssToneFrequencies = CTCSSDetector::getNTones(); + const Real *ctcssToneFrequencies = CTCSSDetector::getToneSet(); response.getNfmDemodReport()->setCtcssTone( m_settings.m_ctcssOn ? m_settings.m_ctcssIndex < 0 ? diff --git a/plugins/channelrx/demodnfm/nfmdemod.h b/plugins/channelrx/demodnfm/nfmdemod.h index 14ca52d10..8d1504795 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.h +++ b/plugins/channelrx/demodnfm/nfmdemod.h @@ -124,7 +124,6 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - const Real *getCtcssToneSet(int& nbTones) const { return m_running ? m_basebandSink->getCtcssToneSet(nbTones) : nullptr; } bool getSquelchOpen() const { return m_running && m_basebandSink->getSquelchOpen(); } void getMagSqLevels(double& avg, double& peak, int& nbSamples) diff --git a/plugins/channelrx/demodnfm/nfmdemodbaseband.h b/plugins/channelrx/demodnfm/nfmdemodbaseband.h index 257639257..9e5505ee8 100644 --- a/plugins/channelrx/demodnfm/nfmdemodbaseband.h +++ b/plugins/channelrx/demodnfm/nfmdemodbaseband.h @@ -66,7 +66,6 @@ public: int getChannelSampleRate() const; void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_sink.getMagSqLevels(avg, peak, nbSamples); } bool getSquelchOpen() const { return m_sink.getSquelchOpen(); } - const Real *getCtcssToneSet(int& nbTones) const { return m_sink.getCtcssToneSet(nbTones); } void setMessageQueueToGUI(MessageQueue *messageQueue) { m_sink.setMessageQueueToGUI(messageQueue); } int getAudioSampleRate() const { return m_sink.getAudioSampleRate(); } void setBasebandSampleRate(int sampleRate); diff --git a/plugins/channelrx/demodnfm/nfmdemodgui.cpp b/plugins/channelrx/demodnfm/nfmdemodgui.cpp index f581cdbbc..2a09aa779 100644 --- a/plugins/channelrx/demodnfm/nfmdemodgui.cpp +++ b/plugins/channelrx/demodnfm/nfmdemodgui.cpp @@ -407,13 +407,16 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban ui->channelSpacing->setCurrentIndex(NFMDemodSettings::getChannelSpacingIndex(12500)); - int ctcss_nbTones; - const Real *ctcss_tones = m_nfmDemod->getCtcssToneSet(ctcss_nbTones); + int ctcss_nbTones = CTCSSDetector::getNTones(); + const Real *ctcss_tones = CTCSSDetector::getToneSet(); ui->ctcss->addItem("--"); - for (int i=0; ictcss->addItem(QString("%1").arg(ctcss_tones[i])); + if (ctcss_tones) + { + for (int i=0; ictcss->addItem(QString("%1").arg(ctcss_tones[i])); + } } ui->dcsOn->setChecked(m_settings.m_dcsOn); diff --git a/plugins/channelrx/demodnfm/nfmdemodsink.h b/plugins/channelrx/demodnfm/nfmdemodsink.h index 04b9225d1..5a1ae19ee 100644 --- a/plugins/channelrx/demodnfm/nfmdemodsink.h +++ b/plugins/channelrx/demodnfm/nfmdemodsink.h @@ -45,11 +45,6 @@ public: virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); - const Real *getCtcssToneSet(int& nbTones) const { - nbTones = m_ctcssDetector.getNTones(); - return m_ctcssDetector.getToneSet(); - } - bool getSquelchOpen() const { return m_squelchOpen; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 9306b65fc..2a5b445b2 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -54,6 +54,8 @@ const char* const SSBDemod::m_channelId = "SSBDemod"; SSBDemod::SSBDemod(DeviceAPI *deviceAPI) : ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), + m_thread(nullptr), + m_basebandSink(nullptr), m_running(false), m_spectrumVis(SDR_RX_SCALEF), m_basebandSampleRate(0) @@ -78,8 +80,6 @@ SSBDemod::SSBDemod(DeviceAPI *deviceAPI) : this, &SSBDemod::handleIndexInDeviceSetChanged ); - - start(); } SSBDemod::~SSBDemod() diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index ea969e5e1..a1df51f06 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -202,6 +202,7 @@ void SSBDemodGUI::on_agc_toggled(bool checked) { m_settings.m_agc = checked; applySettings(); + displayAGC(); } void SSBDemodGUI::on_agcClamping_toggled(bool checked) @@ -440,6 +441,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban displaySettings(); makeUIConnections(); + qDebug() << "********************" << m_settings.m_filterBank.size() << m_settings.m_filterIndex; + qDebug() << "*********** " << m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2; applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) DialPopup::addPopupsToChildDials(this); m_resizer.enableChildMouseTracking(); @@ -466,10 +469,21 @@ void SSBDemodGUI::applySettings(bool force) } } +uint32_t SSBDemodGUI::getValidAudioSampleRate() const +{ + // When not running, m_ssbDemod->getAudioSampleRate() will return 0, but we + // want a valid value to initialise the GUI + int sr = m_ssbDemod->getAudioSampleRate(); + if (sr == 0) { + sr = 48000; + } + return sr; +} + unsigned int SSBDemodGUI::spanLog2Max() { unsigned int spanLog2 = 0; - for (; m_ssbDemod->getAudioSampleRate() / (1<= 1000; spanLog2++); + for (; getValidAudioSampleRate() / (1<= 1000; spanLog2++); return spanLog2 == 0 ? 0 : spanLog2-1; } @@ -481,10 +495,10 @@ void SSBDemodGUI::applyBandwidths(unsigned int spanLog2, bool force) ui->spanLog2->setMaximum(limit); bool dsb = ui->dsb->isChecked(); //int spanLog2 = ui->spanLog2->value(); - m_spectrumRate = m_ssbDemod->getAudioSampleRate() / (1<BW->value(); int lw = ui->lowCut->value(); - int bwMax = m_ssbDemod->getAudioSampleRate() / (100*(1<deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->agc->setChecked(m_settings.m_agc); + displayAGC(); ui->agcClamping->setChecked(m_settings.m_agcClamping); ui->dnr->setChecked(m_settings.m_dnr); ui->audioBinaural->setChecked(m_settings.m_audioBinaural); @@ -694,6 +709,18 @@ void SSBDemodGUI::displaySettings() blockApplySettings(false); } +void SSBDemodGUI::displayAGC() +{ + // Disable controls only valid when AGC is enabled + ui->agcClamping->setEnabled(m_settings.m_agc); + ui->agcTimeLog2->setEnabled(m_settings.m_agc); + ui->agcTimeText->setEnabled(m_settings.m_agc); + ui->agcPowerThreshold->setEnabled(m_settings.m_agc); + ui->agcPowerThresholdText->setEnabled(m_settings.m_agc); + ui->agcThresholdGate->setEnabled(m_settings.m_agc); + ui->agcThresholdGateText->setEnabled(m_settings.m_agc); +} + void SSBDemodGUI::displayAGCPowerThreshold(int value) { if (value == SSBDemodSettings::m_minPowerThresholdDB) diff --git a/plugins/channelrx/demodssb/ssbdemodgui.h b/plugins/channelrx/demodssb/ssbdemodgui.h index d4eeaae51..9fa2a9ae7 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.h +++ b/plugins/channelrx/demodssb/ssbdemodgui.h @@ -102,11 +102,13 @@ private: void applyBandwidths(unsigned int spanLog2, bool force = false); unsigned int spanLog2Max(); void displaySettings(); + void displayAGC(); void displayAGCPowerThreshold(int value); void displayAGCThresholdGate(int value); bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); + uint32_t getValidAudioSampleRate() const; void leaveEvent(QEvent*); void enterEvent(EnterEventType*); diff --git a/plugins/channelrx/demodssb/ssbdemodgui.ui b/plugins/channelrx/demodssb/ssbdemodgui.ui index 75b58f549..c37d0ded0 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.ui +++ b/plugins/channelrx/demodssb/ssbdemodgui.ui @@ -881,6 +881,13 @@ + + + + Qt::Vertical + + + @@ -925,6 +932,13 @@ + + + + Qt::Vertical + + + @@ -969,6 +983,13 @@ + + + + Qt::Vertical + + + @@ -1126,12 +1147,24 @@ QToolButton
gui/buttonswitch.h
+ + ValueDialZ + QWidget +
gui/valuedialz.h
+ 1 +
RollupContents QWidget
gui/rollupcontents.h
1
+ + LevelMeterSignalDB + QWidget +
gui/levelmeter.h
+ 1 +
GLSpectrum QWidget @@ -1144,18 +1177,6 @@
gui/glspectrumgui.h
1
- - ValueDialZ - QWidget -
gui/valuedialz.h
- 1 -
- - LevelMeterSignalDB - QWidget -
gui/levelmeter.h
- 1 -
TickedSlider QSlider diff --git a/plugins/channelrx/demodvor/vordemod.cpp b/plugins/channelrx/demodvor/vordemod.cpp index 06f830abd..769dcc41f 100644 --- a/plugins/channelrx/demodvor/vordemod.cpp +++ b/plugins/channelrx/demodvor/vordemod.cpp @@ -78,8 +78,6 @@ VORDemod::VORDemod(DeviceAPI *deviceAPI) : this, &VORDemod::handleIndexInDeviceSetChanged ); - - start(); } VORDemod::~VORDemod() diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index 0254195ba..a92a104d2 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -79,7 +79,6 @@ WFMDemod::WFMDemod(DeviceAPI* deviceAPI) : this, &WFMDemod::handleIndexInDeviceSetChanged ); - start(); } WFMDemod::~WFMDemod() diff --git a/sdrbase/dsp/ctcssdetector.h b/sdrbase/dsp/ctcssdetector.h index e8ec835d0..d2304c0bf 100644 --- a/sdrbase/dsp/ctcssdetector.h +++ b/sdrbase/dsp/ctcssdetector.h @@ -46,12 +46,12 @@ public: bool analyze(Real *sample); // input signal sample // get the number of defined tones. - int getNTones() const { + static int getNTones() { return CTCSSFrequencies::m_nbFreqs; } // get the tone set - const Real *getToneSet() const { + static const Real *getToneSet() { return CTCSSFrequencies::m_Freqs; }