mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05: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_channelMarker(this),
|
||||||
m_basicSettingsShown(false),
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_squelchOpen(false)
|
m_squelchOpen(false),
|
||||||
|
m_powerMeterTickCount(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -231,10 +232,10 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
|||||||
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
|
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
|
||||||
m_deviceAPI->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->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||||
// ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenYellow);
|
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,13 +305,27 @@ void AMDemodGUI::enterEvent(QEvent*)
|
|||||||
|
|
||||||
void AMDemodGUI::tick()
|
void AMDemodGUI::tick()
|
||||||
{
|
{
|
||||||
Real magsqAvg, magsqPeak;
|
if (m_powerMeterTickCount < 4) // 200 ms
|
||||||
int nbMagsqSamples;
|
{
|
||||||
m_amDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
m_powerMeterTickCount++;
|
||||||
Real powDbAvg = CalcDb::dbPower(magsqAvg);
|
}
|
||||||
Real powDbPeak = CalcDb::dbPower(magsqPeak);
|
else
|
||||||
// ui->channelPowerMeter->levelChanged(powDbAvg, powDbPeak, nbMagsqSamples);
|
{
|
||||||
ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
|
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();
|
bool squelchOpen = m_amDemod->getSquelchOpen();
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ private:
|
|||||||
DownChannelizer* m_channelizer;
|
DownChannelizer* m_channelizer;
|
||||||
AMDemod* m_amDemod;
|
AMDemod* m_amDemod;
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
|
int m_powerMeterTickCount;
|
||||||
|
|
||||||
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
explicit AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
||||||
virtual ~AMDemodGUI();
|
virtual ~AMDemodGUI();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>257</width>
|
<width>303</width>
|
||||||
<height>131</height>
|
<height>170</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -27,10 +27,16 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>235</width>
|
<width>280</width>
|
||||||
<height>111</height>
|
<height>131</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>280</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
@ -139,26 +145,56 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -321,6 +357,12 @@
|
|||||||
<header>gui/valuedial.h</header>
|
<header>gui/valuedial.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LevelMeterSignalDB</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/levelmeter.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user