1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Channel Analyzer NG: consistent channelizer input sample rate handling

This commit is contained in:
f4exb 2017-03-01 05:02:31 +01:00
parent 3d972e8565
commit 68943b122b
2 changed files with 8 additions and 9 deletions

View File

@ -171,8 +171,10 @@ void ChannelAnalyzerNGGUI::tick()
// ui->channelPower->setText(QString::number(powDb, 'f', 1));
}
void ChannelAnalyzerNGGUI::channelSampleRateChanged()
void ChannelAnalyzerNGGUI::channelizerInputSampleRateChanged()
{
qDebug("ChannelAnalyzerNGGUI::channelizerInputSampleRateChanged(): %d", m_channelizer->getInputSampleRate());
ui->channelSampleRate->setValueRange(7, 2000U, m_channelAnalyzer->getInputSampleRate());
setNewRate(m_spanLog2);
}
@ -321,7 +323,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI
m_basicSettingsShown(false),
m_doApplySettings(true),
m_rate(6000),
m_spanLog2(3),
m_spanLog2(0),
m_channelPowerDbAvg(40,0)
{
ui->setupUi(this);
@ -335,14 +337,14 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI
m_channelAnalyzer = new ChannelAnalyzerNG(m_spectrumScopeComboVis);
m_channelizer = new DownChannelizer(m_channelAnalyzer);
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelizerInputSampleRateChanged()));
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
ui->channelSampleRate->setColorMapper(ColorMapper(ColorMapper::ReverseGreenYellow));
ui->channelSampleRate->setValueRange(7, 0U, 9999999U);
ui->channelSampleRate->setValueRange(7, 2000U, 9999999U);
ui->glSpectrum->setCenterFrequency(m_rate/2);
ui->glSpectrum->setSampleRate(m_rate);
@ -392,16 +394,13 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
{
qDebug("ChannelAnalyzerNGGUI::setNewRate");
ui->channelSampleRate->setValueRange(7, 0, m_channelAnalyzer->getInputSampleRate());
ui->channelSampleRate->setValue(m_channelAnalyzer->getChannelSampleRate());
if ((spanLog2 < 0) || (spanLog2 > 6)) {
return false;
}
m_spanLog2 = spanLog2;
//m_rate = 48000 / (1<<spanLog2);
m_rate = m_channelAnalyzer->getChannelSampleRate() / (1<<spanLog2);
m_rate = m_channelizer->getInputSampleRate() / (1<<spanLog2);
setFiltersUIBoundaries();

View File

@ -58,7 +58,7 @@ public:
private slots:
void viewChanged();
void channelSampleRateChanged();
void channelizerInputSampleRateChanged();
void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_toggled(bool minus);
void on_BW_valueChanged(int value);