Add option to switch AM DCR on and off.

This commit is contained in:
Alexandru Csete 2013-01-13 22:53:06 +01:00
parent cb8667fa59
commit c9a38672b9
13 changed files with 86 additions and 15 deletions

View File

@ -138,6 +138,7 @@ MainWindow::MainWindow(const QString cfgfile, QWidget *parent) :
connect(uiDockRxOpt, SIGNAL(demodSelected(int)), this, SLOT(selectDemod(int)));
connect(uiDockRxOpt, SIGNAL(fmMaxdevSelected(float)), this, SLOT(setFmMaxdev(float)));
connect(uiDockRxOpt, SIGNAL(fmEmphSelected(double)), this, SLOT(setFmEmph(double)));
connect(uiDockRxOpt, SIGNAL(amDcrToggled(bool)), this, SLOT(setAmDcr(bool)));
connect(uiDockRxOpt, SIGNAL(agcToggled(bool)), this, SLOT(setAgcOn(bool)));
connect(uiDockRxOpt, SIGNAL(agcHangToggled(bool)), this, SLOT(setAgcHang(bool)));
connect(uiDockRxOpt, SIGNAL(agcThresholdChanged(int)), this, SLOT(setAgcThreshold(int)));
@ -807,12 +808,9 @@ void MainWindow::setFmEmph(double tau)
/*! \brief AM DCR status changed (slot).
* \param enabled Whether DCR is enabled or not.
*/
void MainWindow::setAmDcrStatus(bool enabled)
void MainWindow::setAmDcr(bool enabled)
{
Q_UNUSED(enabled)
/** FIXME: obsolete */
//rx->set_am_dcr(enabled);
rx->set_am_dcr(enabled);
}
/*! \brief Audio gain changed.

View File

@ -111,7 +111,7 @@ private slots:
void selectDemod(int index);
void setFmMaxdev(float max_dev);
void setFmEmph(double tau);
void setAmDcrStatus(bool enabled);
void setAmDcr(bool enabled);
void setAgcOn(bool agc_on);
void setAgcHang(bool use_hang);
void setAgcThreshold(int threshold);

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -636,6 +636,14 @@ receiver::status receiver::set_fm_deemph(double tau)
return STATUS_OK;
}
receiver::status receiver::set_am_dcr(bool enabled)
{
if (rx->has_am())
rx->set_am_dcr(enabled);
return STATUS_OK;
}
receiver::status receiver::set_af_gain(float gain_db)
{
float k;

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -161,6 +161,9 @@ public:
status set_fm_maxdev(float maxdev_hz);
status set_fm_deemph(double tau);
/* AM parameters */
status set_am_dcr(bool enabled);
/* Audio parameters */
status set_af_gain(float gain_db);
status start_audio_recording(const std::string filename);

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -103,3 +103,8 @@ void CDemodOptions::on_emphSelector_activated(int index)
tau = tau_tbl[index] * 1.0e-6;
emit fmEmphSelected(tau);
}
void CDemodOptions::on_dcrCheckBox_toggled(bool checked)
{
emit amDcrToggled(checked);
}

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -41,7 +41,8 @@ public:
enum page {
PAGE_NO_OPT = 0,
PAGE_FM_OPT = 1,
PAGE_NUM = 2
PAGE_AM_OPT = 2,
PAGE_NUM = 3
};
explicit CDemodOptions(QWidget *parent = 0);
@ -59,9 +60,13 @@ signals:
/*! \brief Signal emitted when new FM de-emphasis constant is selected. */
void fmEmphSelected(double tau);
/*! \brief Signal emitted when AM DCR is toggled. */
void amDcrToggled(bool enabled);
private slots:
void on_maxdevSelector_activated(int index);
void on_emphSelector_activated(int index);
void on_dcrCheckBox_toggled(bool checked);
private:
Ui::CDemodOptions *ui;

View File

@ -205,6 +205,23 @@ For digital modes it is best to switch it off.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="demodAmOpt">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="dcrCheckBox">
<property name="toolTip">
<string>Enable/disable DC removal.</string>
</property>
<property name="text">
<string>DCR</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -47,6 +47,7 @@ DockRxOpt::DockRxOpt(qint64 filterOffsetRange, QWidget *parent) :
demodOpt->setCurrentPage(CDemodOptions::PAGE_FM_OPT);
connect(demodOpt, SIGNAL(fmMaxdevSelected(float)), this, SLOT(demodOpt_fmMaxdevSelected(float)));
connect(demodOpt, SIGNAL(fmEmphSelected(double)), this, SLOT(demodOpt_fmEmphSelected(double)));
connect(demodOpt, SIGNAL(amDcrToggled(bool)), this, SLOT(demodOpt_amDcrToggled(bool)));
// AGC options dialog
agcOpt = new CAgcOptions(this);
@ -227,6 +228,8 @@ void DockRxOpt::on_modeSelector_activated(int index)
// update demodulator option widget
if (index == MODE_NFM)
demodOpt->setCurrentPage(CDemodOptions::PAGE_FM_OPT);
else if (index == MODE_AM)
demodOpt->setCurrentPage(CDemodOptions::PAGE_AM_OPT);
else
demodOpt->setCurrentPage(CDemodOptions::PAGE_NO_OPT);
@ -352,6 +355,14 @@ void DockRxOpt::demodOpt_fmEmphSelected(double tau)
emit fmEmphSelected(tau);
}
/*! \brief AM DC removal toggled by user.
* \param enabled Whether DCR is enabled or not.
*/
void DockRxOpt::demodOpt_amDcrToggled(bool enabled)
{
emit amDcrToggled(enabled);
}
/*! \brief Noise blanker 1 button has been toggled. */
void DockRxOpt::on_nb1Button_toggled(bool checked)
{

View File

@ -144,6 +144,7 @@ private slots:
// Signals coming from demod options pop-up
void demodOpt_fmMaxdevSelected(float max_dev);
void demodOpt_fmEmphSelected(double tau);
void demodOpt_amDcrToggled(bool enabled);
// Signals coming from AGC options popup
void agcOpt_hangToggled(bool checked);

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -248,3 +248,8 @@ void nbrx::set_fm_deemph(double tau)
{
demod_fm->set_tau(tau);
}
void nbrx::set_am_dcr(bool enabled)
{
demod_am->set_dcr(enabled);
}

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Alexandru Csete OZ9AEC.
* Copyright 2011-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -92,10 +92,14 @@ public:
void set_demod(int demod);
/* FM parameters */
bool has_fm() {return true; }
bool has_fm() { return true; }
void set_fm_maxdev(float maxdev_hz);
void set_fm_deemph(double tau);
/* AM parameters */
bool has_am() { return true; }
void set_am_dcr(bool enabled);
private:
bool d_running; /*!< Whether receiver is running or not. */
float d_quad_rate; /*!< Input sample rate. */

View File

@ -121,3 +121,13 @@ void receiver_base_cf::set_fm_deemph(double tau)
{
(void) tau;
}
bool receiver_base_cf::has_am()
{
return false;
}
void receiver_base_cf::set_am_dcr(bool enabled)
{
(void) enabled;
}

View File

@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Alexandru Csete OZ9AEC.
* Copyright 2012-2013 Alexandru Csete OZ9AEC.
*
* Gqrx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -83,6 +83,10 @@ public:
virtual void set_fm_maxdev(float maxdev_hz);
virtual void set_fm_deemph(double tau);
/* AM parameters */
virtual bool has_am();
virtual void set_am_dcr(bool enabled);
};
#endif // RECEIVER_BASE_H