1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

DSD demod plugin: DMR refactoring: added logic for buttons to toggle slot1 and slot2 voice output

This commit is contained in:
f4exb 2016-08-31 01:18:32 +02:00
parent 045392ae79
commit ae8b3ba2af
4 changed files with 64 additions and 10 deletions

View File

@ -85,7 +85,9 @@ void DSDDemod::configure(MessageQueue* messageQueue,
Real squelch,
bool audioMute,
bool enableCosineFiltering,
bool syncOrConstellation)
bool syncOrConstellation,
bool slot1On,
bool slot2On)
{
Message* cmd = MsgConfigureDSDDemod::create(rfBandwidth,
demodGain,
@ -96,7 +98,9 @@ void DSDDemod::configure(MessageQueue* messageQueue,
squelch,
audioMute,
enableCosineFiltering,
syncOrConstellation);
syncOrConstellation,
slot1On,
slot2On);
messageQueue->push(cmd);
}
@ -266,6 +270,8 @@ bool DSDDemod::handleMessage(const Message& cmd)
m_config.m_audioMute = cfg.getAudioMute();
m_config.m_enableCosineFiltering = cfg.getEnableCosineFiltering();
m_config.m_syncOrConstellation = cfg.getSyncOrConstellation();
m_config.m_slot1On = cfg.getSlot1On();
m_config.m_slot2On = cfg.getSlot2On();
apply();
@ -278,7 +284,9 @@ bool DSDDemod::handleMessage(const Message& cmd)
<< " m_squelch: " << m_config.m_squelch
<< " m_audioMute: " << m_config.m_audioMute
<< " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering
<< " m_syncOrConstellation: " << m_config.m_syncOrConstellation;
<< " m_syncOrConstellation: " << m_config.m_syncOrConstellation
<< " m_slot1On: " << m_config.m_slot1On
<< " m_slot2On: " << m_config.m_slot2On;
return true;
}
@ -353,4 +361,6 @@ void DSDDemod::apply()
m_running.m_audioMute = m_config.m_audioMute;
m_running.m_enableCosineFiltering = m_config.m_enableCosineFiltering;
m_running.m_syncOrConstellation = m_config.m_syncOrConstellation;
m_running.m_slot1On = m_config.m_slot1On;
m_running.m_slot2On = m_config.m_slot2On;
}

View File

@ -50,7 +50,9 @@ public:
Real squelch,
bool audioMute,
bool enableCosineFiltering,
bool syncOrConstellation);
bool syncOrConstellation,
bool slot1On,
bool slot2On);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
@ -81,6 +83,8 @@ private:
bool getAudioMute() const { return m_audioMute; }
bool getEnableCosineFiltering() const { return m_enableCosineFiltering; }
bool getSyncOrConstellation() const { return m_syncOrConstellation; }
bool getSlot1On() const { return m_slot1On; }
bool getSlot2On() const { return m_slot2On; }
static MsgConfigureDSDDemod* create(int rfBandwidth,
int demodGain,
@ -91,7 +95,9 @@ private:
Real squelch,
bool audioMute,
bool enableCosineFiltering,
bool syncOrConstellation)
bool syncOrConstellation,
bool slot1On,
bool slot2On)
{
return new MsgConfigureDSDDemod(rfBandwidth,
demodGain,
@ -102,7 +108,9 @@ private:
squelch,
audioMute,
enableCosineFiltering,
syncOrConstellation);
syncOrConstellation,
slot1On,
slot2On);
}
private:
@ -116,6 +124,8 @@ private:
bool m_audioMute;
bool m_enableCosineFiltering;
bool m_syncOrConstellation;
bool m_slot1On;
bool m_slot2On;
MsgConfigureDSDDemod(int rfBandwidth,
int demodGain,
@ -126,7 +136,9 @@ private:
Real squelch,
bool audioMute,
bool enableCosineFiltering,
bool syncOrConstellation) :
bool syncOrConstellation,
bool slot1On,
bool slot2On) :
Message(),
m_rfBandwidth(rfBandwidth),
m_demodGain(demodGain),
@ -137,7 +149,9 @@ private:
m_squelch(squelch),
m_audioMute(audioMute),
m_enableCosineFiltering(enableCosineFiltering),
m_syncOrConstellation(syncOrConstellation)
m_syncOrConstellation(syncOrConstellation),
m_slot1On(slot1On),
m_slot2On(slot2On)
{ }
};
@ -166,6 +180,8 @@ private:
quint32 m_audioSampleRate;
bool m_enableCosineFiltering;
bool m_syncOrConstellation;
bool m_slot1On;
bool m_slot2On;
Config() :
m_inputSampleRate(-1),
@ -180,7 +196,9 @@ private:
m_audioMute(false),
m_audioSampleRate(0),
m_enableCosineFiltering(false),
m_syncOrConstellation(false)
m_syncOrConstellation(false),
m_slot1On(false),
m_slot2On(false)
{ }
};

