1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Removed useless spectrum visualizer in NFM receivers. Created a null sink class to fit corresponding parameter in NFMDemod class constructor

This commit is contained in:
f4exb 2015-05-10 19:21:46 +02:00
parent 51a18d231a
commit c92909d78d
7 changed files with 82 additions and 85 deletions

View File

@ -63,6 +63,7 @@ set(sdrbase_SOURCES
sdrbase/dsp/pidcontroller.cpp sdrbase/dsp/pidcontroller.cpp
sdrbase/dsp/samplefifo.cpp sdrbase/dsp/samplefifo.cpp
sdrbase/dsp/samplesink.cpp sdrbase/dsp/samplesink.cpp
sdrbase/dsp/nullsink.cpp
sdrbase/dsp/scopevis.cpp sdrbase/dsp/scopevis.cpp
sdrbase/dsp/spectrumvis.cpp sdrbase/dsp/spectrumvis.cpp
sdrbase/dsp/threadedsamplesink.cpp sdrbase/dsp/threadedsamplesink.cpp
@ -132,6 +133,7 @@ set(sdrbase_HEADERS
sdrbase/dsp/pidcontroller.h sdrbase/dsp/pidcontroller.h
include/dsp/samplefifo.h include/dsp/samplefifo.h
include/dsp/samplesink.h include/dsp/samplesink.h
include-gpl/dsp/nullsink.h
include-gpl/dsp/scopevis.h include-gpl/dsp/scopevis.h
include-gpl/dsp/spectrumvis.h include-gpl/dsp/spectrumvis.h
include/dsp/threadedsamplesink.h include/dsp/threadedsamplesink.h

View File

@ -46,11 +46,11 @@ There is no installation procedure the executable is at the root of the build di
For Debian 8 For Debian 8
============ ============
Debian 7 "wheezy" uses Qt4. Qt5 is available from the "wheezy-backports" repo, but this will remove Qt4. Debian 7 "wheezy" uses Qt4. Qt5 is available from the "wheezy-backports" repo, but this will remove Qt4. Debian 8 "jessie" uses Qt5.
`sudo apt-get install cmake g++ pkg-config libfftw3-dev libusb-1.0-0-dev libusb-dev qt5-default qtbase5-dev qtchooser libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev librtlsdr-dev` `sudo apt-get install cmake g++ pkg-config libfftw3-dev libusb-1.0-0-dev libusb-dev qt5-default qtbase5-dev qtchooser libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev librtlsdr-dev`
`mkdir out && cd out && cmake ../ && make` `mkdir build && cd build && cmake ../ && make`
The same remarks as for Ubuntu apply... The same remarks as for Ubuntu apply...
@ -70,12 +70,15 @@ Done since the fork
- Added a preset update button (the diskette with the yellow corner) to be able to save the current settings on an existing preset - Added a preset update button (the diskette with the yellow corner) to be able to save the current settings on an existing preset
- Added variable decimation in log2 increments from 2^0=1 to 2^4=16 allowing to see the full 2048 kHz of spectrum if so you wish - Added variable decimation in log2 increments from 2^0=1 to 2^4=16 allowing to see the full 2048 kHz of spectrum if so you wish
- Better handling of rtlsdr GUI display when settings change (initial load, load of presets) - Better handling of rtlsdr GUI display when settings change (initial load, load of presets)
- Added display and precise control of the shift frequency from center frequency of the NFM receivers.
- Removed useless spectrum visualizer in NFM receivers. Created a null sink class to fit corresponding parameter in NFMDemod class constructor.
===== =====
To Do To Do
===== =====
- Display center frequency of the receiver in scope. Presently there is no way to set the frequency precisely
- AM demod. What about the air band?! - AM demod. What about the air band?!
- Add the possibility to change the brightness and/or color of the grid. Sometimes it is barely visible yet useful - Add the possibility to change the brightness and/or color of the grid. Sometimes it is barely visible yet useful
- Possibility to completely undock the receiver in a separate window. Useful when there are many receivers - Possibility to completely undock the receiver in a separate window. Useful when there are many receivers

View File

@ -0,0 +1,20 @@
#ifndef INCLUDE_NULLSINK_H
#define INCLUDE_NULLSINK_H
#include "dsp/samplesink.h"
#include "util/export.h"
class MessageQueue;
class SDRANGELOVE_API NullSink : public SampleSink {
public:
NullSink();
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
void start();
void stop();
bool handleMessage(Message* message);
};
#endif // INCLUDE_NULLSINK_H

View File

@ -5,7 +5,7 @@
#include "dsp/threadedsamplesink.h" #include "dsp/threadedsamplesink.h"
#include "dsp/channelizer.h" #include "dsp/channelizer.h"
#include "nfmdemod.h" #include "nfmdemod.h"
#include "dsp/spectrumvis.h" #include "dsp/nullsink.h"
#include "gui/glspectrum.h" #include "gui/glspectrum.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
@ -40,7 +40,6 @@ void NFMDemodGUI::resetToDefaults()
ui->volume->setValue(20); ui->volume->setValue(20);
ui->squelch->setValue(-40); ui->squelch->setValue(-40);
ui->deltaFrequency->setValue(0); ui->deltaFrequency->setValue(0);
ui->spectrumGUI->resetToDefaults();
applySettings(); applySettings();
} }
@ -52,7 +51,7 @@ QByteArray NFMDemodGUI::serialize() const
s.writeS32(3, ui->afBW->value()); s.writeS32(3, ui->afBW->value());
s.writeS32(4, ui->volume->value()); s.writeS32(4, ui->volume->value());
s.writeS32(5, ui->squelch->value()); s.writeS32(5, ui->squelch->value());
s.writeBlob(6, ui->spectrumGUI->serialize()); //s.writeBlob(6, ui->spectrumGUI->serialize());
s.writeU32(7, m_channelMarker->getColor().rgb()); s.writeU32(7, m_channelMarker->getColor().rgb());
return s.final(); return s.final();
} }
@ -80,8 +79,8 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
ui->volume->setValue(tmp); ui->volume->setValue(tmp);
d.readS32(5, &tmp, -40); d.readS32(5, &tmp, -40);
ui->squelch->setValue(tmp); ui->squelch->setValue(tmp);
d.readBlob(6, &bytetmp); //d.readBlob(6, &bytetmp);
ui->spectrumGUI->deserialize(bytetmp); //ui->spectrumGUI->deserialize(bytetmp);
if(d.readU32(7, &u32tmp)) if(d.readU32(7, &u32tmp))
m_channelMarker->setColor(u32tmp); m_channelMarker->setColor(u32tmp);
applySettings(); applySettings();
@ -177,19 +176,13 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
m_audioFifo = new AudioFifo(4, 48000); m_audioFifo = new AudioFifo(4, 48000);
m_spectrumVis = new SpectrumVis(ui->glSpectrum); m_nullSink = new NullSink();
m_nfmDemod = new NFMDemod(m_audioFifo, m_spectrumVis); m_nfmDemod = new NFMDemod(m_audioFifo, m_nullSink);
m_channelizer = new Channelizer(m_nfmDemod); m_channelizer = new Channelizer(m_nfmDemod);
m_threadedSampleSink = new ThreadedSampleSink(m_channelizer); m_threadedSampleSink = new ThreadedSampleSink(m_channelizer);
m_pluginAPI->addAudioSource(m_audioFifo); m_pluginAPI->addAudioSource(m_audioFifo);
m_pluginAPI->addSampleSink(m_threadedSampleSink); m_pluginAPI->addSampleSink(m_threadedSampleSink);
ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(48000);
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
m_spectrumVis->configure(m_threadedSampleSink->getMessageQueue(), 64, 10, FFTWindow::BlackmanHarris);
m_channelMarker = new ChannelMarker(this); m_channelMarker = new ChannelMarker(this);
m_channelMarker->setColor(Qt::red); m_channelMarker->setColor(Qt::red);
m_channelMarker->setBandwidth(12500); m_channelMarker->setBandwidth(12500);
@ -198,8 +191,6 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); connect(m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
m_pluginAPI->addChannelMarker(m_channelMarker); m_pluginAPI->addChannelMarker(m_channelMarker);
ui->spectrumGUI->setBuddies(m_threadedSampleSink->getMessageQueue(), m_spectrumVis, ui->glSpectrum);
applySettings(); applySettings();
} }
@ -211,7 +202,7 @@ NFMDemodGUI::~NFMDemodGUI()
delete m_threadedSampleSink; delete m_threadedSampleSink;
delete m_channelizer; delete m_channelizer;
delete m_nfmDemod; delete m_nfmDemod;
delete m_spectrumVis; delete m_nullSink;
delete m_audioFifo; delete m_audioFifo;
delete m_channelMarker; delete m_channelMarker;
delete ui; delete ui;

