mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
Channel Analyzer NG: pass required channel rate to analyzer core
This commit is contained in:
parent
1c04f3f11e
commit
41d031f813
@ -32,16 +32,16 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(BasebandSampleSink* sampleSink) :
|
||||
m_Bandwidth = 5000;
|
||||
m_LowCutoff = 300;
|
||||
m_spanLog2 = 3;
|
||||
m_sampleRate = 96000;
|
||||
m_inputSampleRate = 96000;
|
||||
m_frequency = 0;
|
||||
m_nco.setFreq(m_frequency, m_sampleRate);
|
||||
m_nco.setFreq(m_frequency, m_inputSampleRate);
|
||||
m_undersampleCount = 0;
|
||||
m_sum = 0;
|
||||
m_usb = true;
|
||||
m_ssb = true;
|
||||
m_magsq = 0;
|
||||
SSBFilter = new fftfilt(m_LowCutoff / m_sampleRate, m_Bandwidth / m_sampleRate, ssbFftLen);
|
||||
DSBFilter = new fftfilt(m_Bandwidth / m_sampleRate, 2*ssbFftLen);
|
||||
SSBFilter = new fftfilt(m_LowCutoff / m_inputSampleRate, m_Bandwidth / m_inputSampleRate, ssbFftLen);
|
||||
DSBFilter = new fftfilt(m_Bandwidth / m_inputSampleRate, 2*ssbFftLen);
|
||||
}
|
||||
|
||||
ChannelAnalyzerNG::~ChannelAnalyzerNG()
|
||||
@ -51,12 +51,13 @@ ChannelAnalyzerNG::~ChannelAnalyzerNG()
|
||||
}
|
||||
|
||||
void ChannelAnalyzerNG::configure(MessageQueue* messageQueue,
|
||||
int channelSampleRate,
|
||||
Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
int spanLog2,
|
||||
bool ssb)
|
||||
{
|
||||
Message* cmd = MsgConfigureChannelAnalyzer::create(Bandwidth, LowCutoff, spanLog2, ssb);
|
||||
Message* cmd = MsgConfigureChannelAnalyzer::create(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -140,10 +141,10 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
||||
{
|
||||
DownChannelizer::MsgChannelizerNotification& notif = (DownChannelizer::MsgChannelizerNotification&) cmd;
|
||||
|
||||
m_sampleRate = notif.getSampleRate();
|
||||
m_nco.setFreq(-notif.getFrequencyOffset(), m_sampleRate);
|
||||
m_inputSampleRate = notif.getSampleRate();
|
||||
m_nco.setFreq(-notif.getFrequencyOffset(), m_inputSampleRate);
|
||||
|
||||
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgChannelizerNotification: m_sampleRate: " << m_sampleRate
|
||||
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgChannelizerNotification: m_sampleRate: " << m_inputSampleRate
|
||||
<< " frequencyOffset: " << notif.getFrequencyOffset();
|
||||
|
||||
return true;
|
||||
@ -177,8 +178,8 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
||||
m_Bandwidth = bandwidth;
|
||||
m_LowCutoff = lowCutoff;
|
||||
|
||||
SSBFilter->create_filter(m_LowCutoff / m_sampleRate, m_Bandwidth / m_sampleRate);
|
||||
DSBFilter->create_dsb_filter(m_Bandwidth / m_sampleRate);
|
||||
SSBFilter->create_filter(m_LowCutoff / m_inputSampleRate, m_Bandwidth / m_inputSampleRate);
|
||||
DSBFilter->create_dsb_filter(m_Bandwidth / m_inputSampleRate);
|
||||
|
||||
m_spanLog2 = cfg.getSpanLog2();
|
||||
m_ssb = cfg.getSSB();
|
||||
|
@ -33,12 +33,13 @@ public:
|
||||
virtual ~ChannelAnalyzerNG();
|
||||
|
||||
void configure(MessageQueue* messageQueue,
|
||||
int channelSampleRate,
|
||||
Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
int spanLog2,
|
||||
bool ssb);
|
||||
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
int getSampleRate() const { return m_inputSampleRate; }
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
@ -56,25 +57,31 @@ private:
|
||||
int getSpanLog2() const { return m_spanLog2; }
|
||||
bool getSSB() const { return m_ssb; }
|
||||
|
||||
static MsgConfigureChannelAnalyzer* create(Real Bandwidth,
|
||||
static MsgConfigureChannelAnalyzer* create(
|
||||
int channelSampleRate,
|
||||
Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
int spanLog2,
|
||||
bool ssb)
|
||||
{
|
||||
return new MsgConfigureChannelAnalyzer(Bandwidth, LowCutoff, spanLog2, ssb);
|
||||
return new MsgConfigureChannelAnalyzer(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_channelSampleRate;
|
||||
Real m_Bandwidth;
|
||||
Real m_LowCutoff;
|
||||
int m_spanLog2;
|
||||
bool m_ssb;
|
||||
|
||||
MsgConfigureChannelAnalyzer(Real Bandwidth,
|
||||
MsgConfigureChannelAnalyzer(
|
||||
int channelSampleRate,
|
||||
Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
int spanLog2,
|
||||
bool ssb) :
|
||||
Message(),
|
||||
m_channelSampleRate(channelSampleRate),
|
||||
m_Bandwidth(Bandwidth),
|
||||
m_LowCutoff(LowCutoff),
|
||||
m_spanLog2(spanLog2),
|
||||
@ -87,7 +94,7 @@ private:
|
||||
int m_spanLog2;
|
||||
int m_undersampleCount;
|
||||
fftfilt::cmplx m_sum;
|
||||
int m_sampleRate;
|
||||
int m_inputSampleRate;
|
||||
int m_frequency;
|
||||
bool m_usb;
|
||||
bool m_ssb;
|
||||
|
@ -486,6 +486,7 @@ void ChannelAnalyzerNGGUI::applySettings()
|
||||
m_channelMarker.getCenterFrequency());
|
||||
|
||||
m_channelAnalyzer->configure(m_channelAnalyzer->getInputMessageQueue(),
|
||||
m_channelizer->getInputSampleRate(), // TODO: specify required channel sample rate
|
||||
ui->BW->value() * 100.0,
|
||||
ui->lowCut->value() * 100.0,
|
||||
m_spanLog2,
|
||||
|
Loading…
Reference in New Issue
Block a user