View File

@ -116,6 +116,8 @@ QByteArray DSDDemodGUI::serialize() const
s.writeS32(11, ui->baudRate->currentIndex());
s.writeBool(12, m_enableCosineFiltering);
s.writeBool(13, m_syncOrConstellation);
s.writeBool(14, m_slot1On);
s.writeBool(15, m_slot2On);
return s.final();
}
@ -165,6 +167,8 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
ui->baudRate->setCurrentIndex(tmp);
d.readBool(12, &m_enableCosineFiltering, false);
d.readBool(13, &m_syncOrConstellation, false);
d.readBool(14, &m_slot1On, false);
d.readBool(15, &m_slot2On, false);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@ -251,6 +255,18 @@ void DSDDemodGUI::on_syncOrConstellation_toggled(bool checked)
applySettings();
}
void DSDDemodGUI::on_slot1On_toggled(bool checked)
{
m_slot1On = checked;
applySettings();
}
void DSDDemodGUI::on_slot2On_toggled(bool checked)
{
m_slot2On = checked;
applySettings();
}
void DSDDemodGUI::on_squelchGate_valueChanged(int value)
{
applySettings();
@ -297,6 +313,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa
m_signalFormat(signalFormatNone),
m_enableCosineFiltering(false),
m_syncOrConstellation(false),
m_slot1On(false),
m_slot2On(false),
m_squelchOpen(false),
m_channelPowerDbAvg(20,0),
m_tickCount(0)
@ -373,6 +391,8 @@ void DSDDemodGUI::applySettings()
ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1));
ui->enableCosineFiltering->setChecked(m_enableCosineFiltering);
ui->syncOrConstellation->setChecked(m_syncOrConstellation);
ui->slot1On->setChecked(m_slot1On);
ui->slot2On->setChecked(m_slot2On);
m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(),
ui->rfBW->value(),
@ -384,7 +404,9 @@ void DSDDemodGUI::applySettings()
ui->squelch->value(),
ui->audioMute->isChecked(),
m_enableCosineFiltering,
m_syncOrConstellation);
m_syncOrConstellation,
m_slot1On,
m_slot2On);
}
}

View File

@ -67,6 +67,8 @@ private slots:
void on_baudRate_currentIndexChanged(int index);
void on_enableCosineFiltering_toggled(bool enable);
void on_syncOrConstellation_toggled(bool checked);
void on_slot1On_toggled(bool checked);
void on_slot2On_toggled(bool checked);
void on_fmDeviation_valueChanged(int value);
void on_squelchGate_valueChanged(int value);
void on_squelch_valueChanged(int value);
@ -100,6 +102,8 @@ private:
DSDDemod* m_dsdDemod;
bool m_enableCosineFiltering;
bool m_syncOrConstellation;
bool m_slot1On;
bool m_slot2On;
bool m_audioMute;
bool m_squelchOpen;
MovingAverage<Real> m_channelPowerDbAvg;