mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	AM Modulator: removed useless AF lowpass filtering and its associated GUI items
This commit is contained in:
		
							parent
							
								
									bde6b78d24
								
							
						
					
					
						commit
						fccdb57f23
					
				@ -47,7 +47,6 @@ AMMod::AMMod() :
 | 
			
		||||
	m_config.m_outputSampleRate = 48000;
 | 
			
		||||
	m_config.m_inputFrequencyOffset = 0;
 | 
			
		||||
	m_config.m_rfBandwidth = 12500;
 | 
			
		||||
	m_config.m_afBandwidth = 3000;
 | 
			
		||||
	m_config.m_modFactor = 20;
 | 
			
		||||
	m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
 | 
			
		||||
 | 
			
		||||
@ -71,13 +70,12 @@ AMMod::~AMMod()
 | 
			
		||||
 | 
			
		||||
void AMMod::configure(MessageQueue* messageQueue,
 | 
			
		||||
		Real rfBandwidth,
 | 
			
		||||
		Real afBandwidth,
 | 
			
		||||
		float modFactor,
 | 
			
		||||
		int volumeTenths,
 | 
			
		||||
		bool audioMute,
 | 
			
		||||
		bool playLoop)
 | 
			
		||||
{
 | 
			
		||||
	Message* cmd = MsgConfigureAMMod::create(rfBandwidth, afBandwidth, modFactor, volumeTenths, audioMute, playLoop);
 | 
			
		||||
	Message* cmd = MsgConfigureAMMod::create(rfBandwidth, modFactor, volumeTenths, audioMute, playLoop);
 | 
			
		||||
	messageQueue->push(cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -210,7 +208,6 @@ bool AMMod::handleMessage(const Message& cmd)
 | 
			
		||||
		MsgConfigureAMMod& cfg = (MsgConfigureAMMod&) cmd;
 | 
			
		||||
 | 
			
		||||
		m_config.m_rfBandwidth = cfg.getRFBandwidth();
 | 
			
		||||
		m_config.m_afBandwidth = cfg.getAFBandwidth();
 | 
			
		||||
		m_config.m_modFactor = cfg.getModFactor();
 | 
			
		||||
		m_config.m_volumeFactor = cfg.getVolumeFactor();
 | 
			
		||||
		m_config.m_audioMute = cfg.getAudioMute();
 | 
			
		||||
@ -220,7 +217,6 @@ bool AMMod::handleMessage(const Message& cmd)
 | 
			
		||||
 | 
			
		||||
		qDebug() << "AMMod::handleMessage: MsgConfigureAMMod:"
 | 
			
		||||
				<< " m_rfBandwidth: " << m_config.m_rfBandwidth
 | 
			
		||||
				<< " m_afBandwidth: " << m_config.m_afBandwidth
 | 
			
		||||
				<< " m_modFactor: " << m_config.m_modFactor
 | 
			
		||||
                << " m_volumeFactor: " << m_config.m_volumeFactor
 | 
			
		||||
				<< " m_audioMute: " << m_config.m_audioMute
 | 
			
		||||
@ -284,7 +280,8 @@ void AMMod::apply()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if((m_config.m_outputSampleRate != m_running.m_outputSampleRate) ||
 | 
			
		||||
		(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_interpolatorDistanceRemain = 0;
 | 
			
		||||
@ -294,18 +291,9 @@ void AMMod::apply()
 | 
			
		||||
		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();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m_running.m_outputSampleRate = m_config.m_outputSampleRate;
 | 
			
		||||
	m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
 | 
			
		||||
	m_running.m_rfBandwidth = m_config.m_rfBandwidth;
 | 
			
		||||
	m_running.m_afBandwidth = m_config.m_afBandwidth;
 | 
			
		||||
	m_running.m_modFactor = m_config.m_modFactor;
 | 
			
		||||
    m_running.m_volumeFactor = m_config.m_volumeFactor;
 | 
			
		||||
	m_running.m_audioSampleRate = m_config.m_audioSampleRate;
 | 
			
		||||
 | 
			
		||||
@ -174,7 +174,7 @@ public:
 | 
			
		||||
    AMMod();
 | 
			
		||||
    ~AMMod();
 | 
			
		||||
 | 
			
		||||
    void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop);
 | 
			
		||||
    void configure(MessageQueue* messageQueue, Real rfBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop);
 | 
			
		||||
 | 
			
		||||
    virtual void pull(Sample& sample);
 | 
			
		||||
    virtual void start();
 | 
			
		||||
@ -190,29 +190,26 @@ private:
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        Real getRFBandwidth() const { return m_rfBandwidth; }
 | 
			
		||||
        Real getAFBandwidth() const { return m_afBandwidth; }
 | 
			
		||||
        float getModFactor() const { return m_modFactor; }
 | 
			
		||||
        int getVolumeFactor() const { return m_volumeFactor; }
 | 
			
		||||
        bool getAudioMute() const { return m_audioMute; }
 | 
			
		||||
        bool getPlayLoop() const { return m_playLoop; }
 | 
			
		||||
 | 
			
		||||
        static MsgConfigureAMMod* create(Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop)
 | 
			
		||||
        static MsgConfigureAMMod* create(Real rfBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop)
 | 
			
		||||
        {
 | 
			
		||||
            return new MsgConfigureAMMod(rfBandwidth, afBandwidth, modFactor, volumeFactor, audioMute, playLoop);
 | 
			
		||||
            return new MsgConfigureAMMod(rfBandwidth, modFactor, volumeFactor, audioMute, playLoop);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    private:
 | 
			
		||||
        Real m_rfBandwidth;
 | 
			
		||||
        Real m_afBandwidth;
 | 
			
		||||
        float m_modFactor;
 | 
			
		||||
        int m_volumeFactor;
 | 
			
		||||
        bool m_audioMute;
 | 
			
		||||
        bool m_playLoop;
 | 
			
		||||
 | 
			
		||||
        MsgConfigureAMMod(Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop) :
 | 
			
		||||
        MsgConfigureAMMod(Real rfBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop) :
 | 
			
		||||
            Message(),
 | 
			
		||||
            m_rfBandwidth(rfBandwidth),
 | 
			
		||||
            m_afBandwidth(afBandwidth),
 | 
			
		||||
            m_modFactor(modFactor),
 | 
			
		||||
            m_volumeFactor(volumeFactor),
 | 
			
		||||
            m_audioMute(audioMute),
 | 
			
		||||
@ -237,7 +234,6 @@ private:
 | 
			
		||||
        int m_outputSampleRate;
 | 
			
		||||
        qint64 m_inputFrequencyOffset;
 | 
			
		||||
        Real m_rfBandwidth;
 | 
			
		||||
        Real m_afBandwidth;
 | 
			
		||||
        float m_modFactor;
 | 
			
		||||
        int m_volumeFactor;
 | 
			
		||||
        quint32 m_audioSampleRate;
 | 
			
		||||
@ -248,7 +244,6 @@ private:
 | 
			
		||||
            m_outputSampleRate(-1),
 | 
			
		||||
            m_inputFrequencyOffset(0),
 | 
			
		||||
            m_rfBandwidth(-1),
 | 
			
		||||
            m_afBandwidth(-1),
 | 
			
		||||
            m_modFactor(0.2f),
 | 
			
		||||
            m_volumeFactor(20),
 | 
			
		||||
            m_audioSampleRate(0),
 | 
			
		||||
@ -269,7 +264,6 @@ private:
 | 
			
		||||
    Real m_interpolatorDistance;
 | 
			
		||||
    Real m_interpolatorDistanceRemain;
 | 
			
		||||
    bool m_interpolatorConsumed;
 | 
			
		||||
    Lowpass<Real> m_lowpass;
 | 
			
		||||
 | 
			
		||||
    Real m_magsq;
 | 
			
		||||
    MovingAverage<Real> m_movingAverage;
 | 
			
		||||
 | 
			
		||||
@ -36,10 +36,6 @@
 | 
			
		||||
 | 
			
		||||
const QString AMModGUI::m_channelID = "sdrangel.channeltx.modam";
 | 
			
		||||
 | 
			
		||||
const int AMModGUI::m_rfBW[] = {
 | 
			
		||||
	3000, 4000, 5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI)
 | 
			
		||||
{
 | 
			
		||||
	AMModGUI* gui = new AMModGUI(pluginAPI, deviceAPI);
 | 
			
		||||
@ -74,8 +70,7 @@ void AMModGUI::resetToDefaults()
 | 
			
		||||
{
 | 
			
		||||
	blockApplySettings(true);
 | 
			
		||||
 | 
			
		||||
	ui->rfBW->setValue(6);
 | 
			
		||||
	ui->afBW->setValue(3);
 | 
			
		||||
	ui->rfBW->setValue(50);
 | 
			
		||||
	ui->modPercent->setValue(20);
 | 
			
		||||
	ui->micVolume->setValue(50);
 | 
			
		||||
	ui->deltaFrequency->setValue(0);
 | 
			
		||||
@ -89,7 +84,7 @@ QByteArray AMModGUI::serialize() const
 | 
			
		||||
	SimpleSerializer s(1);
 | 
			
		||||
	s.writeS32(1, m_channelMarker.getCenterFrequency());
 | 
			
		||||
	s.writeS32(2, ui->rfBW->value());
 | 
			
		||||
	s.writeS32(3, ui->afBW->value());
 | 
			
		||||
	//s.writeS32(3, ui->afBW->value());
 | 
			
		||||
	s.writeS32(4, ui->modPercent->value());
 | 
			
		||||
	s.writeU32(5, m_channelMarker.getColor().rgb());
 | 
			
		||||
	return s.final();
 | 
			
		||||
@ -119,7 +114,7 @@ bool AMModGUI::deserialize(const QByteArray& data)
 | 
			
		||||
		d.readS32(2, &tmp, 4);
 | 
			
		||||
		ui->rfBW->setValue(tmp);
 | 
			
		||||
		d.readS32(3, &tmp, 3);
 | 
			
		||||
		ui->afBW->setValue(tmp);
 | 
			
		||||
		//ui->afBW->setValue(tmp);
 | 
			
		||||
		d.readS32(4, &tmp, 20);
 | 
			
		||||
		ui->modPercent->setValue(tmp);
 | 
			
		||||
 | 
			
		||||
@ -203,14 +198,8 @@ void AMModGUI::on_deltaFrequency_changed(quint64 value)
 | 
			
		||||
 | 
			
		||||
void AMModGUI::on_rfBW_valueChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
	ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0));
 | 
			
		||||
	m_channelMarker.setBandwidth(m_rfBW[value]);
 | 
			
		||||
	applySettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AMModGUI::on_afBW_valueChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
	ui->afBWText->setText(QString("%1 kHz").arg(value));
 | 
			
		||||
	ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0));
 | 
			
		||||
	m_channelMarker.setBandwidth(value * 100);
 | 
			
		||||
	applySettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -395,8 +384,7 @@ void AMModGUI::applySettings()
 | 
			
		||||
		ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
 | 
			
		||||
 | 
			
		||||
		m_amMod->configure(m_amMod->getInputMessageQueue(),
 | 
			
		||||
			m_rfBW[ui->rfBW->value()],
 | 
			
		||||
			ui->afBW->value() * 1000.0,
 | 
			
		||||
			ui->rfBW->value() * 100.0,
 | 
			
		||||
			ui->modPercent->value() / 100.0f,
 | 
			
		||||
			ui->micVolume->value(),
 | 
			
		||||
			ui->audioMute->isChecked(),
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,6 @@ private slots:
 | 
			
		||||
    void on_deltaFrequency_changed(quint64 value);
 | 
			
		||||
    void on_deltaMinus_toggled(bool minus);
 | 
			
		||||
    void on_rfBW_valueChanged(int value);
 | 
			
		||||
    void on_afBW_valueChanged(int value);
 | 
			
		||||
    void on_modPercent_valueChanged(int value);
 | 
			
		||||
    void on_micVolume_valueChanged(int value);
 | 
			
		||||
    void on_audioMute_toggled(bool checked);
 | 
			
		||||
@ -100,8 +99,6 @@ private:
 | 
			
		||||
    bool m_enableNavTime;
 | 
			
		||||
    AMMod::AMModInputAF m_modAFInput;
 | 
			
		||||
 | 
			
		||||
    static const int m_rfBW[];
 | 
			
		||||
 | 
			
		||||
    explicit AMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
 | 
			
		||||
    virtual ~AMModGUI();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>266</width>
 | 
			
		||||
    <height>190</height>
 | 
			
		||||
    <height>169</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="font">
 | 
			
		||||
@ -28,7 +28,7 @@
 | 
			
		||||
     <x>10</x>
 | 
			
		||||
     <y>10</y>
 | 
			
		||||
     <width>251</width>
 | 
			
		||||
     <height>161</height>
 | 
			
		||||
     <height>151</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="windowTitle">
 | 
			
		||||
@ -38,7 +38,16 @@
 | 
			
		||||
    <property name="spacing">
 | 
			
		||||
     <number>3</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="margin">
 | 
			
		||||
    <property name="leftMargin">
 | 
			
		||||
     <number>2</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="topMargin">
 | 
			
		||||
     <number>2</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="rightMargin">
 | 
			
		||||
     <number>2</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="bottomMargin">
 | 
			
		||||
     <number>2</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <item>
 | 
			
		||||
@ -175,14 +184,17 @@
 | 
			
		||||
        <property name="toolTip">
 | 
			
		||||
         <string>Demodulator (RF) bandwidth</string>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="maximum">
 | 
			
		||||
        <property name="minimum">
 | 
			
		||||
         <number>10</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="maximum">
 | 
			
		||||
         <number>200</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="pageStep">
 | 
			
		||||
         <number>1</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="value">
 | 
			
		||||
         <number>6</number>
 | 
			
		||||
         <number>50</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="orientation">
 | 
			
		||||
         <enum>Qt::Horizontal</enum>
 | 
			
		||||
@ -198,56 +210,7 @@
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>12.5kHz</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>
 | 
			
		||||
         <string>5 kHz</string>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="alignment">
 | 
			
		||||
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
@ -602,6 +565,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"/>
 | 
			
		||||
 </resources>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@
 | 
			
		||||
 | 
			
		||||
const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
 | 
			
		||||
    QString("AM Modulator"),
 | 
			
		||||
    QString("2.3.1"),
 | 
			
		||||
    QString("2.4.0"),
 | 
			
		||||
    QString("(c) Edouard Griffiths, F4EXB"),
 | 
			
		||||
    QString("https://github.com/f4exb/sdrangel"),
 | 
			
		||||
    true,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user