View File

@ -11,7 +11,7 @@ class AudioFifo;
class ThreadedSampleSink; class ThreadedSampleSink;
class Channelizer; class Channelizer;
class NFMDemod; class NFMDemod;
class SpectrumVis; class NullSink;
namespace Ui { namespace Ui {
class NFMDemodGUI; class NFMDemodGUI;
@ -53,7 +53,7 @@ private:
ThreadedSampleSink* m_threadedSampleSink; ThreadedSampleSink* m_threadedSampleSink;
Channelizer* m_channelizer; Channelizer* m_channelizer;
NFMDemod* m_nfmDemod; NFMDemod* m_nfmDemod;
SpectrumVis* m_spectrumVis; NullSink *m_nullSink;
static const int m_rfBW[]; static const int m_rfBW[];

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>302</width> <width>302</width>
<height>410</height> <height>138</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -244,70 +244,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="spectrumContainer" native="true">
<property name="geometry">
<rect>
<x>40</x>
<y>140</y>
<width>218</width>
<height>184</height>
</rect>
</property>
<property name="windowTitle">
<string>Channel Spectrum</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="GLSpectrum" name="glSpectrum" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>150</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>RollupWidget</class> <class>RollupWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>

43
sdrbase/dsp/nullsink.cpp Normal file
View File

@ -0,0 +1,43 @@
#include "dsp/nullsink.h"
#include "dsp/dspcommands.h"
#include "util/messagequeue.h"
NullSink::NullSink()
{
}
void NullSink::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
{
}
void NullSink::start()
{
}
void NullSink::stop()
{
}
bool NullSink::handleMessage(Message* message)
{
message->completed();
return true;
/*
if(DSPSignalNotification::match(message)) {
DSPSignalNotification* signal = (DSPSignalNotification*)message;
m_sampleRate = signal->getSampleRate();
message->completed();
return true;
} else if(DSPConfigureScopeVis::match(message)) {
DSPConfigureScopeVis* conf = (DSPConfigureScopeVis*)message;
m_triggerState = Untriggered;
m_triggerChannel = (TriggerChannel)conf->getTriggerChannel();
m_triggerLevelHigh = conf->getTriggerLevelHigh() * 32767;
m_triggerLevelLow = conf->getTriggerLevelLow() * 32767;
message->completed();
return true;
} else {
return false;
}
*/
}