mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
Prepare unique sample thread for scope and spectrum views
This commit is contained in:
parent
d7c7023bb5
commit
87300d3f98
@ -26,9 +26,8 @@
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(ChannelAnalyzer::MsgConfigureChannelAnalyzer, Message)
|
||||
|
||||
ChannelAnalyzer::ChannelAnalyzer(SampleSink* spectrumSink, SampleSink* scopeSink) :
|
||||
m_spectrumSink(spectrumSink),
|
||||
m_scopeSink(scopeSink)
|
||||
ChannelAnalyzer::ChannelAnalyzer(SampleSink* sampleSink) :
|
||||
m_sampleSink(sampleSink)
|
||||
{
|
||||
m_Bandwidth = 5000;
|
||||
m_LowCutoff = 300;
|
||||
@ -102,14 +101,9 @@ void ChannelAnalyzer::feed(SampleVector::const_iterator begin, SampleVector::con
|
||||
}
|
||||
}
|
||||
|
||||
if(m_spectrumSink != NULL)
|
||||
if(m_sampleSink != NULL)
|
||||
{
|
||||
m_spectrumSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_ssb); // m_ssb = positive only
|
||||
}
|
||||
|
||||
if(m_scopeSink != NULL)
|
||||
{
|
||||
m_scopeSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false); // positive only is unused
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_ssb); // m_ssb = positive only
|
||||
}
|
||||
|
||||
m_sampleBuffer.clear();
|
||||
@ -166,8 +160,8 @@ bool ChannelAnalyzer::handleMessage(Message* cmd)
|
||||
cmd->completed();
|
||||
return true;
|
||||
} else {
|
||||
if(m_spectrumSink != NULL)
|
||||
return m_spectrumSink->handleMessage(cmd);
|
||||
if(m_sampleSink != NULL)
|
||||
return m_sampleSink->handleMessage(cmd);
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
class ChannelAnalyzer : public SampleSink {
|
||||
public:
|
||||
ChannelAnalyzer(SampleSink* spectrumSink, SampleSink* scopeSink);
|
||||
ChannelAnalyzer(SampleSink* m_sampleSink);
|
||||
~ChannelAnalyzer();
|
||||
|
||||
void configure(MessageQueue* messageQueue,
|
||||
@ -100,8 +100,7 @@ private:
|
||||
fftfilt* SSBFilter;
|
||||
fftfilt* DSBFilter;
|
||||
|
||||
SampleSink* m_spectrumSink;
|
||||
SampleSink* m_scopeSink;
|
||||
SampleSink* m_sampleSink;
|
||||
SampleVector m_sampleBuffer;
|
||||
};
|
||||
|
||||
|
@ -249,12 +249,10 @@ 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_scopeVis);
|
||||
m_channelAnalyzer = new ChannelAnalyzer(m_spectrumVis);
|
||||
m_channelizer = new Channelizer(m_channelAnalyzer);
|
||||
m_threadedSpectrumSampleSink = new ThreadedSampleSink(m_channelizer);
|
||||
m_pluginAPI->addSampleSink(m_threadedSpectrumSampleSink);
|
||||
m_threadedScopeSampleSink = new ThreadedSampleSink(m_channelizer);
|
||||
m_pluginAPI->addSampleSink(m_threadedScopeSampleSink);
|
||||
m_threadedSampleSink = new ThreadedSampleSink(m_channelizer);
|
||||
m_pluginAPI->addSampleSink(m_threadedSampleSink);
|
||||
|
||||
ui->glSpectrum->setCenterFrequency(m_rate/2);
|
||||
ui->glSpectrum->setSampleRate(m_rate);
|
||||
@ -271,8 +269,8 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
|
||||
m_pluginAPI->addChannelMarker(m_channelMarker);
|
||||
|
||||
ui->spectrumGUI->setBuddies(m_threadedSpectrumSampleSink->getMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
||||
ui->scopeGUI->setBuddies(m_threadedScopeSampleSink->getMessageQueue(), m_scopeVis, ui->glScope);
|
||||
ui->spectrumGUI->setBuddies(m_threadedSampleSink->getMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
||||
ui->scopeGUI->setBuddies(m_threadedSampleSink->getMessageQueue(), m_scopeVis, ui->glScope);
|
||||
|
||||
applySettings();
|
||||
}
|
||||
@ -280,10 +278,8 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
|
||||
{
|
||||
m_pluginAPI->removeChannelInstance(this);
|
||||
m_pluginAPI->removeSampleSink(m_threadedSpectrumSampleSink);
|
||||
m_pluginAPI->removeSampleSink(m_threadedScopeSampleSink);
|
||||
delete m_threadedSpectrumSampleSink;
|
||||
delete m_threadedScopeSampleSink;
|
||||
m_pluginAPI->removeSampleSink(m_threadedSampleSink);
|
||||
delete m_threadedSampleSink;
|
||||
delete m_channelizer;
|
||||
delete m_channelAnalyzer;
|
||||
delete m_spectrumVis;
|
||||
@ -353,10 +349,10 @@ void ChannelAnalyzerGUI::applySettings()
|
||||
setTitleColor(m_channelMarker->getColor());
|
||||
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
|
||||
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
|
||||
m_channelizer->configure(m_threadedSpectrumSampleSink->getMessageQueue(),
|
||||
m_channelizer->configure(m_threadedSampleSink->getMessageQueue(),
|
||||
48000,
|
||||
m_channelMarker->getCenterFrequency());
|
||||
m_channelAnalyzer->configure(m_threadedSpectrumSampleSink->getMessageQueue(),
|
||||
m_channelAnalyzer->configure(m_threadedSampleSink->getMessageQueue(),
|
||||
ui->BW->value() * 100.0,
|
||||
ui->lowCut->value() * 100.0,
|
||||
m_spanLog2,
|
||||
|
@ -53,8 +53,7 @@ private:
|
||||
int m_rate;
|
||||
int m_spanLog2;
|
||||
|
||||
ThreadedSampleSink* m_threadedSpectrumSampleSink;
|
||||
ThreadedSampleSink* m_threadedScopeSampleSink;
|
||||
ThreadedSampleSink* m_threadedSampleSink;
|
||||
Channelizer* m_channelizer;
|
||||
ChannelAnalyzer* m_channelAnalyzer;
|
||||
SpectrumVis* m_spectrumVis;
|
||||
|
Loading…
Reference in New Issue
Block a user