summaryrefslogtreecommitdiff
path: root/Modulator/Modulator.hpp
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:31 +0200
committerChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:31 +0200
commit0e579a45e2e5823f90e2632073749583cd15fa0d (patch)
tree5e709e13d41c8ea0da0968fb6c4566057b4b7909 /Modulator/Modulator.hpp
parent28d1767618141cd6481de2e93e36e3dfa555d4b4 (diff)
parent2d1068e60bce7ae1fff11623454900e8cee956b1 (diff)
Update upstream source from tag 'upstream/2.6.0_rc3+repack'
Update to upstream version '2.6.0~rc3+repack' with Debian dir 9ee8bc3a4b60bb88f4d57c7d1f2d37dbc1632144
Diffstat (limited to 'Modulator/Modulator.hpp')
-rwxr-xr-xModulator/Modulator.hpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/Modulator/Modulator.hpp b/Modulator/Modulator.hpp
index bb2d8652..d950ede4 100755
--- a/Modulator/Modulator.hpp
+++ b/Modulator/Modulator.hpp
@@ -1,96 +1,96 @@
-#ifndef MODULATOR_HPP__
-#define MODULATOR_HPP__
-
-#include <QAudio>
-#include <QPointer>
-
-#include "Audio/AudioDevice.hpp"
-
-class SoundOutput;
-
-//
-// Input device that generates PCM audio frames that encode a message
-// and an optional CW ID.
-//
-// Output can be muted while underway, preserving waveform timing when
-// transmission is resumed.
-//
-class Modulator
- : public AudioDevice
-{
- Q_OBJECT;
-
-public:
- enum ModulatorState {Synchronizing, Active, Idle};
-
- Modulator (unsigned frameRate, double periodLengthInSeconds, QObject * parent = nullptr);
-
- void close () override;
-
- bool isTuning () const {return m_tuning;}
- double frequency () const {return m_frequency;}
- bool isActive () const {return m_state != Idle;}
- void setSpread(double s) {m_fSpread=s;}
- void setTRPeriod(double p) {m_period=p;}
- void set_nsym(int n) {m_symbolsLength=n;}
- void set_ms0(qint64 ms) {m_ms0=ms;}
-
- Q_SLOT void start (QString mode, unsigned symbolsLength, double framesPerSymbol, double frequency,
- double toneSpacing, SoundOutput *, Channel = Mono,
- bool synchronize = true, bool fastMode = false,
- double dBSNR = 99., double TRperiod=60.0);
- Q_SLOT void stop (bool quick = false);
- Q_SLOT void tune (bool newState = true);
- Q_SLOT void setFrequency (double newFrequency) {m_frequency = newFrequency;}
- Q_SIGNAL void stateChanged (ModulatorState) const;
-
-protected:
- qint64 readData (char * data, qint64 maxSize) override;
- qint64 writeData (char const * /* data */, qint64 /* maxSize */) override
- {
- return -1; // we don't consume data
- }
-
-private:
- qint16 postProcessSample (qint16 sample) const;
-
- QPointer<SoundOutput> m_stream;
- bool m_quickClose;
-
- unsigned m_symbolsLength;
-
- static double constexpr m_twoPi = 2.0 * 3.141592653589793238462;
- unsigned m_nspd = 2048 + 512; // CW ID WPM factor = 22.5 WPM
-
- double m_phi;
- double m_dphi;
- double m_amp;
- double m_nsps;
- double m_frequency;
- double m_frequency0;
- double m_snr;
- double m_fac;
- double m_toneSpacing;
- double m_fSpread;
- double m_TRperiod;
- double m_period;
-
- qint64 m_silentFrames;
- qint64 m_ms0;
- qint16 m_ramp;
-
- unsigned m_frameRate;
- ModulatorState m_state;
-
- bool m_tuning;
- bool m_addNoise;
- bool m_bFastMode;
-
- bool m_cwLevel;
- unsigned m_ic;
- unsigned m_isym0;
- int m_j0;
- double m_toneFrequency0;
-};
-
-#endif
+#ifndef MODULATOR_HPP__
+#define MODULATOR_HPP__
+
+#include <QAudio>
+#include <QPointer>
+
+#include "Audio/AudioDevice.hpp"
+
+class SoundOutput;
+
+//
+// Input device that generates PCM audio frames that encode a message
+// and an optional CW ID.
+//
+// Output can be muted while underway, preserving waveform timing when
+// transmission is resumed.
+//
+class Modulator
+ : public AudioDevice
+{
+ Q_OBJECT;
+
+public:
+ enum ModulatorState {Synchronizing, Active, Idle};
+
+ Modulator (unsigned frameRate, double periodLengthInSeconds, QObject * parent = nullptr);
+
+ void close () override;
+
+ bool isTuning () const {return m_tuning;}
+ double frequency () const {return m_frequency;}
+ bool isActive () const {return m_state != Idle;}
+ void setSpread(double s) {m_fSpread=s;}
+ void setTRPeriod(double p) {m_period=p;}
+ void set_nsym(int n) {m_symbolsLength=n;}
+ void set_ms0(qint64 ms) {m_ms0=ms;}
+
+ Q_SLOT void start (QString mode, unsigned symbolsLength, double framesPerSymbol, double frequency,
+ double toneSpacing, SoundOutput *, Channel = Mono,
+ bool synchronize = true, bool fastMode = false,
+ double dBSNR = 99., double TRperiod=60.0);
+ Q_SLOT void stop (bool quick = false);
+ Q_SLOT void tune (bool newState = true);
+ Q_SLOT void setFrequency (double newFrequency) {m_frequency = newFrequency;}
+ Q_SIGNAL void stateChanged (ModulatorState) const;
+
+protected:
+ qint64 readData (char * data, qint64 maxSize) override;
+ qint64 writeData (char const * /* data */, qint64 /* maxSize */) override
+ {
+ return -1; // we don't consume data
+ }
+
+private:
+ qint16 postProcessSample (qint16 sample) const;
+
+ QPointer<SoundOutput> m_stream;
+ bool m_quickClose;
+
+ unsigned m_symbolsLength;
+
+ static double constexpr m_twoPi = 2.0 * 3.141592653589793238462;
+ unsigned m_nspd = 2048 + 512; // CW ID WPM factor = 22.5 WPM
+
+ double m_phi;
+ double m_dphi;
+ double m_amp;
+ double m_nsps;
+ double m_frequency;
+ double m_frequency0;
+ double m_snr;
+ double m_fac;
+ double m_toneSpacing;
+ double m_fSpread;
+ double m_TRperiod;
+ double m_period;
+
+ qint64 m_silentFrames;
+ qint64 m_ms0;
+ qint16 m_ramp;
+
+ unsigned m_frameRate;
+ ModulatorState m_state;
+
+ bool m_tuning;
+ bool m_addNoise;
+ bool m_bFastMode;
+
+ bool m_cwLevel;
+ unsigned m_ic;
+ unsigned m_isym0;
+ int m_j0;
+ double m_toneFrequency0;
+};
+
+#endif