mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Created a spectrum + scope combo VIS to handle the channel analyzer spectrum + scope display
This commit is contained in:
parent
87300d3f98
commit
a463b1fbc6
@ -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
|
||||
|
@ -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:
|
||||
|
26
include-gpl/dsp/spectrumscopecombovis.h
Normal file
26
include-gpl/dsp/spectrumscopecombovis.h
Normal 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
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
40
sdrbase/dsp/spectrumscopecombovis.cpp
Normal file
40
sdrbase/dsp/spectrumscopecombovis.cpp
Normal 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);
|
||||
}
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user