mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
Channel Analyzer NG: put spanLog2 and ssb indicator in config structure
This commit is contained in:
parent
2421dd4e1d
commit
3a32d5aec3
@ -29,11 +29,9 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(BasebandSampleSink* sampleSink) :
|
||||
m_sampleSink(sampleSink),
|
||||
m_settingsMutex(QMutex::Recursive)
|
||||
{
|
||||
m_spanLog2 = 3;
|
||||
m_undersampleCount = 0;
|
||||
m_sum = 0;
|
||||
m_usb = true;
|
||||
m_ssb = true;
|
||||
m_magsq = 0;
|
||||
m_interpolatorDistance = 1.0f;
|
||||
m_interpolatorDistanceRemain = 0.0f;
|
||||
@ -63,7 +61,7 @@ void ChannelAnalyzerNG::feed(const SampleVector::const_iterator& begin, const Sa
|
||||
{
|
||||
fftfilt::cmplx *sideband;
|
||||
int n_out;
|
||||
int decim = 1<<m_spanLog2;
|
||||
int decim = 1<<m_running.m_spanLog2;
|
||||
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||
|
||||
m_settingsMutex.lock();
|
||||
@ -74,7 +72,7 @@ void ChannelAnalyzerNG::feed(const SampleVector::const_iterator& begin, const Sa
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if (m_ssb)
|
||||
if (m_running.m_ssb)
|
||||
{
|
||||
n_out = SSBFilter->runSSB(c, &sideband, m_usb);
|
||||
}
|
||||
@ -95,7 +93,7 @@ void ChannelAnalyzerNG::feed(const SampleVector::const_iterator& begin, const Sa
|
||||
m_sum /= decim;
|
||||
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
|
||||
|
||||
if (m_ssb & !m_usb)
|
||||
if (m_running.m_ssb & !m_usb)
|
||||
{ // invert spectrum for LSB
|
||||
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
|
||||
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
|
||||
@ -113,7 +111,7 @@ void ChannelAnalyzerNG::feed(const SampleVector::const_iterator& begin, const Sa
|
||||
|
||||
if(m_sampleSink != NULL)
|
||||
{
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_ssb); // m_ssb = positive only
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_running.m_ssb); // m_ssb = positive only
|
||||
}
|
||||
|
||||
m_sampleBuffer.clear();
|
||||
@ -156,23 +154,17 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
||||
m_config.m_channelSampleRate = cfg.getChannelSampleRate();
|
||||
m_config.m_Bandwidth = cfg.getBandwidth();
|
||||
m_config.m_LowCutoff = cfg.getLoCutoff();
|
||||
m_config.m_spanLog2 = cfg.getSpanLog2();
|
||||
m_config.m_ssb = cfg.getSSB();
|
||||
|
||||
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgConfigureChannelAnalyzer:"
|
||||
<< " m_channelSampleRate: " << m_config.m_channelSampleRate
|
||||
<< " m_Bandwidth: " << m_config.m_Bandwidth
|
||||
<< " m_LowCutoff: " << m_config.m_LowCutoff
|
||||
<< " m_spanLog2: " << m_spanLog2
|
||||
<< " m_ssb: " << m_ssb;
|
||||
<< " m_spanLog2: " << m_config.m_spanLog2
|
||||
<< " m_ssb: " << m_config.m_ssb;
|
||||
|
||||
apply();
|
||||
|
||||
//m_settingsMutex.lock();
|
||||
|
||||
m_spanLog2 = cfg.getSpanLog2();
|
||||
m_ssb = cfg.getSSB();
|
||||
|
||||
//m_settingsMutex.unlock();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -246,4 +238,9 @@ void ChannelAnalyzerNG::apply(bool force)
|
||||
m_running.m_inputSampleRate = m_config.m_inputSampleRate;
|
||||
m_running.m_Bandwidth = m_config.m_Bandwidth;
|
||||
m_running.m_LowCutoff = m_config.m_LowCutoff;
|
||||
|
||||
//m_settingsMutex.lock();
|
||||
m_running.m_spanLog2 = m_config.m_spanLog2;
|
||||
m_running.m_ssb = m_config.m_ssb;
|
||||
//m_settingsMutex.unlock();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
int spanLog2,
|
||||
bool ssb);
|
||||
|
||||
int getSampleRate() const { return m_running.m_inputSampleRate; }
|
||||
int getInputSampleRate() const { return m_running.m_inputSampleRate; }
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
@ -99,24 +99,26 @@ private:
|
||||
int m_channelSampleRate;
|
||||
Real m_Bandwidth;
|
||||
Real m_LowCutoff;
|
||||
int m_spanLog2;
|
||||
bool m_ssb;
|
||||
|
||||
Config() :
|
||||
m_frequency(0),
|
||||
m_inputSampleRate(96000),
|
||||
m_channelSampleRate(96000),
|
||||
m_Bandwidth(5000),
|
||||
m_LowCutoff(300)
|
||||
m_LowCutoff(300),
|
||||
m_spanLog2(3),
|
||||
m_ssb(false)
|
||||
{}
|
||||
};
|
||||
|
||||
Config m_config;
|
||||
Config m_running;
|
||||
|
||||
int m_spanLog2;
|
||||
int m_undersampleCount;
|
||||
fftfilt::cmplx m_sum;
|
||||
bool m_usb;
|
||||
bool m_ssb;
|
||||
Real m_magsq;
|
||||
|
||||
NCOF m_nco;
|
||||
|
@ -392,8 +392,8 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
|
||||
{
|
||||
qDebug("ChannelAnalyzerNGGUI::setNewRate");
|
||||
|
||||
ui->channelSampleRate->setValueRange(7, 0, m_channelAnalyzer->getSampleRate());
|
||||
ui->channelSampleRate->setValue(m_channelAnalyzer->getSampleRate());
|
||||
ui->channelSampleRate->setValueRange(7, 0, m_channelAnalyzer->getInputSampleRate());
|
||||
ui->channelSampleRate->setValue(m_channelAnalyzer->getInputSampleRate());
|
||||
|
||||
if ((spanLog2 < 0) || (spanLog2 > 6)) {
|
||||
return false;
|
||||
@ -401,7 +401,7 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
|
||||
|
||||
m_spanLog2 = spanLog2;
|
||||
//m_rate = 48000 / (1<<spanLog2);
|
||||
m_rate = m_channelAnalyzer->getSampleRate() / (1<<spanLog2);
|
||||
m_rate = m_channelAnalyzer->getInputSampleRate() / (1<<spanLog2);
|
||||
|
||||
setFiltersUIBoundaries();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user