diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 75ddd4243..ab960a132 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -106,7 +106,8 @@ void ATVMod::configure(MessageQueue* messageQueue, bool videoPlayLoop, bool videoPlay, bool cameraPlay, - bool channelMute) + bool channelMute, + bool invertedVideo) { Message* cmd = MsgConfigureATVMod::create( rfBandwidth, @@ -118,7 +119,8 @@ void ATVMod::configure(MessageQueue* messageQueue, videoPlayLoop, videoPlay, cameraPlay, - channelMute); + channelMute, + invertedVideo); messageQueue->push(cmd); } @@ -189,6 +191,8 @@ void ATVMod::modulateSample() pullVideo(t); calculateLevel(t); + t = m_running.m_invertedVideo ? 1.0f - t : t; + switch (m_running.m_atvModulation) { case ATVModulationFM: // FM half bandwidth deviation @@ -521,6 +525,7 @@ bool ATVMod::handleMessage(const Message& cmd) m_config.m_videoPlay = cfg.getVideoPlay(); m_config.m_cameraPlay = cfg.getCameraPlay(); m_config.m_channelMute = cfg.getChannelMute(); + m_config.m_invertedVideo = cfg.getInvertedVideo(); apply(); @@ -534,7 +539,8 @@ bool ATVMod::handleMessage(const Message& cmd) << " m_videoPlayLoop: " << m_config.m_videoPlayLoop << " m_videoPlay: " << m_config.m_videoPlay << " m_cameraPlay: " << m_config.m_cameraPlay - << " m_channelMute: " << m_config.m_channelMute; + << " m_channelMute: " << m_config.m_channelMute + << " m_invertedVideo: " << m_config.m_invertedVideo; return true; } @@ -692,6 +698,7 @@ void ATVMod::apply(bool force) m_running.m_videoPlay = m_config.m_videoPlay; m_running.m_cameraPlay = m_config.m_cameraPlay; m_running.m_channelMute = m_config.m_channelMute; + m_running.m_invertedVideo = m_config.m_invertedVideo; } int ATVMod::getSampleRateUnits(ATVStd std) diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index b368037b9..417fb3a8a 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -316,7 +316,8 @@ public: bool videoPlayLoop, bool videoPlay, bool cameraPLay, - bool channelMute); + bool channelMute, + bool invertedVideo); virtual void pull(Sample& sample); virtual void pullAudio(int nbSamples); // this is used for video signal actually @@ -355,6 +356,7 @@ private: bool getVideoPlay() const { return m_videoPlay; } bool getCameraPlay() const { return m_cameraPlay; } bool getChannelMute() const { return m_channelMute; } + bool getInvertedVideo() const { return m_invertedVideo; } static MsgConfigureATVMod* create( Real rfBandwidth, @@ -366,7 +368,8 @@ private: bool videoPlayLoop, bool videoPlay, bool cameraPlay, - bool channelMute) + bool channelMute, + bool invertedVideo) { return new MsgConfigureATVMod( rfBandwidth, @@ -378,7 +381,8 @@ private: videoPlayLoop, videoPlay, cameraPlay, - channelMute); + channelMute, + invertedVideo); } private: @@ -392,6 +396,7 @@ private: bool m_videoPlay; bool m_cameraPlay; bool m_channelMute; + bool m_invertedVideo; MsgConfigureATVMod( Real rfBandwidth, @@ -403,7 +408,8 @@ private: bool videoPlayLoop, bool videoPlay, bool cameraPlay, - bool channelMute) : + bool channelMute, + bool invertedVideo) : Message(), m_rfBandwidth(rfBandwidth), m_rfOppBandwidth(rfOppBandwidth), @@ -414,7 +420,8 @@ private: m_videoPlayLoop(videoPlayLoop), m_videoPlay(videoPlay), m_cameraPlay(cameraPlay), - m_channelMute(channelMute) + m_channelMute(channelMute), + m_invertedVideo(invertedVideo) { } }; @@ -460,7 +467,7 @@ private: bool m_videoPlay; //!< True to play video and false to pause bool m_cameraPlay; //!< True to play camera video and false to pause bool m_channelMute; //!< Mute channel baseband output - Real m_vestigialRatio; //!< Vestigial sideband ratio to half bandwidth + bool m_invertedVideo; //!< True if video signal is inverted before modulation Config() : m_outputSampleRate(-1), @@ -475,7 +482,7 @@ private: m_videoPlay(false), m_cameraPlay(false), m_channelMute(false), - m_vestigialRatio(0.1f) + m_invertedVideo(false) { } }; diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index 899a82c3f..4ac246b27 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -93,6 +93,7 @@ QByteArray ATVModGUI::serialize() const s.writeU32(6, m_channelMarker.getColor().rgb()); s.writeS32(7, ui->rfOppBW->value()); s.writeS32(8, ui->modulation->currentIndex()); + s.writeBool(9, ui->invertVideo->isChecked()); return s.final(); } @@ -112,6 +113,7 @@ bool ATVModGUI::deserialize(const QByteArray& data) QByteArray bytetmp; quint32 u32tmp; qint32 tmp; + bool booltmp; blockApplySettings(true); m_channelMarker.blockSignals(true); @@ -136,6 +138,8 @@ bool ATVModGUI::deserialize(const QByteArray& data) ui->rfOppBW->setValue(tmp); d.readS32(8, &tmp, 0); ui->modulation->setCurrentIndex(tmp); + d.readBool(9, &booltmp, false); + ui->invertVideo->setChecked(booltmp); blockApplySettings(false); m_channelMarker.blockSignals(false); @@ -354,6 +358,11 @@ void ATVModGUI::on_uniformLevel_valueChanged(int value) applySettings(); } +void ATVModGUI::on_invertVideo_clicked() +{ + applySettings(); +} + void ATVModGUI::on_inputSelect_currentIndexChanged(int index) { applySettings(); @@ -558,7 +567,8 @@ void ATVModGUI::applySettings() ui->playLoop->isChecked(), ui->playVideo->isChecked(), ui->playCamera->isChecked(), - ui->channelMute->isChecked()); + ui->channelMute->isChecked(), + ui->invertVideo->isChecked()); } } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index b1e324929..433a3810f 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -67,6 +67,7 @@ private slots: void on_rfBW_valueChanged(int value); void on_rfOppBW_valueChanged(int value); void on_standard_currentIndexChanged(int index); + void on_invertVideo_clicked(); void on_uniformLevel_valueChanged(int value); void on_inputSelect_currentIndexChanged(int index); void on_imageFileDialog_clicked(bool checked); diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index f123125bf..a3cdbacf6 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -427,6 +427,19 @@ + + + + Toggle invert video signal + + + Qt::RightToLeft + + + Inv + + +