1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 09:31:10 -05:00

Created a spectrum + scope combo VIS to handle the channel analyzer spectrum + scope display

This commit is contained in:
f4exb 2015-06-23 20:05:28 +02:00
parent 87300d3f98
commit a463b1fbc6
9 changed files with 101 additions and 6 deletions

View File

@ -67,6 +67,7 @@ set(sdrbase_SOURCES
sdrbase/dsp/samplefifo.cpp
sdrbase/dsp/samplesink.cpp
sdrbase/dsp/nullsink.cpp
sdrbase/dsp/spectrumscopecombovis.cpp
sdrbase/dsp/scopevis.cpp
sdrbase/dsp/spectrumvis.cpp
sdrbase/dsp/threadedsamplesink.cpp

View File

@ -22,6 +22,7 @@ public:
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
void start();
void stop();
bool handleMessageKeep(Message* message);
bool handleMessage(Message* message);
private:

View File

@ -0,0 +1,26 @@
#ifndef INCLUDE_SPECTRUMSCOPECOMBOVIS_H
#define INCLUDE_SPECTRUMSCOPECOMBOVIS_H
#include "dsp/samplesink.h"
#include "dsp/spectrumvis.h"
#include "dsp/scopevis.h"
#include "util/export.h"
class MessageQueue;
class SDRANGELOVE_API SpectrumScopeComboVis : public SampleSink {
public:
SpectrumScopeComboVis(SpectrumVis* spectrumVis, ScopeVis* scopeVis);
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
void start();
void stop();
bool handleMessage(Message* message);
private:
SpectrumVis* m_spectrumVis;
ScopeVis* m_scopeVis;
};
#endif // INCLUDE_SPECTRUMSCOPECOMBOVIS_H

View File

@ -19,6 +19,7 @@ public:
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
void start();
void stop();
bool handleMessageKeep(Message* message);
bool handleMessage(Message* message);
private:

View File

@ -3,6 +3,7 @@
#include "ui_chanalyzergui.h"
#include "dsp/threadedsamplesink.h"
#include "dsp/channelizer.h"
#include "dsp/spectrumscopecombovis.h"
#include "dsp/spectrumvis.h"
#include "dsp/scopevis.h"
#include "gui/glspectrum.h"
@ -249,7 +250,8 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
m_scopeVis = new ScopeVis(ui->glScope);
m_channelAnalyzer = new ChannelAnalyzer(m_spectrumVis);
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
m_channelAnalyzer = new ChannelAnalyzer(m_spectrumScopeComboVis);
m_channelizer = new Channelizer(m_channelAnalyzer);
m_threadedSampleSink = new ThreadedSampleSink(m_channelizer);
m_pluginAPI->addSampleSink(m_threadedSampleSink);
@ -284,6 +286,7 @@ ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
delete m_channelAnalyzer;
delete m_spectrumVis;
delete m_scopeVis;
delete m_spectrumScopeComboVis;
delete m_channelMarker;
delete ui;
}

View File

@ -11,6 +11,7 @@ class ChannelMarker;
class ThreadedSampleSink;
class Channelizer;
class ChannelAnalyzer;
class SpectrumScopeComboVis;
class SpectrumVis;
class ScopeVis;
@ -56,6 +57,7 @@ private:
ThreadedSampleSink* m_threadedSampleSink;
Channelizer* m_channelizer;
ChannelAnalyzer* m_channelAnalyzer;
SpectrumScopeComboVis* m_spectrumScopeComboVis;
SpectrumVis* m_spectrumVis;
ScopeVis* m_scopeVis;

View File

@ -120,12 +120,11 @@ void ScopeVis::stop()
{
}
bool ScopeVis::handleMessage(Message* message)
bool ScopeVis::handleMessageKeep(Message* message)
{
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;
@ -133,9 +132,20 @@ bool ScopeVis::handleMessage(Message* message)
m_triggerChannel = (TriggerChannel)conf->getTriggerChannel();
m_triggerLevelHigh = conf->getTriggerLevelHigh() * 32767;
m_triggerLevelLow = conf->getTriggerLevelLow() * 32767;
message->completed();
return true;
} else {
return false;
}
}
bool ScopeVis::handleMessage(Message* message)
{
bool done = handleMessageKeep(message);
if (done)
{
message->completed();
}
return done;
}

View File

@ -0,0 +1,40 @@
#include "dsp/spectrumscopecombovis.h"
#include "dsp/dspcommands.h"
#include "util/messagequeue.h"
SpectrumScopeComboVis::SpectrumScopeComboVis(SpectrumVis* spectrumVis, ScopeVis* scopeVis) :
m_spectrumVis(spectrumVis),
m_scopeVis(scopeVis)
{
}
void SpectrumScopeComboVis::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
{
m_spectrumVis->feed(begin, end, positiveOnly);
m_scopeVis->feed(begin, end, false);
}
void SpectrumScopeComboVis::start()
{
m_spectrumVis->start();
m_scopeVis->start();
}
void SpectrumScopeComboVis::stop()
{
m_spectrumVis->stop();
m_scopeVis->stop();
}
bool SpectrumScopeComboVis::handleMessage(Message* message)
{
bool spectDone = m_spectrumVis->handleMessageKeep(message);
bool scopeDone = m_scopeVis->handleMessageKeep(message);
if (spectDone || scopeDone)
{
message->completed();
}
return (spectDone || scopeDone);
}

View File

@ -111,18 +111,29 @@ void SpectrumVis::stop()
{
}
bool SpectrumVis::handleMessage(Message* message)
bool SpectrumVis::handleMessageKeep(Message* message)
{
if(DSPConfigureSpectrumVis::match(message)) {
DSPConfigureSpectrumVis* conf = (DSPConfigureSpectrumVis*)message;
handleConfigure(conf->getFFTSize(), conf->getOverlapPercent(), conf->getWindow());
message->completed();
return true;
} else {
return false;
}
}
bool SpectrumVis::handleMessage(Message* message)
{
bool done = handleMessageKeep(message);
if (done)
{
message->completed();
}
return done;
}
void SpectrumVis::handleConfigure(int fftSize, int overlapPercent, FFTWindow::Function window)
{
if(fftSize > MAX_FFT_SIZE)