diff --git a/plugins/channelrx/demodam/amdemodgui.ui b/plugins/channelrx/demodam/amdemodgui.ui
index 6ee271303..494460a61 100644
--- a/plugins/channelrx/demodam/amdemodgui.ui
+++ b/plugins/channelrx/demodam/amdemodgui.ui
@@ -56,7 +56,16 @@
3
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -199,7 +208,7 @@
0
- 30
+ 26
@@ -378,6 +387,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp
index d0f794ec6..c242c3b60 100644
--- a/plugins/channelrx/demodbfm/bfmdemod.cpp
+++ b/plugins/channelrx/demodbfm/bfmdemod.cpp
@@ -63,7 +63,11 @@ BFMDemod::BFMDemod(BasebandSampleSink* sampleSink, RDSParser *rdsParser) :
m_audioBuffer.resize(16384);
m_audioBufferFill = 0;
- m_movingAverage.resize(16, 0);
+// m_movingAverage.resize(16, 0);
+ m_magsq = 0.0f;
+ m_magsqSum = 0.0f;
+ m_magsqPeak = 0.0f;
+ m_magsqCount = 0;
DSPEngine::instance()->addAudioSink(&m_audioFifo);
}
@@ -121,10 +125,20 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{
msq = rf[i].real()*rf[i].real() + rf[i].imag()*rf[i].imag();
- m_movingAverage.feed(msq);
+ m_magsqSum += msq;
- if(m_movingAverage.average() >= m_squelchLevel)
+ if (msq > m_magsqPeak)
+ {
+ m_magsqPeak = msq;
+ }
+
+ m_magsqCount++;
+
+// m_movingAverage.feed(msq);
+
+ if(m_magsq >= m_squelchLevel) {
m_squelchState = m_running.m_rfBandwidth / 20; // decay rate
+ }
if(m_squelchState > 0)
{
diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h
index 5e67bf08b..cb65fcdcc 100644
--- a/plugins/channelrx/demodbfm/bfmdemod.h
+++ b/plugins/channelrx/demodbfm/bfmdemod.h
@@ -58,7 +58,7 @@ public:
virtual void stop();
virtual bool handleMessage(const Message& cmd);
- Real getMagSq() const { return m_movingAverage.average(); }
+ Real getMagSq() const { return m_magsq; }
bool getPilotLock() const { return m_pilotPLL.locked(); }
Real getPilotLevel() const { return m_pilotPLL.get_pilot_level(); }
@@ -69,6 +69,17 @@ public:
Real getDemodQua() const { return m_rdsDemod.m_report.qua; }
Real getDemodFclk() const { return m_rdsDemod.m_report.fclk; }
+ void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
+ {
+ avg = m_magsqSum / m_magsqCount;
+ m_magsq = avg;
+ peak = m_magsqPeak;
+ nbSamples = m_magsqCount;
+ m_magsqSum = 0.0f;
+ m_magsqPeak = 0.0f;
+ m_magsqCount = 0;
+ }
+
private:
class MsgConfigureBFMDemod : public Message {
MESSAGE_CLASS_DECLARATION
@@ -196,7 +207,11 @@ private:
Real m_m1Arg; //!> x^-1 real sample
- MovingAverage m_movingAverage;
+// MovingAverage m_movingAverage;
+ Real m_magsq;
+ Real m_magsqSum;
+ Real m_magsqPeak;
+ int m_magsqCount;
AudioVector m_audioBuffer;
uint m_audioBufferFill;
diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp
index dfe175310..723aa8ba7 100644
--- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp
+++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp
@@ -374,6 +374,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
ui->setupUi(this);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
+ ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
@@ -476,9 +477,22 @@ void BFMDemodGUI::enterEvent(QEvent*)
void BFMDemodGUI::tick()
{
- Real powDb = CalcDb::dbPower(m_bfmDemod->getMagSq());
- m_channelPowerDbAvg.feed(powDb);
- ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
+ Real magsqAvg, magsqPeak;
+ int nbMagsqSamples;
+ m_bfmDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
+ Real powDbAvg = CalcDb::dbPower(magsqAvg);
+ Real powDbPeak = CalcDb::dbPower(magsqPeak);
+
+ ui->channelPowerMeter->levelChanged(
+ (100.0f + powDbAvg) / 100.0f,
+ (100.0f + powDbPeak) / 100.0f,
+ nbMagsqSamples);
+
+ ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
+
+// Real powDb = CalcDb::dbPower(m_bfmDemod->getMagSq());
+// m_channelPowerDbAvg.feed(powDb);
+// ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
Real pilotPowDb = CalcDb::dbPower(m_bfmDemod->getPilotLevel());
QString pilotPowDbStr;
diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.ui b/plugins/channelrx/demodbfm/bfmdemodgui.ui
index 5da8dc46a..9569ad30e 100644
--- a/plugins/channelrx/demodbfm/bfmdemodgui.ui
+++ b/plugins/channelrx/demodbfm/bfmdemodgui.ui
@@ -28,7 +28,7 @@
10
20
411
- 121
+ 151
@@ -38,7 +38,16 @@
3
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -241,6 +250,36 @@
+ -
+
+
-
+
+
+ dB
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 26
+
+
+
+ Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold
+
+
+
+
+
-
-
@@ -443,7 +482,16 @@
3
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -465,7 +513,7 @@
10
- 150
+ 170
791
301
@@ -1775,6 +1823,12 @@
QToolButton
+
+ LevelMeterSignalDB
+ QWidget
+
+ 1
+
GLSpectrum
QWidget
@@ -1790,6 +1844,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp
index 5164c78fb..fc2fce023 100644
--- a/plugins/channelrx/demoddsd/dsddemod.cpp
+++ b/plugins/channelrx/demoddsd/dsddemod.cpp
@@ -67,7 +67,11 @@ DSDDemod::DSDDemod(BasebandSampleSink* sampleSink) :
m_sampleBuffer = new qint16[1<<17]; // 128 kS
m_sampleBufferIndex = 0;
- m_movingAverage.resize(50, 0);
+// m_movingAverage.resize(50, 0);
+ m_magsq = 0.0f;
+ m_magsqSum = 0.0f;
+ m_magsqPeak = 0.0f;
+ m_magsqCount = 0;
DSPEngine::instance()->addAudioSink(&m_audioFifo1);
DSPEngine::instance()->addAudioSink(&m_audioFifo2);
@@ -136,8 +140,17 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{
qint16 sample, delayedSample;
- m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag()));
- m_movingAverage.feed(m_magsq);
+ Real magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())) / (1<<30);
+// m_movingAverage.feed(m_magsq);
+
+ m_magsqSum += magsq;
+
+ if (magsq > m_magsqPeak)
+ {
+ m_magsqPeak = magsq;
+ }
+
+ m_magsqCount++;
Real demod = 32768.0f * m_phaseDiscri.phaseDiscriminator(ci) * ((float) m_running.m_demodGain / 100.0f);
m_sampleCount++;
diff --git a/plugins/channelrx/demoddsd/dsddemod.h b/plugins/channelrx/demoddsd/dsddemod.h
index 411a0dae7..ad0cb96c5 100644
--- a/plugins/channelrx/demoddsd/dsddemod.h
+++ b/plugins/channelrx/demoddsd/dsddemod.h
@@ -67,11 +67,22 @@ public:
m_dsdDemodGUI = dsdDemodGUI;
}
- double getMagSq() { return m_movingAverage.average() / (double) (1<<30); }
+ double getMagSq() { return m_magsq; }
bool getSquelchOpen() const { return m_squelchOpen; }
const DSDDecoder& getDecoder() const { return m_dsdDecoder; }
+ void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
+ {
+ avg = m_magsqSum / m_magsqCount;
+ m_magsq = avg;
+ peak = m_magsqPeak;
+ nbSamples = m_magsqCount;
+ m_magsqSum = 0.0f;
+ m_magsqPeak = 0.0f;
+ m_magsqCount = 0;
+ }
+
private:
class MsgConfigureMyPosition : public Message {
MESSAGE_CLASS_DECLARATION
@@ -251,8 +262,11 @@ private:
bool m_squelchOpen;
Real m_lastArgument;
- MovingAverage m_movingAverage;
- double m_magsq;
+// MovingAverage m_movingAverage;
+ Real m_magsq;
+ Real m_magsqSum;
+ Real m_magsqPeak;
+ int m_magsqCount;
Real m_fmExcursion;
diff --git a/plugins/channelrx/demoddsd/dsddemodgui.cpp b/plugins/channelrx/demoddsd/dsddemodgui.cpp
index c28f09647..e1737920a 100644
--- a/plugins/channelrx/demoddsd/dsddemodgui.cpp
+++ b/plugins/channelrx/demoddsd/dsddemodgui.cpp
@@ -370,6 +370,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
+ ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
m_channelizer = new DownChannelizer(m_dsdDemod);
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
@@ -619,9 +620,22 @@ void DSDDemodGUI::formatStatusText()
void DSDDemodGUI::tick()
{
- Real powDb = CalcDb::dbPower(m_dsdDemod->getMagSq());
- m_channelPowerDbAvg.feed(powDb);
- ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
+ Real magsqAvg, magsqPeak;
+ int nbMagsqSamples;
+ m_dsdDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
+ Real powDbAvg = CalcDb::dbPower(magsqAvg);
+ Real powDbPeak = CalcDb::dbPower(magsqPeak);
+
+ ui->channelPowerMeter->levelChanged(
+ (100.0f + powDbAvg) / 100.0f,
+ (100.0f + powDbPeak) / 100.0f,
+ nbMagsqSamples);
+
+ ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
+
+// Real powDb = CalcDb::dbPower(m_dsdDemod->getMagSq());
+// m_channelPowerDbAvg.feed(powDb);
+// ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
bool squelchOpen = m_dsdDemod->getSquelchOpen();
diff --git a/plugins/channelrx/demoddsd/dsddemodgui.ui b/plugins/channelrx/demoddsd/dsddemodgui.ui
index 2b8dfb1da..cb5c05f3f 100644
--- a/plugins/channelrx/demoddsd/dsddemodgui.ui
+++ b/plugins/channelrx/demoddsd/dsddemodgui.ui
@@ -370,6 +370,36 @@
+ -
+
+
-
+
+
+ Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold
+
+
+ dB
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 26
+
+
+
+
+
+
-
-
@@ -908,6 +938,17 @@
1
+
+ ButtonSwitch
+ QToolButton
+
+
+
+ LevelMeterSignalDB
+ QWidget
+
+ 1
+
GLScope
QWidget
@@ -920,11 +961,6 @@
1
-
- ButtonSwitch
- QToolButton
-
-
@@ -945,6 +981,9 @@
+
+
+
diff --git a/plugins/channelrx/demodnfm/nfmdemodgui.ui b/plugins/channelrx/demodnfm/nfmdemodgui.ui
index 4b3195cf6..f281ae5b0 100644
--- a/plugins/channelrx/demodnfm/nfmdemodgui.ui
+++ b/plugins/channelrx/demodnfm/nfmdemodgui.ui
@@ -53,7 +53,16 @@
3
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -181,7 +190,7 @@
0
- 30
+ 26
@@ -593,6 +602,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/channelrx/demodssb/ssbdemodgui.ui b/plugins/channelrx/demodssb/ssbdemodgui.ui
index c9a90a147..95fcbf4f9 100644
--- a/plugins/channelrx/demodssb/ssbdemodgui.ui
+++ b/plugins/channelrx/demodssb/ssbdemodgui.ui
@@ -53,7 +53,16 @@
3
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -239,7 +248,7 @@
0
- 30
+ 26
@@ -475,7 +484,16 @@
2
-
+
+ 3
+
+
+ 3
+
+
+ 3
+
+
3
-
@@ -513,6 +531,12 @@
1
+
+ LevelMeterSignalDB
+ QWidget
+
+ 1
+
GLSpectrum
QWidget
@@ -525,15 +549,29 @@
1
-
- LevelMeterSignalDB
- QWidget
-
- 1
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+