kopia lustrzana https://github.com/f4exb/sdrangel
FreeDV demod: stats in the GUI (2)
rodzic
2c76698857
commit
ac5b6c184a
|
@ -299,7 +299,9 @@ FreeDVDemodGUI::FreeDVDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B
|
||||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||||
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||||
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
|
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
|
||||||
|
ui->snrMeter->setColorTheme(LevelMeterSignalDB::ColorCyanAndBlue);
|
||||||
ui->snrMeter->setRange(-20, 30);
|
ui->snrMeter->setRange(-20, 30);
|
||||||
|
ui->snrMeter->setAverageSmoothing(2);
|
||||||
|
|
||||||
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
||||||
|
|
||||||
|
@ -474,6 +476,16 @@ void FreeDVDemodGUI::tick()
|
||||||
ui->channelPower->setText(tr("%1 dB").arg(powDbAvg, 0, 'f', 1));
|
ui->channelPower->setText(tr("%1 dB").arg(powDbAvg, 0, 'f', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double snrAvg, snrPeak;
|
||||||
|
int nbSNRSamples;
|
||||||
|
m_freeDVDemod->getSNRLevels(snrAvg, snrPeak, nbSNRSamples);
|
||||||
|
|
||||||
|
ui->snrMeter->levelChanged(
|
||||||
|
(20.0f + snrAvg) / 50.0f,
|
||||||
|
(20.0f + snrPeak) / 50.0f,
|
||||||
|
nbSNRSamples
|
||||||
|
);
|
||||||
|
|
||||||
bool squelchOpen = m_freeDVDemod->getAudioActive();
|
bool squelchOpen = m_freeDVDemod->getAudioActive();
|
||||||
|
|
||||||
if (squelchOpen != m_squelchOpen)
|
if (squelchOpen != m_squelchOpen)
|
||||||
|
|
|
@ -523,7 +523,7 @@
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>180</width>
|
<width>180</width>
|
||||||
<height>0</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
|
|
@ -64,6 +64,7 @@ LevelMeter::LevelMeter(QWidget *parent)
|
||||||
, m_decayedPeakLevel(0.0)
|
, m_decayedPeakLevel(0.0)
|
||||||
, m_peakDecayRate(PeakDecayRate)
|
, m_peakDecayRate(PeakDecayRate)
|
||||||
, m_peakHoldLevel(0.0)
|
, m_peakHoldLevel(0.0)
|
||||||
|
, m_avgSmoothing(256)
|
||||||
, m_redrawTimer(new QTimer(this))
|
, m_redrawTimer(new QTimer(this))
|
||||||
, m_avgColor(0xff, 0x8b, 0x00, 128) // color mapper foreground
|
, m_avgColor(0xff, 0x8b, 0x00, 128) // color mapper foreground
|
||||||
, m_peakColor(Qt::red) // just red 100% opaque
|
, m_peakColor(Qt::red) // just red 100% opaque
|
||||||
|
@ -94,7 +95,7 @@ void LevelMeter::reset()
|
||||||
void LevelMeter::levelChanged(qreal avgLevel, qreal peakLevel, int numSamples)
|
void LevelMeter::levelChanged(qreal avgLevel, qreal peakLevel, int numSamples)
|
||||||
{
|
{
|
||||||
// Smooth the RMS signal
|
// Smooth the RMS signal
|
||||||
const qreal smooth = pow(qreal(0.9), static_cast<qreal>(numSamples) / 256); // TODO: remove this magic number
|
const qreal smooth = pow(qreal(0.9), static_cast<qreal>(numSamples) / m_avgSmoothing);
|
||||||
m_avgLevel = (m_avgLevel * smooth) + (avgLevel * (1.0 - smooth));
|
m_avgLevel = (m_avgLevel * smooth) + (avgLevel * (1.0 - smooth));
|
||||||
|
|
||||||
if (peakLevel > m_decayedPeakLevel) {
|
if (peakLevel > m_decayedPeakLevel) {
|
||||||
|
@ -143,6 +144,11 @@ void LevelMeter::resizeEvent(QResizeEvent * event)
|
||||||
resized();
|
resized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LevelMeter::setAverageSmoothing(uint32_t smoothingFactor)
|
||||||
|
{
|
||||||
|
m_avgSmoothing = smoothingFactor < 1 ? 1 : smoothingFactor > 256 ? 256 : smoothingFactor;
|
||||||
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
LevelMeterVU::LevelMeterVU(QWidget *parent) :
|
LevelMeterVU::LevelMeterVU(QWidget *parent) :
|
||||||
|
@ -251,22 +257,25 @@ void LevelMeterVU::render(QPainter *painter)
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
const QColor LevelMeterSignalDB::m_avgColor[3] = {
|
const QColor LevelMeterSignalDB::m_avgColor[4] = {
|
||||||
QColor(0xff, 0x8b, 0x00, 128),
|
QColor(0xff, 0x8b, 0x00, 128),
|
||||||
QColor(0x8c, 0xff, 0x00, 128),
|
QColor(0x8c, 0xff, 0x00, 128),
|
||||||
QColor(0x8c, 0xff, 0x00, 128)
|
QColor(0x8c, 0xff, 0x00, 128),
|
||||||
|
QColor(0x8c, 0xbf, 0xff, 128),
|
||||||
};
|
};
|
||||||
|
|
||||||
const QColor LevelMeterSignalDB::m_decayedPeakColor[3] = {
|
const QColor LevelMeterSignalDB::m_decayedPeakColor[4] = {
|
||||||
QColor(0x97, 0x54, 0x00, 128),
|
QColor(0x97, 0x54, 0x00, 128),
|
||||||
QColor(0x53, 0x96, 0x00, 128),
|
QColor(0x53, 0x96, 0x00, 128),
|
||||||
QColor(0x00, 0x96, 0x53, 128)
|
QColor(0x00, 0x96, 0x53, 128),
|
||||||
|
QColor(0x00, 0x94, 0x94, 128),
|
||||||
};
|
};
|
||||||
|
|
||||||
const QColor LevelMeterSignalDB::m_peakColor[3] = {
|
const QColor LevelMeterSignalDB::m_peakColor[4] = {
|
||||||
Qt::red,
|
Qt::red,
|
||||||
Qt::green,
|
Qt::green,
|
||||||
Qt::green
|
Qt::green,
|
||||||
|
Qt::cyan
|
||||||
};
|
};
|
||||||
|
|
||||||
LevelMeterSignalDB::LevelMeterSignalDB(QWidget *parent) :
|
LevelMeterSignalDB::LevelMeterSignalDB(QWidget *parent) :
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void resizeEvent(QResizeEvent * event);
|
void resizeEvent(QResizeEvent * event);
|
||||||
|
|
||||||
|
void setAverageSmoothing(uint32_t smoothingFactor);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reset();
|
void reset();
|
||||||
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
|
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
|
||||||
|
@ -119,6 +121,11 @@ protected:
|
||||||
*/
|
*/
|
||||||
QTime m_peakHoldLevelChanged;
|
QTime m_peakHoldLevelChanged;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Average smoothing factor (between 1: fast and 256: slow)
|
||||||
|
*/
|
||||||
|
uint32_t m_avgSmoothing;
|
||||||
|
|
||||||
QTimer *m_redrawTimer;
|
QTimer *m_redrawTimer;
|
||||||
|
|
||||||
QColor m_avgColor;
|
QColor m_avgColor;
|
||||||
|
@ -155,7 +162,8 @@ public:
|
||||||
{
|
{
|
||||||
ColorGold,
|
ColorGold,
|
||||||
ColorGreenYellow,
|
ColorGreenYellow,
|
||||||
ColorGreenAndBlue
|
ColorGreenAndBlue,
|
||||||
|
ColorCyanAndBlue
|
||||||
} ColorTheme;
|
} ColorTheme;
|
||||||
|
|
||||||
LevelMeterSignalDB(QWidget *parent = 0);
|
LevelMeterSignalDB(QWidget *parent = 0);
|
||||||
|
@ -164,9 +172,9 @@ public:
|
||||||
void setColorTheme(ColorTheme colorTheme) { m_colorTheme = colorTheme; }
|
void setColorTheme(ColorTheme colorTheme) { m_colorTheme = colorTheme; }
|
||||||
void setRange(int min, int max);
|
void setRange(int min, int max);
|
||||||
|
|
||||||
static const QColor m_avgColor[3];
|
static const QColor m_avgColor[4];
|
||||||
static const QColor m_decayedPeakColor[3];
|
static const QColor m_decayedPeakColor[4];
|
||||||
static const QColor m_peakColor[3];
|
static const QColor m_peakColor[4];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void render(QPainter *painter);
|
virtual void render(QPainter *painter);
|
||||||
|
|
Ładowanie…
Reference in New Issue