1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 15:45:49 -05:00

Channel Analyzer NG: revamped UI with rational downsampler UI

This commit is contained in:
f4exb 2017-02-28 00:58:26 +01:00
parent 4ee7675dd9
commit d2727708e9
5 changed files with 142 additions and 70 deletions

View File

@ -143,7 +143,7 @@ This is the `demoddsd` plugin. At present it can be used to decode the following
It is based on the [DSDcc](https://github.com/f4exb/dsdcc) C++ library which is a rewrite of the original [DSD](https://github.com/szechyjs/dsd) program. So you will need to have DSDcc installed in your system. Please follow instructions in [DSDcc readme](https://github.com/f4exb/dsdcc/blob/master/Readme.md) to build and install DSDcc. If you install it in a custom location say `/opt/install/dsdcc` you will need to add these defines to the cmake command: `-DLIBDSDCC_INCLUDE_DIR=/opt/install/dsdcc/include/dsdcc -DLIBDSDCC_LIBRARIES=/opt/install/dsdcc/lib/libdsdcc.so`
If you have one or more serial devices interfacing the AMBE3000 chip in packet mode you can use them to decode AMBE voice frames. For that purpose you will need to compile with [SerialDV](https://github.com/f4exb/serialDV) support. Please refer to this project Readme.md to compile and install SerialDV. If you install it in a custom location say `/opt/install/serialdv` you will need to add these defines to the cmake command: `-DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so`
If you have one or more serial devices interfacing the AMBE3000 chip in packet mode you can use them to decode AMBE voice frames. For that purpose you will need to compile with [SerialDV](https://github.com/f4exb/serialDV) support. Please refer to this project Readme.md to compile and install SerialDV. If you install it in a custom location say `/opt/install/serialdv` you will need to add these defines to the cmake command: `-DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so` Also your user must be a member of group `dialout` to be able to use the dongle.
Although such serial devices work with a serial interface at 400 kb in practice maybe for other reasons they are capable of handling only one conversation at a time. The software will allocate the device dynamically to a conversation with an inactivity timeout of 1 second so that conversations do not get interrupted constantly making the audio output too choppy. In practice you will have to have as many devices connected to your system as the number of conversations you would like to be handled in parallel.
@ -219,7 +219,7 @@ Install cmake version 3:
<h3>With newer versions just do:</h3>
- `sudo apt-get install cmake g++ pkg-config libfftw3-dev libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev libusb-1.0 librtlsdr-dev libboost-all-dev libasound2-dev pulseaudio liblz4-dev`
- `sudo apt-get install cmake g++ pkg-config libfftw3-dev libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev libusb-1.0 librtlsdr-dev libboost-all-dev libasound2-dev pulseaudio liblz4-dev libnanomsg-dev`
- `mkdir build && cd build && cmake ../ && make`
`librtlsdr-dev` is in the `universe` repo. (utopic 14.10 amd64.)

View File

@ -75,9 +75,10 @@ void ChannelAnalyzerNGGUI::resetToDefaults()
{
blockApplySettings(true);
ui->useRationalDownsampler->setChecked(false);
ui->BW->setValue(30);
ui->deltaFrequency->setValue(0);
ui->spanLog2->setValue(3);
ui->spanLog2->setCurrentIndex(3);
blockApplySettings(false);
applySettings();
@ -91,7 +92,7 @@ QByteArray ChannelAnalyzerNGGUI::serialize() const
s.writeBlob(3, ui->spectrumGUI->serialize());
s.writeU32(4, m_channelMarker.getColor().rgb());
s.writeS32(5, ui->lowCut->value());
s.writeS32(6, ui->spanLog2->value());
s.writeS32(6, ui->spanLog2->currentIndex());
s.writeBool(7, ui->ssb->isChecked());
s.writeBlob(8, ui->scopeGUI->serialize());
return s.final();
@ -138,7 +139,7 @@ bool ChannelAnalyzerNGGUI::deserialize(const QByteArray& data)
blockApplySettings(false);
m_channelMarker.blockSignals(false);
ui->spanLog2->setValue(spanLog2);
ui->spanLog2->setCurrentIndex(spanLog2);
setNewRate(spanLog2);
ui->BW->setValue(bw);
ui->lowCut->setValue(lowCut); // does applySettings();
@ -167,6 +168,7 @@ void ChannelAnalyzerNGGUI::tick()
Real powDb = CalcDb::dbPower(m_channelAnalyzer->getMagSq());
m_channelPowerDbAvg.feed(powDb);
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
// ui->channelPower->setText(QString::number(powDb, 'f', 1));
}
void ChannelAnalyzerNGGUI::channelSampleRateChanged()
@ -251,9 +253,9 @@ void ChannelAnalyzerNGGUI::on_lowCut_valueChanged(int value)
applySettings();
}
void ChannelAnalyzerNGGUI::on_spanLog2_valueChanged(int value)
void ChannelAnalyzerNGGUI::on_spanLog2_currentIndexChanged(int index)
{
if (setNewRate(value)) {
if (setNewRate(index)) {
applySettings();
}
@ -333,6 +335,9 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
ui->channelSampleRate->setColorMapper(ColorMapper(ColorMapper::ReverseGreenYellow));
ui->channelSampleRate->setValueRange(7, 0U, 9999999U);
ui->glSpectrum->setCenterFrequency(m_rate/2);
ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setDisplayWaterfall(true);
@ -381,6 +386,9 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
{
qDebug("ChannelAnalyzerNGGUI::setNewRate");
ui->channelSampleRate->setValueRange(7, 0, m_channelAnalyzer->getSampleRate());
ui->channelSampleRate->setValue(m_channelAnalyzer->getSampleRate());
if ((spanLog2 < 0) || (spanLog2 > 6)) {
return false;
}

View File

@ -63,7 +63,7 @@ private slots:
void on_deltaMinus_toggled(bool minus);
void on_BW_valueChanged(int value);
void on_lowCut_valueChanged(int value);
void on_spanLog2_valueChanged(int value);
void on_spanLog2_currentIndexChanged(int index);
void on_ssb_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDoubleClicked();
@ -78,7 +78,7 @@ private:
bool m_doApplySettings;
int m_rate;
int m_spanLog2;
MovingAverage<Real> m_channelPowerDbAvg;
MovingAverage<double> m_channelPowerDbAvg;
ThreadedBasebandSampleSink* m_threadedChannelizer;
DownChannelizer* m_channelizer;

View File

@ -31,7 +31,7 @@
<x>0</x>
<y>10</y>
<width>631</width>
<height>131</height>
<height>81</height>
</rect>
</property>
<property name="windowTitle">
@ -54,7 +54,7 @@
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="DeltaFreqPowLayout">
<layout class="QHBoxLayout" name="HeaderLayout">
<item>
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
<item>
@ -183,6 +183,117 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="ChannelSamplingLayout">
<item>
<widget class="ButtonSwitch" name="useRationalDownsampler">
<property name="toolTip">
<string>Use rational downsampler</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ValueDial" name="channelSampleRate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>Rational downsampler output rate</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="channelSampleRateUnits">
<property name="text">
<string>S/s</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="spanLog2">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Channel downsampling</string>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="spanText">
<property name="toolTip">
<string>Channel final sample rate</string>
</property>
<property name="text">
<string>6.0k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -222,64 +333,12 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="SpanLayout">
<item>
<widget class="QLabel" name="spanLabel">
<property name="text">
<string>Rate</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="spanLog2">
<property name="toolTip">
<string>Channel sample rate</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>3</number>
</property>
<property name="sliderPosition">
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="invertedControls">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="spanText">
<property name="text">
<string>6.0k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="BWLayout">
<item>
<widget class="QLabel" name="BWLabel">
<property name="text">
<string>Hi</string>
<string>LP</string>
</property>
</widget>
</item>
@ -331,7 +390,7 @@
<item>
<widget class="QLabel" name="lowCutLabel">
<property name="text">
<string>Low</string>
<string>HP</string>
</property>
</widget>
</item>
@ -391,7 +450,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<y>98</y>
<width>720</width>
<height>284</height>
</rect>
@ -446,9 +505,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>450</y>
<y>390</y>
<width>720</width>
<height>314</height>
<height>334</height>
</rect>
</property>
<property name="minimumSize">
@ -481,7 +540,7 @@
<property name="minimumSize">
<size>
<width>200</width>
<height>280</height>
<height>300</height>
</size>
</property>
<property name="font">
@ -535,6 +594,11 @@
<header>gui/glscopenggui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>

View File

@ -6,7 +6,7 @@
#include <algorithm>
#include "dsp/dsptypes.h"
template<class Type> class MovingAverage {
template<typename Type> class MovingAverage {
public:
MovingAverage() :
m_history(),