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

Deep redesign: fixed apply settings on mouse movements for channels that were missing conditional apply settings

This commit is contained in:
f4exb 2015-08-24 04:09:36 +02:00
parent 5582105c25
commit ca86cb781b
9 changed files with 136 additions and 112 deletions

View File

@ -8,9 +8,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
project(sdrangelove)
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
#set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Debug")
set(QT_USE_QTOPENGL TRUE)
set(CMAKE_AUTOMOC ON)

View File

@ -243,6 +243,7 @@ void AMDemod::apply()
m_running.m_inputSampleRate = m_config.m_inputSampleRate;
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
m_running.m_afBandwidth = m_config.m_afBandwidth;
m_running.m_squelch = m_config.m_squelch;
m_running.m_volume = m_config.m_volume;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;

View File

@ -398,19 +398,22 @@ void ChannelAnalyzerGUI::blockApplySettings(bool block)
void ChannelAnalyzerGUI::applySettings()
{
setTitleColor(m_channelMarker->getColor());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
if (m_doApplySettings)
{
setTitleColor(m_channelMarker->getColor());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_channelizer->getInputSampleRate(),
m_channelMarker->getCenterFrequency());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_channelizer->getInputSampleRate(),
m_channelMarker->getCenterFrequency());
m_channelAnalyzer->configure(m_channelAnalyzer->getInputMessageQueue(),
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
m_spanLog2,
ui->ssb->isChecked());
m_channelAnalyzer->configure(m_channelAnalyzer->getInputMessageQueue(),
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
m_spanLog2,
ui->ssb->isChecked());
}
}
void ChannelAnalyzerGUI::leaveEvent(QEvent*)

View File

@ -197,12 +197,15 @@ void LoRaDemodGUI::blockApplySettings(bool block)
void LoRaDemodGUI::applySettings()
{
const int loraBW[] = BANDWIDTHSTRING;
int thisBW = loraBW[ui->BW->value()];
if (m_doApplySettings)
{
const int loraBW[] = BANDWIDTHSTRING;
int thisBW = loraBW[ui->BW->value()];
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
thisBW,
m_channelMarker->getCenterFrequency());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
thisBW,
m_channelMarker->getCenterFrequency());
m_LoRaDemod->configure(m_LoRaDemod->getInputMessageQueue(), thisBW);
m_LoRaDemod->configure(m_LoRaDemod->getInputMessageQueue(), thisBW);
}
}

View File

@ -345,6 +345,7 @@ void NFMDemod::apply()
m_running.m_inputSampleRate = m_config.m_inputSampleRate;
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
m_running.m_afBandwidth = m_config.m_afBandwidth;
m_running.m_squelch = m_config.m_squelch;
m_running.m_volume = m_config.m_volume;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;

View File

@ -349,19 +349,22 @@ void SSBDemodGUI::blockApplySettings(bool block)
void SSBDemodGUI::applySettings()
{
setTitleColor(m_channelMarker->getColor());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
if (m_doApplySettings)
{
setTitleColor(m_channelMarker->getColor());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
48000,
m_channelMarker->getCenterFrequency());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
48000,
m_channelMarker->getCenterFrequency());
m_ssbDemod->configure(m_ssbDemod->getInputMessageQueue(),
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
ui->volume->value() / 10.0,
m_spanLog2);
m_ssbDemod->configure(m_ssbDemod->getInputMessageQueue(),
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
ui->volume->value() / 10.0,
m_spanLog2);
}
}
void SSBDemodGUI::leaveEvent(QEvent*)

View File

