1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

ATV Modulator: set rf filter bandwidth according to channel sample rate and not source sample rate. Make channel marker display consistent

This commit is contained in:
f4exb 2017-03-21 12:16:43 +01:00
parent 5d5a86bc41
commit 532431939b
3 changed files with 31 additions and 70 deletions

View File

@ -350,8 +350,8 @@ public:
virtual void stop(); virtual void stop();
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
int getEffectiveSampleRate() const { return m_tvSampleRate; };
Real getMagSq() const { return m_movingAverage.average(); } Real getMagSq() const { return m_movingAverage.average(); }
void getCameraNumbers(std::vector<int>& numbers); void getCameraNumbers(std::vector<int>& numbers);
static void getBaseValues(int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit); static void getBaseValues(int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit);

View File

@ -209,8 +209,7 @@ bool ATVModGUI::handleMessage(const Message& message)
{ {
int sampleRate = ((ATVMod::MsgReportEffectiveSampleRate&)message).getSampleRate(); int sampleRate = ((ATVMod::MsgReportEffectiveSampleRate&)message).getSampleRate();
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0)); ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
//setRFFiltersSlidersRange(sampleRate); setRFFiltersSlidersRange(sampleRate);
return true; return true;
} }
else else
@ -226,7 +225,7 @@ void ATVModGUI::viewChanged()
void ATVModGUI::channelizerOutputSampleRateChanged() void ATVModGUI::channelizerOutputSampleRateChanged()
{ {
setRFFiltersSlidersRange(m_channelizer->getOutputSampleRate()); //setRFFiltersSlidersRange(m_channelizer->getOutputSampleRate());
} }
void ATVModGUI::setRFFiltersSlidersRange(int sampleRate) void ATVModGUI::setRFFiltersSlidersRange(int sampleRate)
@ -322,93 +321,54 @@ void ATVModGUI::on_deltaFrequency_changed(quint64 value)
void ATVModGUI::on_modulation_currentIndexChanged(int index) void ATVModGUI::on_modulation_currentIndexChanged(int index)
{ {
if (index == (int) ATVMod::ATVModulationLSB) setRFFiltersSlidersRange(m_atvMod->getEffectiveSampleRate());
{ setChannelMarkerBandwidth();
ui->rfBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
m_channelMarker.setBandwidth(-ui->rfBW->value()*200000);
m_channelMarker.setSidebands(ChannelMarker::lsb);
}
else if (index == (int) ATVMod::ATVModulationVestigialLSB)
{
ui->rfBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
m_channelMarker.setBandwidth(ui->rfBW->value()*100000);
m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_channelMarker.setSidebands(ChannelMarker::vlsb);
}
else if (index == (int) ATVMod::ATVModulationUSB)
{
ui->rfBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
m_channelMarker.setBandwidth(ui->rfBW->value()*200000);
m_channelMarker.setSidebands(ChannelMarker::usb);
}
else if (index == (int) ATVMod::ATVModulationVestigialUSB)
{
ui->rfBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_channelizer->getOutputSampleRate() / 200000);
m_channelMarker.setBandwidth(ui->rfBW->value()*100000);
m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_channelMarker.setSidebands(ChannelMarker::vusb);
}
else
{
ui->rfBW->setMaximum(m_channelizer->getOutputSampleRate() / 100000);
ui->rfOppBW->setMaximum(m_channelizer->getOutputSampleRate() / 100000);
m_channelMarker.setBandwidth(ui->rfBW->value()*100000);
m_channelMarker.setSidebands(ChannelMarker::dsb);
}
applySettings(); applySettings();
} }
void ATVModGUI::on_rfBW_valueChanged(int value) void ATVModGUI::on_rfBW_valueChanged(int value)
{ {
ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0)); ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
setChannelMarkerBandwidth();
if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationLSB)
{
m_channelMarker.setBandwidth(-ui->rfBW->value()*200000);
}
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationUSB)
{
m_channelMarker.setBandwidth(ui->rfBW->value()*200000);
}
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialLSB)
{
m_channelMarker.setBandwidth(-ui->rfBW->value()*100000);
}
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialUSB)
{
m_channelMarker.setBandwidth(ui->rfBW->value()*100000);
}
else
{
m_channelMarker.setBandwidth(ui->rfBW->value()*100000);
}
applySettings(); applySettings();
} }
void ATVModGUI::on_rfOppBW_valueChanged(int value) void ATVModGUI::on_rfOppBW_valueChanged(int value)
{ {
ui->rfOppBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0)); ui->rfOppBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
setChannelMarkerBandwidth();
applySettings();
}
if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialLSB) void ATVModGUI::setChannelMarkerBandwidth()
{
if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationLSB)
{ {
m_channelMarker.setOppositeBandwidth(-ui->rfOppBW->value()*100000); m_channelMarker.setBandwidth(-ui->rfBW->value()*m_rfSliderDivisor*2);
m_channelMarker.setSidebands(ChannelMarker::lsb);
}
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialLSB)
{
m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*m_rfSliderDivisor);
m_channelMarker.setSidebands(ChannelMarker::vlsb);
}
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationUSB)
{
m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor*2);
m_channelMarker.setSidebands(ChannelMarker::usb);
} }
else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialUSB) else if (ui->modulation->currentIndex() == (int) ATVMod::ATVModulationVestigialUSB)
{ {
m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000); m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*m_rfSliderDivisor);
m_channelMarker.setSidebands(ChannelMarker::vusb);
} }
else else
{ {
m_channelMarker.setBandwidth(ui->rfBW->value()*100000); m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
m_channelMarker.setSidebands(ChannelMarker::dsb);
} }
applySettings();
} }
void ATVModGUI::on_nbLines_currentIndexChanged(int index) void ATVModGUI::on_nbLines_currentIndexChanged(int index)

View File

@ -123,6 +123,7 @@ private:
void updateWithStreamData(); void updateWithStreamData();
void updateWithStreamTime(); void updateWithStreamTime();
void setRFFiltersSlidersRange(int sampleRate); void setRFFiltersSlidersRange(int sampleRate);
void setChannelMarkerBandwidth();
int getNbLines(); int getNbLines();
int getFPS(); int getFPS();