1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

AM Demodulator: removed useless AF lowpass filtering and its associated GUI items

This commit is contained in:
f4exb 2016-11-30 16:42:06 +01:00
parent fccdb57f23
commit 47eb55a319
8 changed files with 27 additions and 108 deletions

View File

@ -36,8 +36,7 @@ AMDemod::AMDemod() :
m_config.m_inputSampleRate = 96000; m_config.m_inputSampleRate = 96000;
m_config.m_inputFrequencyOffset = 0; m_config.m_inputFrequencyOffset = 0;
m_config.m_rfBandwidth = 12500; m_config.m_rfBandwidth = 5000;
m_config.m_afBandwidth = 3000;
m_config.m_squelch = -40.0; m_config.m_squelch = -40.0;
m_config.m_volume = 2.0; m_config.m_volume = 2.0;
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate(); m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
@ -59,9 +58,9 @@ AMDemod::~AMDemod()
DSPEngine::instance()->removeAudioSink(&m_audioFifo); DSPEngine::instance()->removeAudioSink(&m_audioFifo);
} }
void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real volume, Real squelch, bool audioMute)
{ {
Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioMute); Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, volume, squelch, audioMute);
messageQueue->push(cmd); messageQueue->push(cmd);
} }
@ -150,7 +149,6 @@ bool AMDemod::handleMessage(const Message& cmd)
MsgConfigureAMDemod& cfg = (MsgConfigureAMDemod&) cmd; MsgConfigureAMDemod& cfg = (MsgConfigureAMDemod&) cmd;
m_config.m_rfBandwidth = cfg.getRFBandwidth(); m_config.m_rfBandwidth = cfg.getRFBandwidth();
m_config.m_afBandwidth = cfg.getAFBandwidth();
m_config.m_volume = cfg.getVolume(); m_config.m_volume = cfg.getVolume();
m_config.m_squelch = cfg.getSquelch(); m_config.m_squelch = cfg.getSquelch();
m_config.m_audioMute = cfg.getAudioMute(); m_config.m_audioMute = cfg.getAudioMute();
@ -159,7 +157,6 @@ bool AMDemod::handleMessage(const Message& cmd)
qDebug() << "AMDemod::handleMessage: MsgConfigureAMDemod:" qDebug() << "AMDemod::handleMessage: MsgConfigureAMDemod:"
<< " m_rfBandwidth: " << m_config.m_rfBandwidth << " m_rfBandwidth: " << m_config.m_rfBandwidth
<< " m_afBandwidth: " << m_config.m_afBandwidth
<< " m_volume: " << m_config.m_volume << " m_volume: " << m_config.m_volume
<< " m_squelch: " << m_config.m_squelch << " m_squelch: " << m_config.m_squelch
<< " m_audioMute: " << m_config.m_audioMute; << " m_audioMute: " << m_config.m_audioMute;
@ -182,7 +179,8 @@ void AMDemod::apply()
} }
if((m_config.m_inputSampleRate != m_running.m_inputSampleRate) || if((m_config.m_inputSampleRate != m_running.m_inputSampleRate) ||
(m_config.m_rfBandwidth != m_running.m_rfBandwidth)) (m_config.m_rfBandwidth != m_running.m_rfBandwidth) ||
(m_config.m_audioSampleRate != m_running.m_audioSampleRate))
{ {
m_settingsMutex.lock(); m_settingsMutex.lock();
m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_rfBandwidth / 2.2); m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_rfBandwidth / 2.2);
@ -191,14 +189,6 @@ void AMDemod::apply()
m_settingsMutex.unlock(); m_settingsMutex.unlock();
} }
if((m_config.m_afBandwidth != m_running.m_afBandwidth) ||
(m_config.m_audioSampleRate != m_running.m_audioSampleRate))
{
m_settingsMutex.lock();
m_lowpass.create(21, m_config.m_audioSampleRate, m_config.m_afBandwidth);
m_settingsMutex.unlock();
}
if(m_config.m_squelch != m_running.m_squelch) if(m_config.m_squelch != m_running.m_squelch)
{ {
m_squelchLevel = pow(10.0, m_config.m_squelch / 20.0); m_squelchLevel = pow(10.0, m_config.m_squelch / 20.0);
@ -208,7 +198,6 @@ void AMDemod::apply()
m_running.m_inputSampleRate = m_config.m_inputSampleRate; m_running.m_inputSampleRate = m_config.m_inputSampleRate;
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset; m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
m_running.m_rfBandwidth = m_config.m_rfBandwidth; m_running.m_rfBandwidth = m_config.m_rfBandwidth;
m_running.m_afBandwidth = m_config.m_afBandwidth;
m_running.m_squelch = m_config.m_squelch; m_running.m_squelch = m_config.m_squelch;
m_running.m_volume = m_config.m_volume; m_running.m_volume = m_config.m_volume;
m_running.m_audioSampleRate = m_config.m_audioSampleRate; m_running.m_audioSampleRate = m_config.m_audioSampleRate;

View File

@ -22,7 +22,6 @@
#include <vector> #include <vector>
#include "dsp/nco.h" #include "dsp/nco.h"
#include "dsp/interpolator.h" #include "dsp/interpolator.h"
#include "dsp/lowpass.h"
#include "dsp/movingaverage.h" #include "dsp/movingaverage.h"
#include "dsp/agc.h" #include "dsp/agc.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
@ -34,7 +33,7 @@ public:
AMDemod(); AMDemod();
~AMDemod(); ~AMDemod();
void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute); void configure(MessageQueue* messageQueue, Real rfBandwidth, Real volume, Real squelch, bool audioMute);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start(); virtual void start();
@ -50,27 +49,24 @@ private:
public: public:
Real getRFBandwidth() const { return m_rfBandwidth; } Real getRFBandwidth() const { return m_rfBandwidth; }
Real getAFBandwidth() const { return m_afBandwidth; }
Real getVolume() const { return m_volume; } Real getVolume() const { return m_volume; }
Real getSquelch() const { return m_squelch; } Real getSquelch() const { return m_squelch; }
bool getAudioMute() const { return m_audioMute; } bool getAudioMute() const { return m_audioMute; }
static MsgConfigureAMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) static MsgConfigureAMDemod* create(Real rfBandwidth, Real volume, Real squelch, bool audioMute)
{ {
return new MsgConfigureAMDemod(rfBandwidth, afBandwidth, volume, squelch, audioMute); return new MsgConfigureAMDemod(rfBandwidth, volume, squelch, audioMute);
} }
private: private:
Real m_rfBandwidth; Real m_rfBandwidth;
Real m_afBandwidth;
Real m_volume; Real m_volume;
Real m_squelch; Real m_squelch;
bool m_audioMute; bool m_audioMute;
MsgConfigureAMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) : MsgConfigureAMDemod(Real rfBandwidth, Real volume, Real squelch, bool audioMute) :
Message(), Message(),
m_rfBandwidth(rfBandwidth), m_rfBandwidth(rfBandwidth),
m_afBandwidth(afBandwidth),
m_volume(volume), m_volume(volume),
m_squelch(squelch), m_squelch(squelch),
m_audioMute(audioMute) m_audioMute(audioMute)
@ -92,7 +88,6 @@ private:
int m_inputSampleRate; int m_inputSampleRate;
qint64 m_inputFrequencyOffset; qint64 m_inputFrequencyOffset;
Real m_rfBandwidth; Real m_rfBandwidth;
Real m_afBandwidth;
Real m_squelch; Real m_squelch;
Real m_volume; Real m_volume;
quint32 m_audioSampleRate; quint32 m_audioSampleRate;
@ -102,7 +97,6 @@ private:
m_inputSampleRate(-1), m_inputSampleRate(-1),
m_inputFrequencyOffset(0), m_inputFrequencyOffset(0),
m_rfBandwidth(-1), m_rfBandwidth(-1),
m_afBandwidth(-1),
m_squelch(0), m_squelch(0),
m_volume(0), m_volume(0),
m_audioSampleRate(0), m_audioSampleRate(0),
@ -117,7 +111,6 @@ private:
Interpolator m_interpolator; Interpolator m_interpolator;
Real m_interpolatorDistance; Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain; Real m_interpolatorDistanceRemain;
Lowpass<Real> m_lowpass;
Real m_squelchLevel; Real m_squelchLevel;
int m_squelchCount; int m_squelchCount;
@ -163,8 +156,6 @@ private:
{ {
Real demod = sqrt(magsq); Real demod = sqrt(magsq);
demod = m_lowpass.filter(demod);
if (demod < -1) if (demod < -1)
{ {
demod = -1; demod = -1;

View File

@ -35,10 +35,6 @@
const QString AMDemodGUI::m_channelID = "de.maintech.sdrangelove.channel.am"; const QString AMDemodGUI::m_channelID = "de.maintech.sdrangelove.channel.am";
const int AMDemodGUI::m_rfBW[] = {
3000, 4000, 5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000
};
AMDemodGUI* AMDemodGUI::create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI) AMDemodGUI* AMDemodGUI::create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI)
{ {
AMDemodGUI* gui = new AMDemodGUI(pluginAPI, deviceAPI); AMDemodGUI* gui = new AMDemodGUI(pluginAPI, deviceAPI);
@ -74,8 +70,7 @@ void AMDemodGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->rfBW->setValue(4); ui->rfBW->setValue(50);
ui->afBW->setValue(3);
ui->volume->setValue(20); ui->volume->setValue(20);
ui->squelch->setValue(-40); ui->squelch->setValue(-40);
ui->deltaFrequency->setValue(0); ui->deltaFrequency->setValue(0);
@ -89,7 +84,7 @@ QByteArray AMDemodGUI::serialize() const
SimpleSerializer s(1); SimpleSerializer s(1);
s.writeS32(1, m_channelMarker.getCenterFrequency()); s.writeS32(1, m_channelMarker.getCenterFrequency());
s.writeS32(2, ui->rfBW->value()); s.writeS32(2, ui->rfBW->value());
s.writeS32(3, ui->afBW->value()); //s.writeS32(3, ui->afBW->value());
s.writeS32(4, ui->volume->value()); s.writeS32(4, ui->volume->value());
s.writeS32(5, ui->squelch->value()); s.writeS32(5, ui->squelch->value());
s.writeU32(7, m_channelMarker.getColor().rgb()); s.writeU32(7, m_channelMarker.getColor().rgb());
@ -120,7 +115,7 @@ bool AMDemodGUI::deserialize(const QByteArray& data)
d.readS32(2, &tmp, 4); d.readS32(2, &tmp, 4);
ui->rfBW->setValue(tmp); ui->rfBW->setValue(tmp);
d.readS32(3, &tmp, 3); d.readS32(3, &tmp, 3);
ui->afBW->setValue(tmp); //ui->afBW->setValue(tmp);
d.readS32(4, &tmp, 20); d.readS32(4, &tmp, 20);
ui->volume->setValue(tmp); ui->volume->setValue(tmp);
d.readS32(5, &tmp, -40); d.readS32(5, &tmp, -40);
@ -176,14 +171,8 @@ void AMDemodGUI::on_deltaFrequency_changed(quint64 value)
void AMDemodGUI::on_rfBW_valueChanged(int value) void AMDemodGUI::on_rfBW_valueChanged(int value)
{ {
ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0)); ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0));
m_channelMarker.setBandwidth(m_rfBW[value]); m_channelMarker.setBandwidth(value * 100);
applySettings();
}
void AMDemodGUI::on_afBW_valueChanged(int value)
{
ui->afBWText->setText(QString("%1 kHz").arg(value));
applySettings(); applySettings();
} }
@ -249,7 +238,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
//m_channelMarker = new ChannelMarker(this); //m_channelMarker = new ChannelMarker(this);
m_channelMarker.setColor(Qt::yellow); m_channelMarker.setColor(Qt::yellow);
m_channelMarker.setBandwidth(12500); m_channelMarker.setBandwidth(5000);
m_channelMarker.setCenterFrequency(0); m_channelMarker.setCenterFrequency(0);
m_channelMarker.setVisible(true); m_channelMarker.setVisible(true);
@ -292,8 +281,7 @@ void AMDemodGUI::applySettings()
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0); ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
m_amDemod->configure(m_amDemod->getInputMessageQueue(), m_amDemod->configure(m_amDemod->getInputMessageQueue(),
m_rfBW[ui->rfBW->value()], ui->rfBW->value() * 100.0,
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0, ui->volume->value() / 10.0,
ui->squelch->value(), ui->squelch->value(),
ui->audioMute->isChecked()); ui->audioMute->isChecked());