@ -218,77 +218,80 @@ void TCPSrcGUI::blockApplySettings(bool block)
void TCPSrcGUI::applySettings()
{
bool ok;
Real outputSampleRate = ui->sampleRate->text().toDouble(&ok);
if((!ok) || (outputSampleRate < 1000))
if (m_doApplySettings)
{
outputSampleRate = 48000;
bool ok;
Real outputSampleRate = ui->sampleRate->text().toDouble(&ok);
if((!ok) || (outputSampleRate < 1000))
{
outputSampleRate = 48000;
}
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
if((!ok) || (rfBandwidth > outputSampleRate))
{
rfBandwidth = outputSampleRate;
}
int tcpPort = ui->tcpPort->text().toInt(&ok);
if((!ok) || (tcpPort < 1) || (tcpPort > 65535))
{
tcpPort = 9999;
}
int boost = ui->boost->value();
setTitleColor(m_channelMarker->getColor());
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
ui->tcpPort->setText(QString("%1").arg(tcpPort));
ui->boost->setValue(boost);
m_channelMarker->disconnect(this, SLOT(channelMarkerChanged()));
m_channelMarker->setBandwidth((int)rfBandwidth);
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
ui->glSpectrum->setSampleRate(outputSampleRate);
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
outputSampleRate,
m_channelMarker->getCenterFrequency());
TCPSrc::SampleFormat sampleFormat;
switch(ui->sampleFormat->currentIndex())
{
case 0:
sampleFormat = TCPSrc::FormatSSB;
break;
case 1:
sampleFormat = TCPSrc::FormatNFM;
break;
case 2:
sampleFormat = TCPSrc::FormatS16LE;
break;
default:
sampleFormat = TCPSrc::FormatSSB;
break;
}
m_sampleFormat = sampleFormat;
m_outputSampleRate = outputSampleRate;
m_rfBandwidth = rfBandwidth;
m_tcpPort = tcpPort;
m_boost = boost;
m_tcpSrc->configure(m_tcpSrc->getInputMessageQueue(),
sampleFormat,
outputSampleRate,
rfBandwidth,
tcpPort,
boost);
ui->applyBtn->setEnabled(false);
}
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
if((!ok) || (rfBandwidth > outputSampleRate))
{
rfBandwidth = outputSampleRate;
}
int tcpPort = ui->tcpPort->text().toInt(&ok);
if((!ok) || (tcpPort < 1) || (tcpPort > 65535))
{
tcpPort = 9999;
}
int boost = ui->boost->value();
setTitleColor(m_channelMarker->getColor());
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
ui->tcpPort->setText(QString("%1").arg(tcpPort));
ui->boost->setValue(boost);
m_channelMarker->disconnect(this, SLOT(channelMarkerChanged()));
m_channelMarker->setBandwidth((int)rfBandwidth);
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
ui->glSpectrum->setSampleRate(outputSampleRate);
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
outputSampleRate,
m_channelMarker->getCenterFrequency());
TCPSrc::SampleFormat sampleFormat;
switch(ui->sampleFormat->currentIndex())
{
case 0:
sampleFormat = TCPSrc::FormatSSB;
break;
case 1:
sampleFormat = TCPSrc::FormatNFM;
break;
case 2:
sampleFormat = TCPSrc::FormatS16LE;
break;
default:
sampleFormat = TCPSrc::FormatSSB;
break;
}
m_sampleFormat = sampleFormat;
m_outputSampleRate = outputSampleRate;
m_rfBandwidth = rfBandwidth;
m_tcpPort = tcpPort;
m_boost = boost;
m_tcpSrc->configure(m_tcpSrc->getInputMessageQueue(),
sampleFormat,
outputSampleRate,
rfBandwidth,
tcpPort,
boost);
ui->applyBtn->setEnabled(false);
}
void TCPSrcGUI::on_sampleFormat_currentIndexChanged(int index)

View File

