summaryrefslogtreecommitdiff
path: root/Modulator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Modulator.hpp')
-rw-r--r--Modulator.hpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/Modulator.hpp b/Modulator.hpp
index 80c900c0..ca711b99 100644
--- a/Modulator.hpp
+++ b/Modulator.hpp
@@ -2,6 +2,7 @@
#define MODULATOR_HPP__
#include <QAudio>
+#include <QPointer>
#include "AudioDevice.hpp"
@@ -27,19 +28,24 @@ public:
void close () override;
bool isTuning () const {return m_tuning;}
- unsigned frequency () const {return m_frequency;}
+ double frequency () const {return m_frequency;}
bool isActive () const {return m_state != Idle;}
void setSpread(double s) {m_fSpread=s;}
+ void setPeriod(unsigned p) {m_period=p;}
+ void set_nsym(int n) {m_symbolsLength=n;}
- Q_SLOT void start (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, double toneSpacing, SoundOutput *, Channel = Mono, bool synchronize = true, double dBSNR = 99.);
+ Q_SLOT void start (unsigned symbolsLength, double framesPerSymbol, double frequency,
+ double toneSpacing, SoundOutput *, Channel = Mono,
+ bool synchronize = true, bool fastMode = false,
+ double dBSNR = 99., int TRperiod=60);
Q_SLOT void stop (bool quick = false);
Q_SLOT void tune (bool newState = true);
- Q_SLOT void setFrequency (unsigned newFrequency) {m_frequency = newFrequency;}
+ Q_SLOT void setFrequency (double newFrequency) {m_frequency = newFrequency;}
Q_SIGNAL void stateChanged (ModulatorState) const;
protected:
- qint64 readData (char * data, qint64 maxSize);
- qint64 writeData (char const * /* data */, qint64 /* maxSize */)
+ qint64 readData (char * data, qint64 maxSize) override;
+ qint64 writeData (char const * /* data */, qint64 /* maxSize */) override
{
return -1; // we don't consume data
}
@@ -47,13 +53,13 @@ protected:
private:
qint16 postProcessSample (qint16 sample) const;
- SoundOutput * m_stream;
+ QPointer<SoundOutput> m_stream;
bool m_quickClose;
unsigned m_symbolsLength;
- static double const m_twoPi;
- static unsigned const m_nspd; // CW ID WPM factor
+ 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;
@@ -67,6 +73,8 @@ private:
double m_fSpread;
qint64 m_silentFrames;
+ qint32 m_TRperiod;
+ qint16 m_ramp;
unsigned m_frameRate;
unsigned m_period;
@@ -74,11 +82,13 @@ private:
bool volatile m_tuning;
bool m_addNoise;
+ bool m_bFastMode;
bool m_cwLevel;
unsigned m_ic;
unsigned m_isym0;
- qint16 m_ramp;
+ int m_j0;
+ double m_toneFrequency0;
};
#endif