View File

@ -42,7 +42,6 @@ private slots:
void on_deltaFrequency_changed(quint64 value); void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_toggled(bool minus); void on_deltaMinus_toggled(bool minus);
void on_rfBW_valueChanged(int value); void on_rfBW_valueChanged(int value);
void on_afBW_valueChanged(int value);
void on_volume_valueChanged(int value); void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value); void on_squelch_valueChanged(int value);
void on_audioMute_toggled(bool checked); void on_audioMute_toggled(bool checked);
@ -64,8 +63,6 @@ private:
MovingAverage<Real> m_channelPowerDbAvg; MovingAverage<Real> m_channelPowerDbAvg;
bool m_squelchOpen; bool m_squelchOpen;
static const int m_rfBW[];
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL); explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~AMDemodGUI(); virtual ~AMDemodGUI();

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>257</width> <width>257</width>
<height>143</height> <height>131</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -28,7 +28,7 @@
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>235</width> <width>235</width>
<height>121</height> <height>111</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -184,14 +184,17 @@
<property name="toolTip"> <property name="toolTip">
<string>Demodulator (RF) bandwidth</string> <string>Demodulator (RF) bandwidth</string>
</property> </property>
<property name="maximum"> <property name="minimum">
<number>10</number> <number>10</number>
</property> </property>
<property name="maximum">
<number>200</number>
</property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>6</number> <number>50</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -207,56 +210,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>12.5kHz</string> <string>5 kHz</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="afBandwidthLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>AF BW</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="afBW">
<property name="toolTip">
<string>Audio bandwidth</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>20</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="afBWText">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>3 kHz</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -398,6 +352,7 @@
<include location="../../../sdrbase/resources/res.qrc"/> <include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/> <include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/> <include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -7,7 +7,7 @@
const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = { const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = {
QString("AM Demodulator"), QString("AM Demodulator"),
QString("2.3.1"), QString("2.4.0"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,

View File

@ -25,7 +25,6 @@
#include "dsp/basebandsamplesource.h" #include "dsp/basebandsamplesource.h"
#include "dsp/nco.h" #include "dsp/nco.h"
#include "dsp/interpolator.h" #include "dsp/interpolator.h"
#include "dsp/lowpass.h"
#include "dsp/movingaverage.h" #include "dsp/movingaverage.h"
#include "dsp/agc.h" #include "dsp/agc.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"

View File

@ -334,7 +334,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pare
//m_channelMarker = new ChannelMarker(this); //m_channelMarker = new ChannelMarker(this);
m_channelMarker.setColor(Qt::yellow); m_channelMarker.setColor(Qt::yellow);
m_channelMarker.setBandwidth(12500); m_channelMarker.setBandwidth(5000);
m_channelMarker.setCenterFrequency(0); m_channelMarker.setCenterFrequency(0);
m_channelMarker.setVisible(true); m_channelMarker.setVisible(true);