mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
AM demod: removed channel power dB average engine. Use direct average from demod
This commit is contained in:
parent
4d5e2f9656
commit
37f4b4e306
@ -30,7 +30,10 @@ MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
|
|||||||
AMDemod::AMDemod() :
|
AMDemod::AMDemod() :
|
||||||
m_squelchOpen(false),
|
m_squelchOpen(false),
|
||||||
m_audioFifo(4, 48000),
|
m_audioFifo(4, 48000),
|
||||||
m_settingsMutex(QMutex::Recursive)
|
m_settingsMutex(QMutex::Recursive),
|
||||||
|
m_magsqSum(0.0f),
|
||||||
|
m_magsqPeak(0.0f),
|
||||||
|
m_magsqCount(0)
|
||||||
{
|
{
|
||||||
setObjectName("AMDemod");
|
setObjectName("AMDemod");
|
||||||
|
|
||||||
|
@ -43,6 +43,16 @@ public:
|
|||||||
Real getMagSq() const { return m_magsq; }
|
Real getMagSq() const { return m_magsq; }
|
||||||
bool getSquelchOpen() const { return m_squelchOpen; }
|
bool getSquelchOpen() const { return m_squelchOpen; }
|
||||||
|
|
||||||
|
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||||
|
{
|
||||||
|
avg = m_magsqSum / m_magsqCount;
|
||||||
|
peak = m_magsqPeak;
|
||||||
|
nbSamples = m_magsqCount;
|
||||||
|
m_magsqSum = 0.0f;
|
||||||
|
m_magsqPeak = 0.0f;
|
||||||
|
m_magsqCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MsgConfigureAMDemod : public Message {
|
class MsgConfigureAMDemod : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
@ -116,6 +126,9 @@ private:
|
|||||||
int m_squelchCount;
|
int m_squelchCount;
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
Real m_magsq;
|
Real m_magsq;
|
||||||
|
Real m_magsqSum;
|
||||||
|
Real m_magsqPeak;
|
||||||
|
int m_magsqCount;
|
||||||
|
|
||||||
MovingAverage<Real> m_movingAverage;
|
MovingAverage<Real> m_movingAverage;
|
||||||
SimpleAGC m_volumeAGC;
|
SimpleAGC m_volumeAGC;
|
||||||
@ -134,6 +147,14 @@ private:
|
|||||||
magsq /= (1<<30);
|
magsq /= (1<<30);
|
||||||
m_movingAverage.feed(magsq);
|
m_movingAverage.feed(magsq);
|
||||||
m_magsq = m_movingAverage.average();
|
m_magsq = m_movingAverage.average();
|
||||||
|
m_magsqSum += magsq;
|
||||||
|
|
||||||
|
if (magsq > m_magsqPeak)
|
||||||
|
{
|
||||||
|
m_magsqPeak = magsq;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_magsqCount++;
|
||||||
|
|
||||||
if (m_magsq >= m_squelchLevel)
|
if (m_magsq >= m_squelchLevel)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,6 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
|||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_basicSettingsShown(false),
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_channelPowerDbAvg(20,0),
|
|
||||||
m_squelchOpen(false)
|
m_squelchOpen(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -235,6 +234,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
|||||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||||
|
// ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenYellow);
|
||||||
|
|
||||||
//m_channelMarker = new ChannelMarker(this);
|
//m_channelMarker = new ChannelMarker(this);
|
||||||
m_channelMarker.setColor(Qt::yellow);
|
m_channelMarker.setColor(Qt::yellow);
|
||||||
@ -304,9 +304,14 @@ void AMDemodGUI::enterEvent(QEvent*)
|
|||||||
|
|
||||||
void AMDemodGUI::tick()
|
void AMDemodGUI::tick()
|
||||||
{
|
{
|
||||||
Real powDb = CalcDb::dbPower(m_amDemod->getMagSq());
|
Real magsqAvg, magsqPeak;
|
||||||
m_channelPowerDbAvg.feed(powDb);
|
int nbMagsqSamples;
|
||||||
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
m_amDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
||||||
|
Real powDbAvg = CalcDb::dbPower(magsqAvg);
|
||||||
|
Real powDbPeak = CalcDb::dbPower(magsqPeak);
|
||||||
|
// ui->channelPowerMeter->levelChanged(powDbAvg, powDbPeak, nbMagsqSamples);
|
||||||
|
ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
|
||||||
|
|
||||||
bool squelchOpen = m_amDemod->getSquelchOpen();
|
bool squelchOpen = m_amDemod->getSquelchOpen();
|
||||||
|
|
||||||
if (squelchOpen != m_squelchOpen)
|
if (squelchOpen != m_squelchOpen)
|
||||||
|
@ -60,7 +60,6 @@ private:
|
|||||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||||
DownChannelizer* m_channelizer;
|
DownChannelizer* m_channelizer;
|
||||||
AMDemod* m_amDemod;
|
AMDemod* m_amDemod;
|
||||||
MovingAverage<Real> m_channelPowerDbAvg;
|
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
|
|
||||||
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user