mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Set channel analyzer bandwidth before decimation to channelizer input sample rate
This commit is contained in:
parent
76c2843a39
commit
c624ad0e13
@ -9,11 +9,13 @@ class MessageQueue;
|
||||
class IntHalfbandFilter;
|
||||
|
||||
class SDRANGELOVE_API Channelizer : public SampleSink {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Channelizer(SampleSink* sampleSink);
|
||||
~Channelizer();
|
||||
|
||||
void configure(MessageQueue* messageQueue, int sampleRate, int centerFrequency);
|
||||
int getInputSampleRate() const { return m_inputSampleRate; }
|
||||
|
||||
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
||||
void start();
|
||||
@ -54,6 +56,9 @@ protected:
|
||||
bool signalContainsChannel(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd) const;
|
||||
Real createFilterChain(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd);
|
||||
void freeFilterChain();
|
||||
|
||||
signals:
|
||||
void inputSampleRateChanged();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_CHANNELIZER_H
|
||||
|
@ -123,7 +123,7 @@ bool ChannelAnalyzer::handleMessage(Message* cmd)
|
||||
|
||||
if(DSPSignalNotification::match(cmd)) {
|
||||
DSPSignalNotification* signal = (DSPSignalNotification*)cmd;
|
||||
//fprintf(stderr, "%d samples/sec, %lld Hz offset", signal->getSampleRate(), signal->getFrequencyOffset());
|
||||
fprintf(stderr, "ChannelAnalyzer::handleMessage: %d samples/sec, %lld Hz offset\n", signal->getSampleRate(), signal->getFrequencyOffset());
|
||||
m_sampleRate = signal->getSampleRate();
|
||||
m_nco.setFreq(-signal->getFrequencyOffset(), m_sampleRate);
|
||||
cmd->completed();
|
||||
|
@ -108,6 +108,11 @@ void ChannelAnalyzerGUI::viewChanged()
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void ChannelAnalyzerGUI::channelSampleRateChanged()
|
||||
{
|
||||
setNewRate(m_spanLog2);
|
||||
}
|
||||
|
||||
void ChannelAnalyzerGUI::on_deltaMinus_clicked(bool minus)
|
||||
{
|
||||
int deltaFrequency = m_channelMarker->getCenterFrequency();
|
||||
@ -256,6 +261,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
|
||||
m_channelAnalyzer = new ChannelAnalyzer(m_spectrumScopeComboVis);
|
||||
m_channelizer = new Channelizer(m_channelAnalyzer);
|
||||
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
|
||||
m_threadedSampleSink = new ThreadedSampleSink(m_channelizer);
|
||||
m_pluginAPI->addSampleSink(m_threadedSampleSink);
|
||||
|
||||
@ -360,7 +366,7 @@ void ChannelAnalyzerGUI::applySettings()
|
||||
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
|
||||
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
|
||||
m_channelizer->configure(m_threadedSampleSink->getMessageQueue(),
|
||||
48000,
|
||||
m_channelizer->getInputSampleRate(),
|
||||
m_channelMarker->getCenterFrequency());
|
||||
m_channelAnalyzer->configure(m_threadedSampleSink->getMessageQueue(),
|
||||
ui->BW->value() * 100.0,
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void viewChanged();
|
||||
void channelSampleRateChanged();
|
||||
void on_deltaFrequency_changed(quint64 value);
|
||||
void on_deltaMinus_clicked(bool minus);
|
||||
void on_BW_valueChanged(int value);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
|
||||
//#include <cstdio>
|
||||
//#include <iostream>
|
||||
#include <iostream>
|
||||
|
||||
Channelizer::Channelizer(SampleSink* sampleSink) :
|
||||
m_sampleSink(sampleSink),
|
||||
@ -73,6 +73,7 @@ bool Channelizer::handleMessage(Message* cmd)
|
||||
if(!m_sampleSink->handleMessage(signal))
|
||||
signal->completed();
|
||||
}
|
||||
emit inputSampleRateChanged();
|
||||
return true;
|
||||
} else if(DSPConfigureChannelizer::match(cmd)) {
|
||||
DSPConfigureChannelizer* chan = (DSPConfigureChannelizer*)cmd;
|
||||
@ -100,13 +101,12 @@ void Channelizer::applyConfiguration()
|
||||
m_inputSampleRate / -2, m_inputSampleRate / 2,
|
||||
m_requestedCenterFrequency - m_requestedOutputSampleRate / 2, m_requestedCenterFrequency + m_requestedOutputSampleRate / 2);
|
||||
m_currentOutputSampleRate = m_inputSampleRate / (1 << m_filterStages.size());
|
||||
/*
|
||||
|
||||
std::cerr << "Channelizer::applyConfiguration in=" << m_inputSampleRate
|
||||
<< ", req=" << m_requestedOutputSampleRate
|
||||
<< ", out=" << m_currentOutputSampleRate
|
||||
<< ", fc=" << m_currentCenterFrequency
|
||||
<< std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
Channelizer::FilterStage::FilterStage(Mode mode) :
|
||||
|
@ -62,6 +62,8 @@ void GLScope::setDSPEngine(DSPEngine* dspEngine)
|
||||
|
||||
void GLScope::setSampleRate(int sampleRate) {
|
||||
m_sampleRate = sampleRate;
|
||||
m_configChanged = true;
|
||||
update();
|
||||
emit sampleRateChanged(m_sampleRate);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user