mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Don't call start() in Demod's constructors. #2102
SSDDemodGUI: Disable AGC widgets when AGC disabled.
This commit is contained in:
parent
60db324abc
commit
c0fc8c3b73
@ -78,7 +78,6 @@ AMDemod::AMDemod(DeviceAPI *deviceAPI) :
|
||||
this,
|
||||
&AMDemod::handleIndexInDeviceSetChanged
|
||||
);
|
||||
start();
|
||||
}
|
||||
|
||||
AMDemod::~AMDemod()
|
||||
|
@ -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 ?
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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; i<ctcss_nbTones; i++) {
|
||||
ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i]));
|
||||
if (ctcss_tones)
|
||||
{
|
||||
for (int i=0; i<ctcss_nbTones; i++) {
|
||||
ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i]));
|
||||
}
|
||||
}
|
||||
|
||||
ui->dcsOn->setChecked(m_settings.m_dcsOn);
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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<<spanLog2) >= 1000; spanLog2++);
|
||||
for (; getValidAudioSampleRate() / (1<<spanLog2) >= 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<<spanLog2);
|
||||
m_spectrumRate = getValidAudioSampleRate() / (1<<spanLog2);
|
||||
int bw = ui->BW->value();
|
||||
int lw = ui->lowCut->value();
|
||||
int bwMax = m_ssbDemod->getAudioSampleRate() / (100*(1<<spanLog2));
|
||||
int bwMax = getValidAudioSampleRate() / (100*(1<<spanLog2));
|
||||
int tickInterval = m_spectrumRate / 1200;
|
||||
tickInterval = tickInterval == 0 ? 1 : tickInterval;
|
||||
|
||||
@ -636,6 +650,7 @@ void SSBDemodGUI::displaySettings()
|
||||
ui->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)
|
||||
|
@ -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*);
|
||||
|
@ -881,6 +881,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="agcTimeLog2">
|
||||
<property name="maximumSize">
|
||||
@ -925,6 +932,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="agcPowerThreshold">
|
||||
<property name="maximumSize">
|
||||
@ -969,6 +983,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="agcThresholdGate">
|
||||
<property name="maximumSize">
|
||||
@ -1126,12 +1147,24 @@
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RollupContents</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/rollupcontents.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LevelMeterSignalDB</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrum</class>
|
||||
<extends>QWidget</extends>
|
||||
@ -1144,18 +1177,6 @@
|
||||
<header>gui/glspectrumgui.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LevelMeterSignalDB</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TickedSlider</class>
|
||||
<extends>QSlider</extends>
|
||||
|
@ -78,8 +78,6 @@ VORDemod::VORDemod(DeviceAPI *deviceAPI) :
|
||||
this,
|
||||
&VORDemod::handleIndexInDeviceSetChanged
|
||||
);
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
VORDemod::~VORDemod()
|
||||
|
@ -79,7 +79,6 @@ WFMDemod::WFMDemod(DeviceAPI* deviceAPI) :
|
||||
this,
|
||||
&WFMDemod::handleIndexInDeviceSetChanged
|
||||
);
|
||||
start();
|
||||
}
|
||||
|
||||
WFMDemod::~WFMDemod()
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user