1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

Channel Analyzer NG: method to get requested sample rate depending on wether the rational downsampler is engaged or not

This commit is contained in:
f4exb 2017-03-01 05:23:37 +01:00
parent 68943b122b
commit 2008b5fbde
2 changed files with 24 additions and 10 deletions

View File

@ -140,7 +140,7 @@ bool ChannelAnalyzerNGGUI::deserialize(const QByteArray& data)
m_channelMarker.blockSignals(false);
ui->spanLog2->setCurrentIndex(spanLog2);
setNewRate(spanLog2);
setNewFinalRate(spanLog2);
ui->BW->setValue(bw);
ui->lowCut->setValue(lowCut); // does applySettings();
@ -175,7 +175,8 @@ void ChannelAnalyzerNGGUI::channelizerInputSampleRateChanged()
{
qDebug("ChannelAnalyzerNGGUI::channelizerInputSampleRateChanged(): %d", m_channelizer->getInputSampleRate());
ui->channelSampleRate->setValueRange(7, 2000U, m_channelAnalyzer->getInputSampleRate());
setNewRate(m_spanLog2);
setNewFinalRate(m_spanLog2);
applySettings();
}
void ChannelAnalyzerNGGUI::on_deltaMinus_toggled(bool minus)
@ -189,6 +190,15 @@ void ChannelAnalyzerNGGUI::on_deltaMinus_toggled(bool minus)
}
}
int ChannelAnalyzerNGGUI::getRequestedChannelSampleRate()
{
if (ui->useRationalDownsampler->isChecked()) {
return ui->channelSampleRate->getValue();
} else {
return m_channelizer->getInputSampleRate();
}
}
void ChannelAnalyzerNGGUI::on_deltaFrequency_changed(quint64 value)
{
if (ui->deltaMinus->isChecked()) {
@ -257,7 +267,7 @@ void ChannelAnalyzerNGGUI::on_lowCut_valueChanged(int value)
void ChannelAnalyzerNGGUI::on_spanLog2_currentIndexChanged(int index)
{
if (setNewRate(index)) {
if (setNewFinalRate(index)) {
applySettings();
}
@ -373,7 +383,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
applySettings();
setNewRate(m_spanLog2);
setNewFinalRate(m_spanLog2);
}
ChannelAnalyzerNGGUI::~ChannelAnalyzerNGGUI()
@ -390,7 +400,7 @@ ChannelAnalyzerNGGUI::~ChannelAnalyzerNGGUI()
delete ui;
}
bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
bool ChannelAnalyzerNGGUI::setNewFinalRate(int spanLog2)
{
qDebug("ChannelAnalyzerNGGUI::setNewRate");
@ -400,7 +410,8 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
m_spanLog2 = spanLog2;
//m_rate = 48000 / (1<<spanLog2);
m_rate = m_channelizer->getInputSampleRate() / (1<<spanLog2);
//m_rate = m_channelizer->getInputSampleRate() / (1<<spanLog2);
m_rate = getRequestedChannelSampleRate() / (1<<spanLog2);
setFiltersUIBoundaries();
@ -481,11 +492,13 @@ void ChannelAnalyzerNGGUI::applySettings()
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_channelizer->getInputSampleRate(),
//m_channelizer->getInputSampleRate(),
getRequestedChannelSampleRate(),
m_channelMarker.getCenterFrequency());
m_channelAnalyzer->configure(m_channelAnalyzer->getInputMessageQueue(),
m_channelizer->getInputSampleRate(), // TODO: specify required channel sample rate
//m_channelizer->getInputSampleRate(), // TODO: specify required channel sample rate
getRequestedChannelSampleRate(), // TODO: specify required channel sample rate
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
m_spanLog2,

View File

@ -76,7 +76,7 @@ private:
ChannelMarker m_channelMarker;
bool m_basicSettingsShown;
bool m_doApplySettings;
int m_rate;
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
int m_spanLog2;
MovingAverage<double> m_channelPowerDbAvg;
@ -90,8 +90,9 @@ private:
explicit ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~ChannelAnalyzerNGGUI();
int getRequestedChannelSampleRate();
int getEffectiveLowCutoff(int lowCutoff);
bool setNewRate(int spanLog2);
bool setNewFinalRate(int spanLog2); //!< set sample rate after final in-channel decimation
void setFiltersUIBoundaries();
void blockApplySettings(bool block);