diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 501c9d592..77b5ec668 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -113,7 +113,8 @@ void ATVMod::configure(MessageQueue* messageQueue, bool cameraPlay, bool channelMute, bool invertedVideo, - float rfScaling) + float rfScaling, + float fmExcursion) { Message* cmd = MsgConfigureATVMod::create( rfBandwidth, @@ -129,7 +130,8 @@ void ATVMod::configure(MessageQueue* messageQueue, cameraPlay, channelMute, invertedVideo, - rfScaling); + rfScaling, + fmExcursion); messageQueue->push(cmd); } @@ -205,7 +207,7 @@ void ATVMod::modulateSample() switch (m_running.m_atvModulation) { case ATVModulationFM: // FM half bandwidth deviation - m_modPhasor += (t - 0.5f) * M_PI; + m_modPhasor += (t - 0.5f) * m_running.m_fmExcursion * 2.0f * M_PI; if (m_modPhasor > 2.0f * M_PI) m_modPhasor -= 2.0f * M_PI; // limit growth if (m_modPhasor < 2.0f * M_PI) m_modPhasor += 2.0f * M_PI; // limit growth m_modSample.real(cos(m_modPhasor) * m_running.m_rfScalingFactor); // -1 dB @@ -538,6 +540,7 @@ bool ATVMod::handleMessage(const Message& cmd) m_config.m_channelMute = cfg.getChannelMute(); m_config.m_invertedVideo = cfg.getInvertedVideo(); m_config.m_rfScalingFactor = cfg.getRFScaling(); + m_config.m_fmExcursion = cfg.getFMExcursion(); apply(); @@ -555,7 +558,8 @@ bool ATVMod::handleMessage(const Message& cmd) << " m_cameraPlay: " << m_config.m_cameraPlay << " m_channelMute: " << m_config.m_channelMute << " m_invertedVideo: " << m_config.m_invertedVideo - << " m_rfScalingFactor: " << m_config.m_rfScalingFactor; + << " m_rfScalingFactor: " << m_config.m_rfScalingFactor + << " m_fmExcursion: " << m_config.m_fmExcursion; return true; } @@ -730,6 +734,7 @@ void ATVMod::apply(bool force) m_running.m_channelMute = m_config.m_channelMute; m_running.m_invertedVideo = m_config.m_invertedVideo; m_running.m_rfScalingFactor = m_config.m_rfScalingFactor; + m_running.m_fmExcursion = m_config.m_fmExcursion; } void ATVMod::getBaseValues(int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit) diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index 84d95192f..09af5aedf 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -343,7 +343,8 @@ public: bool cameraPLay, bool channelMute, bool invertedVideo, - float rfScaling); + float rfScaling, + float fmExcursion); virtual void pull(Sample& sample); virtual void pullAudio(int nbSamples); // this is used for video signal actually @@ -387,6 +388,7 @@ private: bool getChannelMute() const { return m_channelMute; } bool getInvertedVideo() const { return m_invertedVideo; } float getRFScaling() const { return m_rfScaling; } + float getFMExcursion() const { return m_fmExcursion; } static MsgConfigureATVMod* create( Real rfBandwidth, @@ -402,7 +404,8 @@ private: bool cameraPlay, bool channelMute, bool invertedVideo, - float rfScaling) + float rfScaling, + float fmExcursion) { return new MsgConfigureATVMod( rfBandwidth, @@ -418,7 +421,8 @@ private: cameraPlay, channelMute, invertedVideo, - rfScaling); + rfScaling, + fmExcursion); } private: @@ -436,6 +440,7 @@ private: bool m_channelMute; bool m_invertedVideo; float m_rfScaling; + float m_fmExcursion; MsgConfigureATVMod( Real rfBandwidth, @@ -451,7 +456,8 @@ private: bool cameraPlay, bool channelMute, bool invertedVideo, - float rfScaling) : + float rfScaling, + float fmExcursion) : Message(), m_rfBandwidth(rfBandwidth), m_rfOppBandwidth(rfOppBandwidth), @@ -466,7 +472,8 @@ private: m_cameraPlay(cameraPlay), m_channelMute(channelMute), m_invertedVideo(invertedVideo), - m_rfScaling(rfScaling) + m_rfScaling(rfScaling), + m_fmExcursion(fmExcursion) { } }; @@ -516,6 +523,7 @@ private: bool m_channelMute; //!< Mute channel baseband output bool m_invertedVideo; //!< True if video signal is inverted before modulation float m_rfScalingFactor; //!< Scaling factor from +/-1 to +/-2^15 + float m_fmExcursion; //!< FM excursion factor relative to full bandwidth Config() : m_outputSampleRate(-1), @@ -533,7 +541,8 @@ private: m_cameraPlay(false), m_channelMute(false), m_invertedVideo(false), - m_rfScalingFactor(29204.0f) // -1dB + m_rfScalingFactor(29204.0f), // -1dB + m_fmExcursion(0.5f) // half bandwidth { } }; diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index 56064aa12..3f1bfb455 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -101,6 +101,7 @@ QByteArray ATVModGUI::serialize() const s.writeS32(10, ui->nbLines->currentIndex()); s.writeS32(11, ui->fps->currentIndex()); s.writeS32(12, ui->rfScaling->value()); + s.writeS32(13, ui->fmExcursion->value()); return s.final(); } @@ -153,6 +154,8 @@ bool ATVModGUI::deserialize(const QByteArray& data) ui->fps->setCurrentIndex(tmp); d.readS32(12, &tmp, 80); ui->rfScaling->setValue(tmp); + d.readS32(13, &tmp, 50); + ui->fmExcursion->setValue(tmp); blockApplySettings(false); m_channelMarker.blockSignals(false); @@ -342,6 +345,12 @@ void ATVModGUI::on_rfScaling_valueChanged(int value) applySettings(); } +void ATVModGUI::on_fmExcursion_valueChanged(int value) +{ + ui->fmExcursionText->setText(tr("%1").arg(value)); + applySettings(); +} + void ATVModGUI::on_rfBW_valueChanged(int value) { ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0)); @@ -578,6 +587,9 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa for (std::vector::iterator it = cameraNumbers.begin(); it != cameraNumbers.end(); ++it) { ui->camSelect->addItem(tr("%1").arg(*it)); } + + QChar delta = QChar(0x94, 0x03); + ui->fmExcursionLabel->setText(delta); } ATVModGUI::~ATVModGUI() @@ -623,7 +635,8 @@ void ATVModGUI::applySettings() ui->playCamera->isChecked(), ui->channelMute->isChecked(), ui->invertVideo->isChecked(), - ui->rfScaling->value() * 327.68f); + ui->rfScaling->value() * 327.68f, + ui->fmExcursion->value() / 100.0f); } } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 0ea1cece1..be8bf8bb0 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -65,6 +65,7 @@ private slots: void on_channelMute_toggled(bool checked); void on_modulation_currentIndexChanged(int index); void on_rfScaling_valueChanged(int value); + void on_fmExcursion_valueChanged(int value); void on_rfBW_valueChanged(int value); void on_rfOppBW_valueChanged(int value); void on_nbLines_currentIndexChanged(int index); diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index 2afaff079..75a88287e 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -250,6 +250,64 @@ + + + + D + + + + + + + + 24 + 24 + + + + FM excursion in % of total bandwidth + + + 0 + + + 100 + + + 1 + + + 50 + + + + + + + + 20 + 0 + + + + FM deviation percentage of total bandwidth + + + 50 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + +