2018-05-15 07:17:54 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
2019-04-11 04:39:30 +00:00
|
|
|
// (at your option) any later version. //
|
2018-05-15 07:17:54 +00:00
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QTime>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2019-05-08 20:11:53 +00:00
|
|
|
#include "device/deviceapi.h"
|
2018-05-15 07:17:54 +00:00
|
|
|
#include "audio/audiooutput.h"
|
|
|
|
#include "dsp/threadedbasebandsamplesink.h"
|
|
|
|
#include "dsp/downchannelizer.h"
|
2018-05-30 13:37:56 +00:00
|
|
|
#include "chanalyzer.h"
|
2018-05-15 07:17:54 +00:00
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
MESSAGE_CLASS_DEFINITION(ChannelAnalyzer::MsgConfigureChannelAnalyzer, Message)
|
|
|
|
MESSAGE_CLASS_DEFINITION(ChannelAnalyzer::MsgConfigureChannelizer, Message)
|
|
|
|
MESSAGE_CLASS_DEFINITION(ChannelAnalyzer::MsgReportChannelSampleRateChanged, Message)
|
2018-05-15 07:17:54 +00:00
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
const QString ChannelAnalyzer::m_channelIdURI = "sdrangel.channel.chanalyzer";
|
|
|
|
const QString ChannelAnalyzer::m_channelId = "ChannelAnalyzer";
|
2018-05-15 07:17:54 +00:00
|
|
|
|
2019-05-08 20:11:53 +00:00
|
|
|
ChannelAnalyzer::ChannelAnalyzer(DeviceAPI *deviceAPI) :
|
2019-05-09 15:27:12 +00:00
|
|
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
|
2018-05-15 07:17:54 +00:00
|
|
|
m_deviceAPI(deviceAPI),
|
|
|
|
m_sampleSink(0),
|
|
|
|
m_settingsMutex(QMutex::Recursive)
|
|
|
|
{
|
|
|
|
setObjectName(m_channelId);
|
|
|
|
|
|
|
|
m_undersampleCount = 0;
|
|
|
|
m_sum = 0;
|
|
|
|
m_usb = true;
|
|
|
|
m_magsq = 0;
|
|
|
|
m_useInterpolator = false;
|
|
|
|
m_interpolatorDistance = 1.0f;
|
|
|
|
m_interpolatorDistanceRemain = 0.0f;
|
2018-05-19 23:10:08 +00:00
|
|
|
m_inputSampleRate = 48000;
|
|
|
|
m_inputFrequencyOffset = 0;
|
|
|
|
SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_inputSampleRate, m_settings.m_bandwidth / m_inputSampleRate, ssbFftLen);
|
|
|
|
DSBFilter = new fftfilt(m_settings.m_bandwidth / m_inputSampleRate, 2*ssbFftLen);
|
2018-05-22 00:20:36 +00:00
|
|
|
RRCFilter = new fftfilt(m_settings.m_bandwidth / m_inputSampleRate, 2*ssbFftLen);
|
2019-08-17 23:58:09 +00:00
|
|
|
m_corr = new fftcorr2(8*ssbFftLen); // 8k for 4k effective samples
|
2018-05-15 07:17:54 +00:00
|
|
|
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
|
|
|
|
|
2018-05-19 23:10:08 +00:00
|
|
|
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
|
|
|
|
applySettings(m_settings, true);
|
2018-05-15 07:17:54 +00:00
|
|
|
|
|
|
|
m_channelizer = new DownChannelizer(this);
|
|
|
|
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
2019-05-08 20:11:53 +00:00
|
|
|
m_deviceAPI->addChannelSink(m_threadedChannelizer);
|
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
2018-05-15 07:17:54 +00:00
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
ChannelAnalyzer::~ChannelAnalyzer()
|
2018-05-15 07:17:54 +00:00
|
|
|
{
|
2019-05-08 20:11:53 +00:00
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(m_threadedChannelizer);
|
2018-05-15 07:17:54 +00:00
|
|
|
delete m_threadedChannelizer;
|
|
|
|
delete m_channelizer;
|
|
|
|
delete SSBFilter;
|
|
|
|
delete DSBFilter;
|
2018-05-22 00:20:36 +00:00
|
|
|
delete RRCFilter;
|
2019-08-17 23:58:09 +00:00
|
|
|
delete m_corr;
|
2018-05-15 07:17:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-12 23:45:03 +00:00
|
|
|
void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
2018-05-15 07:17:54 +00:00
|
|
|
{
|
2018-11-12 23:45:03 +00:00
|
|
|
(void) positiveOnly;
|
2018-05-15 07:17:54 +00:00
|
|
|
fftfilt::cmplx *sideband = 0;
|
|
|
|
Complex ci;
|
|
|
|
|
|
|
|
m_settingsMutex.lock();
|
|
|
|
|
|
|
|
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
|
|
|
{
|
|
|
|
Complex c(it->real(), it->imag());
|
|
|
|
c *= m_nco.nextIQ();
|
|
|
|
|
|
|
|
if (m_useInterpolator)
|
|
|
|
{
|
|
|
|
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
|
|
|
|
{
|
|
|
|
processOneSample(ci, sideband);
|
|
|
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
processOneSample(c, sideband);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(m_sampleSink != 0)
|
|
|
|
{
|
2018-05-19 23:10:08 +00:00
|
|
|
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_settings.m_ssb); // m_ssb = positive only
|
2018-05-15 07:17:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_sampleBuffer.clear();
|
|
|
|
|
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::processOneSample(Complex& c, fftfilt::cmplx *sideband)
|
2018-05-19 23:10:08 +00:00
|
|
|
{
|
|
|
|
int n_out;
|
|
|
|
int decim = 1<<m_settings.m_spanLog2;
|
|
|
|
|
2018-05-22 00:20:36 +00:00
|
|
|
if (m_settings.m_ssb)
|
|
|
|
{
|
2018-05-19 23:10:08 +00:00
|
|
|
n_out = SSBFilter->runSSB(c, &sideband, m_usb);
|
2018-05-22 00:20:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_settings.m_rrc) {
|
|
|
|
n_out = RRCFilter->runFilt(c, &sideband);
|
|
|
|
} else {
|
|
|
|
n_out = DSBFilter->runDSB(c, &sideband);
|
|
|
|
}
|
2018-05-19 23:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < n_out; i++)
|
|
|
|
{
|
|
|
|
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
|
|
|
// smart decimation with bit gain using float arithmetic (23 bits significand)
|
|
|
|
|
|
|
|
m_sum += sideband[i];
|
|
|
|
|
|
|
|
if (!(m_undersampleCount++ & (decim - 1))) // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
|
|
|
{
|
|
|
|
m_sum /= decim;
|
2018-05-20 16:17:53 +00:00
|
|
|
Real re = m_sum.real() / SDR_RX_SCALEF;
|
|
|
|
Real im = m_sum.imag() / SDR_RX_SCALEF;
|
2018-05-19 23:10:08 +00:00
|
|
|
m_magsq = re*re + im*im;
|
2018-06-26 18:03:56 +00:00
|
|
|
m_channelPowerAvg(m_magsq);
|
2018-05-20 09:54:05 +00:00
|
|
|
std::complex<float> mix;
|
2018-05-19 23:10:08 +00:00
|
|
|
|
|
|
|
if (m_settings.m_pll)
|
|
|
|
{
|
|
|
|
if (m_settings.m_fll)
|
|
|
|
{
|
|
|
|
m_fll.feed(re, im);
|
|
|
|
// Use -fPLL to mix (exchange PLL real and image in the complex multiplication)
|
2018-05-20 09:54:05 +00:00
|
|
|
mix = m_sum * std::conj(m_fll.getComplex());
|
2018-05-19 23:10:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_pll.feed(re, im);
|
|
|
|
// Use -fPLL to mix (exchange PLL real and image in the complex multiplication)
|
2018-05-20 09:54:05 +00:00
|
|
|
mix = m_sum * std::conj(m_pll.getComplex());
|
2018-05-19 23:10:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-20 09:54:05 +00:00
|
|
|
feedOneSample(m_settings.m_pll ? mix : m_sum, m_settings.m_fll ? m_fll.getComplex() : m_pll.getComplex());
|
2018-05-19 23:10:08 +00:00
|
|
|
m_sum = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::start()
|
2018-05-15 07:17:54 +00:00
|
|
|
{
|
2018-05-19 23:10:08 +00:00
|
|
|
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
|
2018-05-15 07:17:54 +00:00
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::stop()
|
2018-05-15 07:17:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
bool ChannelAnalyzer::handleMessage(const Message& cmd)
|
2018-05-15 07:17:54 +00:00
|
|
|
{
|
|
|
|
if (DownChannelizer::MsgChannelizerNotification::match(cmd))
|
|
|
|
{
|
|
|
|
DownChannelizer::MsgChannelizerNotification& notif = (DownChannelizer::MsgChannelizerNotification&) cmd;
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug() << "ChannelAnalyzer::handleMessage: DownChannelizer::MsgChannelizerNotification:"
|
2018-05-19 23:10:08 +00:00
|
|
|
<< " sampleRate: " << notif.getSampleRate()
|
|
|
|
<< " frequencyOffset: " << notif.getFrequencyOffset();
|
2018-05-15 07:17:54 +00:00
|
|
|
|
2018-05-19 23:10:08 +00:00
|
|
|
applyChannelSettings(notif.getSampleRate(), notif.getFrequencyOffset());
|
2018-05-15 07:17:54 +00:00
|
|
|
|
|
|
|
if (getMessageQueueToGUI())
|
|
|
|
{
|
|
|
|
MsgReportChannelSampleRateChanged *msg = MsgReportChannelSampleRateChanged::create();
|
|
|
|
getMessageQueueToGUI()->push(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (MsgConfigureChannelizer::match(cmd))
|
|
|
|
{
|
|
|
|
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug() << "ChannelAnalyzer::handleMessage: MsgConfigureChannelizer:"
|
2018-05-19 23:10:08 +00:00
|
|
|
<< " sampleRate: " << cfg.getSampleRate()
|
|
|
|
<< " centerFrequency: " << cfg.getCenterFrequency();
|
|
|
|
|
2018-05-15 07:17:54 +00:00
|
|
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
2018-05-19 23:10:08 +00:00
|
|
|
cfg.getSampleRate(),
|
|
|
|
cfg.getCenterFrequency());
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (MsgConfigureChannelAnalyzer::match(cmd))
|
|
|
|
{
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug("ChannelAnalyzer::handleMessage: MsgConfigureChannelAnalyzer");
|
2018-05-19 23:10:08 +00:00
|
|
|
MsgConfigureChannelAnalyzer& cfg = (MsgConfigureChannelAnalyzer&) cmd;
|
|
|
|
|
|
|
|
applySettings(cfg.getSettings(), cfg.getForce());
|
|
|
|
|
2018-05-15 07:17:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-09 23:52:05 +00:00
|
|
|
// Processed through GUI
|
|
|
|
// if (m_sampleSink != 0)
|
|
|
|
// {
|
|
|
|
// return m_sampleSink->handleMessage(cmd);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
return false;
|
2018-05-15 07:17:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force)
|
2018-05-19 03:03:56 +00:00
|
|
|
{
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug() << "ChannelAnalyzer::applyChannelSettings:"
|
2018-05-19 03:03:56 +00:00
|
|
|
<< " inputSampleRate: " << inputSampleRate
|
|
|
|
<< " inputFrequencyOffset: " << inputFrequencyOffset;
|
|
|
|
|
|
|
|
if ((m_inputFrequencyOffset != inputFrequencyOffset) ||
|
|
|
|
(m_inputSampleRate != inputSampleRate) || force)
|
|
|
|
{
|
|
|
|
m_nco.setFreq(-inputFrequencyOffset, inputSampleRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((m_inputSampleRate != inputSampleRate) || force)
|
|
|
|
{
|
|
|
|
m_settingsMutex.lock();
|
|
|
|
|
|
|
|
m_interpolator.create(16, inputSampleRate, inputSampleRate / 2.2f);
|
|
|
|
m_interpolatorDistanceRemain = 0;
|
|
|
|
m_interpolatorDistance = (Real) inputSampleRate / (Real) m_settings.m_downSampleRate;
|
|
|
|
|
|
|
|
if (!m_settings.m_downSample)
|
|
|
|
{
|
|
|
|
setFilters(inputSampleRate, m_settings.m_bandwidth, m_settings.m_lowCutoff);
|
|
|
|
m_pll.setSampleRate(inputSampleRate / (1<<m_settings.m_spanLog2));
|
|
|
|
m_fll.setSampleRate(inputSampleRate / (1<<m_settings.m_spanLog2));
|
|
|
|
}
|
|
|
|
|
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_inputSampleRate = inputSampleRate;
|
|
|
|
m_inputFrequencyOffset = inputFrequencyOffset;
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::setFilters(int sampleRate, float bandwidth, float lowCutoff)
|
2018-05-19 03:03:56 +00:00
|
|
|
{
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug("ChannelAnalyzer::setFilters: sampleRate: %d bandwidth: %f lowCutoff: %f",
|
2018-05-19 23:10:08 +00:00
|
|
|
sampleRate, bandwidth, lowCutoff);
|
|
|
|
|
2018-05-19 03:03:56 +00:00
|
|
|
if (bandwidth < 0)
|
|
|
|
{
|
|
|
|
bandwidth = -bandwidth;
|
|
|
|
lowCutoff = -lowCutoff;
|
|
|
|
m_usb = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_usb = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bandwidth < 100.0f)
|
|
|
|
{
|
|
|
|
bandwidth = 100.0f;
|
|
|
|
lowCutoff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SSBFilter->create_filter(lowCutoff / sampleRate, bandwidth / sampleRate);
|
|
|
|
DSBFilter->create_dsb_filter(bandwidth / sampleRate);
|
2018-05-22 00:20:36 +00:00
|
|
|
RRCFilter->create_rrc_filter(bandwidth / sampleRate, m_settings.m_rrcRolloff / 100.0);
|
2018-05-19 03:03:56 +00:00
|
|
|
}
|
|
|
|
|
2018-05-30 13:37:56 +00:00
|
|
|
void ChannelAnalyzer::applySettings(const ChannelAnalyzerSettings& settings, bool force)
|
2018-05-19 03:03:56 +00:00
|
|
|
{
|
2018-05-30 13:49:28 +00:00
|
|
|
qDebug() << "ChannelAnalyzer::applySettings:"
|
2018-05-19 23:10:08 +00:00
|
|
|
<< " m_downSample: " << settings.m_downSample
|
|
|
|
<< " m_downSampleRate: " << settings.m_downSampleRate
|
2018-05-22 00:20:36 +00:00
|
|
|
<< " m_rcc: " << settings.m_rrc
|
|
|
|
<< " m_rrcRolloff: " << settings.m_rrcRolloff / 100.0
|
2018-05-19 23:10:08 +00:00
|
|
|
<< " m_bandwidth: " << settings.m_bandwidth
|
|
|
|
<< " m_lowCutoff: " << settings.m_lowCutoff
|
|
|
|
<< " m_spanLog2: " << settings.m_spanLog2
|
|
|
|
<< " m_ssb: " << settings.m_ssb
|
|
|
|
<< " m_pll: " << settings.m_pll
|
|
|
|
<< " m_fll: " << settings.m_fll
|
2018-05-20 16:17:53 +00:00
|
|
|
<< " m_pllPskOrder: " << settings.m_pllPskOrder
|
|
|
|
<< " m_inputType: " << (int) settings.m_inputType;
|
2018-05-19 23:10:08 +00:00
|
|
|
|
2018-05-19 03:03:56 +00:00
|
|
|
if ((settings.m_downSampleRate != m_settings.m_downSampleRate) || force)
|
|
|
|
{
|
|
|
|
m_settingsMutex.lock();
|
|
|
|
m_interpolator.create(16, m_inputSampleRate, m_inputSampleRate / 2.2);
|
|
|
|
m_interpolatorDistanceRemain = 0.0f;
|
|
|
|
m_interpolatorDistance = (Real) m_inputSampleRate / (Real) settings.m_downSampleRate;
|
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((settings.m_downSample != m_settings.m_downSample) || force)
|
|
|
|
{
|
2018-05-19 03:10:17 +00:00
|
|
|
int sampleRate = settings.m_downSample ? settings.m_downSampleRate : m_inputSampleRate;
|
|
|
|
|
2018-05-19 03:03:56 +00:00
|
|
|
m_settingsMutex.lock();
|
|
|
|
m_useInterpolator = settings.m_downSample;
|
2018-05-19 03:10:17 +00:00
|
|
|
setFilters(sampleRate, settings.m_bandwidth, settings.m_lowCutoff);
|
|
|
|
m_pll.setSampleRate(sampleRate / (1<<settings.m_spanLog2));
|
|
|
|
m_fll.setSampleRate(sampleRate / (1<<settings.m_spanLog2));
|
2018-05-19 03:03:56 +00:00
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((settings.m_bandwidth != m_settings.m_bandwidth) ||
|
|
|
|
(settings.m_lowCutoff != m_settings.m_lowCutoff)|| force)
|
|
|
|
{
|
|
|
|
m_settingsMutex.lock();
|
|
|
|
setFilters(settings.m_downSample ? settings.m_downSampleRate : m_inputSampleRate, settings.m_bandwidth, settings.m_lowCutoff);
|
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
2018-05-22 00:20:36 +00:00
|
|
|
if ((settings.m_rrcRolloff != m_settings.m_rrcRolloff) || force)
|
|
|
|
{
|
|
|
|
float sampleRate = settings.m_downSample ? (float) settings.m_downSampleRate : (float) m_inputSampleRate;
|
|
|
|
m_settingsMutex.lock();
|
|
|
|
RRCFilter->create_rrc_filter(settings.m_bandwidth / sampleRate, settings.m_rrcRolloff / 100.0);
|
|
|
|
m_settingsMutex.unlock();
|
|
|
|
}
|
|
|
|
|
2018-05-19 03:03:56 +00:00
|
|
|
if ((settings.m_spanLog2 != m_settings.m_spanLog2) || force)
|
|
|
|
{
|
2018-05-19 23:10:08 +00:00
|
|
|
int sampleRate = (settings.m_downSample ? settings.m_downSampleRate : m_inputSampleRate) / (1<<m_settings.m_spanLog2);
|
2018-05-19 03:03:56 +00:00
|
|
|
m_pll.setSampleRate(sampleRate);
|
|
|
|
m_fll.setSampleRate(sampleRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.m_pll != m_settings.m_pll || force)
|
|
|
|
{
|
|
|
|
if (settings.m_pll)
|
|
|
|
{
|
|
|
|
m_pll.reset();
|
|
|
|
m_fll.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.m_fll != m_settings.m_fll || force)
|
|
|
|
{
|
|
|
|
if (settings.m_fll) {
|
|
|
|
m_fll.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.m_pllPskOrder != m_settings.m_pllPskOrder || force)
|
|
|
|
{
|
|
|
|
if (settings.m_pllPskOrder < 32) {
|
|
|
|
m_pll.setPskOrder(settings.m_pllPskOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_settings = settings;
|
|
|
|
}
|
2019-05-04 02:54:16 +00:00
|
|
|
|
|
|
|
Real ChannelAnalyzer::getPllFrequency() const
|
|
|
|
{
|
|
|
|
if (m_settings.m_fll) {
|
|
|
|
return m_fll.getFreq();
|
|
|
|
} else if (m_settings.m_pll) {
|
|
|
|
return m_pll.getFreq();
|
|
|
|
} else {
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
}
|