diff --git a/plugins/channeltx/modatv/CMakeLists.txt b/plugins/channeltx/modatv/CMakeLists.txt
index 816051100..4188a2389 100644
--- a/plugins/channeltx/modatv/CMakeLists.txt
+++ b/plugins/channeltx/modatv/CMakeLists.txt
@@ -4,12 +4,14 @@ set(modatv_SOURCES
atvmod.cpp
atvmodgui.cpp
atvmodplugin.cpp
+ atvmodsettings.cpp
)
set(modatv_HEADERS
atvmod.h
atvmodgui.h
atvmodplugin.h
+ atvmodsettings.h
)
set(modatv_FORMS
diff --git a/plugins/channeltx/modatv/atvmodsettings.cpp b/plugins/channeltx/modatv/atvmodsettings.cpp
new file mode 100644
index 000000000..f19320f62
--- /dev/null
+++ b/plugins/channeltx/modatv/atvmodsettings.cpp
@@ -0,0 +1,129 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include
+
+#include "dsp/dspengine.h"
+#include "util/simpleserializer.h"
+#include "settings/serializable.h"
+#include "atvmodsettings.h"
+
+ATVModSettings::ATVModSettings() :
+ m_channelMarker(0)
+{
+ resetToDefaults();
+}
+
+void ATVModSettings::resetToDefaults()
+{
+ m_outputSampleRate = 1000000;
+ m_inputFrequencyOffset = 0;
+ m_rfBandwidth = 1000000;
+ m_rfOppBandwidth = 0;
+ m_atvStd = ATVStdPAL625;
+ m_nbLines = 625;
+ m_fps = 25;
+ m_atvModInput = ATVModInputHBars;
+ m_uniformLevel = 0.5f;
+ m_atvModulation = ATVModulationAM;
+ m_videoPlayLoop = false;
+ m_videoPlay = false;
+ m_cameraPlay = false;
+ m_channelMute = false;
+ m_invertedVideo = false;
+ m_rfScalingFactor = 29204.0f; // -1dB
+ m_fmExcursion = 0.5f; // half bandwidth
+ m_forceDecimator = false;
+ m_overlayText = "ATV";
+}
+
+QByteArray ATVModSettings::serialize() const
+{
+ SimpleSerializer s(1);
+
+ s.writeS32(1, m_inputFrequencyOffset);
+ s.writeReal(2, m_rfBandwidth);
+ s.writeS32(3, roundf(m_uniformLevel * 100.0)); // percent
+ s.writeS32(4, (int) m_atvStd);
+ s.writeS32(5, (int) m_atvModInput);
+ s.writeU32(6, m_rgbColor);
+ s.writeReal(7, m_rfOppBandwidth);
+ s.writeS32(8, (int) m_atvModulation);
+ s.writeBool(9, m_invertedVideo);
+ s.writeS32(10, m_nbLines);
+ s.writeS32(11, m_fps);
+ s.writeS32(12, roundf(m_rfScalingFactor / 327.68f));
+ s.writeS32(13, roundf(m_fmExcursion * 1000.0)); // pro mill
+ s.writeString(14, m_overlayText);
+
+ if (m_channelMarker) {
+ s.writeBlob(15, m_channelMarker->serialize());
+ }
+
+ return s.final();
+}
+
+bool ATVModSettings::deserialize(const QByteArray& data)
+{
+ SimpleDeserializer d(data);
+
+ if(!d.isValid())
+ {
+ resetToDefaults();
+ return false;
+ }
+
+ if(d.getVersion() == 1)
+ {
+ QByteArray bytetmp;
+ qint32 tmp;
+
+ d.readS32(1, &tmp, 0);
+ m_inputFrequencyOffset = tmp;
+ d.readReal(2, &m_rfBandwidth, 1000000);
+ d.readS32(3, &tmp, 100);
+ m_uniformLevel = tmp / 100.0; // percent
+ d.readS32(4, &tmp, 0);
+ m_atvStd = (ATVStd) tmp;
+ d.readS32(5, &tmp, 0);
+ m_atvModInput = (ATVModInput) tmp;
+ d.readU32(6, &m_rgbColor, 0);
+ d.readReal(7, &m_rfOppBandwidth, 0);
+ d.readS32(8, &tmp, 0);
+ m_atvModulation = (ATVModulation) tmp;
+ d.readBool(9, &m_invertedVideo, false);
+ d.readS32(10, &m_nbLines, 625);
+ d.readS32(11, &m_fps, 25);
+ d.readS32(12, &tmp, 80);
+ m_rfScalingFactor = tmp * 327.68f;
+ d.readS32(13, &tmp, 250);
+ m_fmExcursion = tmp / 1000.0; // pro mill
+ d.readString(14, &m_overlayText, "ATV");
+
+ if (m_channelMarker)
+ {
+ d.readBlob(15, &bytetmp);
+ m_channelMarker->deserialize(bytetmp);
+ }
+
+ return true;
+ }
+ else
+ {
+ resetToDefaults();
+ return false;
+ }
+}
diff --git a/plugins/channeltx/modatv/atvmodsettings.h b/plugins/channeltx/modatv/atvmodsettings.h
new file mode 100644
index 000000000..f8ce4ad26
--- /dev/null
+++ b/plugins/channeltx/modatv/atvmodsettings.h
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef PLUGINS_CHANNELTX_MODATV_ATVMODSETTINGS_H_
+#define PLUGINS_CHANNELTX_MODATV_ATVMODSETTINGS_H_
+
+#include
+#include
+#include
+
+struct Serializable;
+
+struct ATVModSettings
+{
+ typedef enum
+ {
+ ATVStdPAL625,
+ ATVStdPAL525,
+ ATVStd405,
+ ATVStdShortInterleaved,
+ ATVStdShort,
+ ATVStdHSkip,
+ } ATVStd;
+
+ typedef enum
+ {
+ ATVModInputUniform,
+ ATVModInputHBars,
+ ATVModInputVBars,
+ ATVModInputChessboard,
+ ATVModInputHGradient,
+ ATVModInputVGradient,
+ ATVModInputImage,
+ ATVModInputVideo,
+ ATVModInputCamera
+ } ATVModInput;
+
+ typedef enum
+ {
+ ATVModulationAM,
+ ATVModulationFM,
+ ATVModulationUSB,
+ ATVModulationLSB,
+ ATVModulationVestigialUSB,
+ ATVModulationVestigialLSB
+ } ATVModulation;
+
+ int m_outputSampleRate; //!< sample rate from channelizer
+ qint64 m_inputFrequencyOffset; //!< offset from baseband center frequency
+ Real m_rfBandwidth; //!< Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB
+ Real m_rfOppBandwidth; //!< Bandwidth of opposite sideband for vestigial SSB
+ ATVStd m_atvStd; //!< Standard
+ int m_nbLines; //!< Number of lines per full frame
+ int m_fps; //!< Number of frames per second
+ ATVModInput m_atvModInput; //!< Input source type
+ Real m_uniformLevel; //!< Percentage between black and white for uniform screen display
+ ATVModulation m_atvModulation; //!< RF modulation type
+ bool m_videoPlayLoop; //!< Play video in a loop
+ 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
+ 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
+ bool m_forceDecimator; //!< Forces decimator even when channel and source sample rates are equal
+ QString m_overlayText;
+ quint32 m_rgbColor;
+
+ QString m_udpAddress;
+ uint16_t m_udpPort;
+
+ Serializable *m_channelMarker;
+
+ ATVModSettings();
+ void resetToDefaults();
+ void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
+ QByteArray serialize() const;
+ bool deserialize(const QByteArray& data);
+};
+
+#endif /* PLUGINS_CHANNELTX_MODATV_ATVMODSETTINGS_H_ */
diff --git a/plugins/channeltx/modatv/modatv.pro b/plugins/channeltx/modatv/modatv.pro
index 89818bfac..dc8acb30e 100644
--- a/plugins/channeltx/modatv/modatv.pro
+++ b/plugins/channeltx/modatv/modatv.pro
@@ -29,11 +29,13 @@ CONFIG(macx):INCLUDEPATH += "/opt/local/include"
SOURCES += atvmod.cpp\
atvmodgui.cpp\
- atvmodplugin.cpp
+ atvmodplugin.cpp\
+ atvmodsettings.cpp
HEADERS += atvmod.h\
atvmodgui.h\
- atvmodplugin.h
+ atvmodplugin.h\
+ atvmodsettings.h
FORMS += atvmodgui.ui