@ -199,9 +199,10 @@ bool WFMDemod::handleMessage(const Message& cmd)
m_config.m_afBandwidth = cfg.getAFBandwidth();
m_config.m_volume = cfg.getVolume();
m_config.m_squelch = cfg.getSquelch();
apply();
qDebug() << " - MsgConfigureWFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
qDebug() << "WFMDemod::handleMessage: MsgConfigureWFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
<< " m_afBandwidth: " << m_config.m_afBandwidth
<< " m_volume: " << m_config.m_volume
<< " m_squelch: " << m_config.m_squelch;
@ -212,7 +213,7 @@ bool WFMDemod::handleMessage(const Message& cmd)
{
if (m_sampleSink != 0)
{
return m_sampleSink->handleMessage(cmd);
return m_sampleSink->handleMessage(cmd);
}
else
{
@ -227,12 +228,14 @@ void WFMDemod::apply()
if((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||
(m_config.m_inputSampleRate != m_running.m_inputSampleRate))
{
qDebug() << "WFMDemod::handleMessage: m_nco.setFreq";
m_nco.setFreq(-m_config.m_inputFrequencyOffset, m_config.m_inputSampleRate);
}
if((m_config.m_inputSampleRate != m_running.m_inputSampleRate) ||
(m_config.m_afBandwidth != m_running.m_afBandwidth))
{
qDebug() << "WFMDemod::handleMessage: m_interpolator.create";
m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_afBandwidth);
m_interpolatorDistanceRemain = (Real) m_config.m_inputSampleRate / m_config.m_audioSampleRate;
m_interpolatorDistance = (Real) m_config.m_inputSampleRate / (Real) m_config.m_audioSampleRate;
@ -242,6 +245,7 @@ void WFMDemod::apply()
(m_config.m_rfBandwidth != m_running.m_rfBandwidth) ||
(m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset))
{
qDebug() << "WFMDemod::handleMessage: m_rfFilter->create_filter";
Real lowCut = (m_config.m_inputFrequencyOffset - (m_config.m_rfBandwidth / 2.0)) / m_config.m_inputSampleRate;
Real hiCut = (m_config.m_inputFrequencyOffset + (m_config.m_rfBandwidth / 2.0)) / m_config.m_inputSampleRate;
m_rfFilter->create_filter(lowCut, hiCut);
@ -250,10 +254,12 @@ void WFMDemod::apply()
if((m_config.m_afBandwidth != m_running.m_afBandwidth) ||
(m_config.m_audioSampleRate != m_running.m_audioSampleRate))
{
qDebug() << "WFMDemod::handleMessage: m_lowpass.create";
m_lowpass.create(21, m_config.m_audioSampleRate, m_config.m_afBandwidth);
}
if(m_config.m_squelch != m_running.m_squelch) {
qDebug() << "WFMDemod::handleMessage: set m_squelchLevel";
m_squelchLevel = pow(10.0, m_config.m_squelch / 20.0);
m_squelchLevel *= m_squelchLevel;
}
@ -261,6 +267,7 @@ void WFMDemod::apply()
m_running.m_inputSampleRate = m_config.m_inputSampleRate;
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
m_running.m_afBandwidth = m_config.m_afBandwidth;
m_running.m_squelch = m_config.m_squelch;
m_running.m_volume = m_config.m_volume;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;

View File

@ -245,20 +245,23 @@ void WFMDemodGUI::blockApplySettings(bool block)
void WFMDemodGUI::applySettings()
{
setTitleColor(m_channelMarker->getColor());
if (m_doApplySettings)
{
setTitleColor(m_channelMarker->getColor());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
requiredBW(m_rfBW[ui->rfBW->value()]), // TODO: this is where requested sample rate is specified
m_channelMarker->getCenterFrequency());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
requiredBW(m_rfBW[ui->rfBW->value()]), // TODO: this is where requested sample rate is specified
m_channelMarker->getCenterFrequency());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
m_wfmDemod->configure(m_wfmDemod->getInputMessageQueue(),
m_rfBW[ui->rfBW->value()],
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0,
ui->squelch->value());
m_wfmDemod->configure(m_wfmDemod->getInputMessageQueue(),
m_rfBW[ui->rfBW->value()],
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0,
ui->squelch->value());
}
}
void WFMDemodGUI::leaveEvent(QEvent*)