mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 18:48:34 -04:00
AM Demod plugin: added a signal level meter
This commit is contained in:
parent
d381075d87
commit
c31846a334
@ -218,7 +218,8 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
||||
m_channelMarker(this),
|
||||
m_basicSettingsShown(false),
|
||||
m_doApplySettings(true),
|
||||
m_squelchOpen(false)
|
||||
m_squelchOpen(false),
|
||||
m_powerMeterTickCount(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
@ -231,10 +232,10 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
||||
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
|
||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
|
||||
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||
// ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenYellow);
|
||||
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenYellow);
|
||||
|
||||
//m_channelMarker = new ChannelMarker(this);
|
||||
m_channelMarker.setColor(Qt::yellow);
|
||||
@ -304,13 +305,27 @@ void AMDemodGUI::enterEvent(QEvent*)
|
||||
|
||||
void AMDemodGUI::tick()
|
||||
{
|
||||
Real magsqAvg, magsqPeak;
|
||||
int nbMagsqSamples;
|
||||
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));
|
||||
if (m_powerMeterTickCount < 4) // 200 ms
|
||||
{
|
||||
m_powerMeterTickCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Real magsqAvg, magsqPeak;
|
||||
int nbMagsqSamples;
|
||||
m_amDemod->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));
|
||||
|
||||
m_powerMeterTickCount = 0;
|
||||
}
|
||||
|
||||
bool squelchOpen = m_amDemod->getSquelchOpen();
|
||||
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
DownChannelizer* m_channelizer;
|
||||
AMDemod* m_amDemod;
|
||||
bool m_squelchOpen;
|
||||
int m_powerMeterTickCount;
|
||||
|
||||
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
||||
virtual ~AMDemodGUI();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>257</width>
|
||||
<height>131</height>
|
||||
<width>303</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -27,10 +27,16 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>235</width>
|
||||
<height>111</height>
|
||||
<width>280</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>280</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
@ -139,26 +145,56 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="audioMute">
|
||||
<property name="toolTip">
|
||||
<string>Mute/Unmute audio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/sound_on.png</normaloff>
|
||||
<normalon>:/sound_off.png</normalon>:/sound_on.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="audioMute">
|
||||
<property name="toolTip">
|
||||
<string>Mute/Unmute audio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/sound_on.png</normaloff>
|
||||
<normalon>:/sound_off.png</normalon>:/sound_on.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="signalLevelLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="channelPowerMeterUnits">
|
||||
<property name="text">
|
||||
<string>dB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LevelMeterSignalDB" name="channelPowerMeter" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Level meter (dB) light: average, dark: peak, tip: peak hold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -321,6 +357,12 @@
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LevelMeterSignalDB</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
|
Loading…
Reference in New Issue
Block a user