summaryrefslogtreecommitdiff
path: root/Modulator/JttyTxStream.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
commit059831534c7e884f0a607ed86b582fd00d821731 (patch)
tree76bcb67a78f8aa2654fd34c2ad801a62136b0170 /Modulator/JttyTxStream.hpp
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'Modulator/JttyTxStream.hpp')
-rw-r--r--Modulator/JttyTxStream.hpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/Modulator/JttyTxStream.hpp b/Modulator/JttyTxStream.hpp
new file mode 100644
index 00000000..1a1d8784
--- /dev/null
+++ b/Modulator/JttyTxStream.hpp
@@ -0,0 +1,60 @@
+#ifndef JTTY_TX_STREAM_HPP__
+#define JTTY_TX_STREAM_HPP__
+
+#include <atomic>
+#include <QPointer>
+#include <QTimer>
+#include <QVector>
+
+#include "Audio/AudioDevice.hpp"
+#include "Audio/TxAudioQueue.hpp"
+#include "Audio/TxPlaybackEvidence.hpp"
+#include "Audio/TxRequest.hpp"
+
+class SoundOutput;
+
+TxEvidence::TxStartSnapshot makeJttyTxStartSnapshot (
+ TxEvidence::TxRequest const& request, qint64 committedEndSample);
+
+//
+// JTTY-only asynchronous transmit source.
+//
+// A QIODevice adapter around the shared JTTY PCM FIFO. readData() only serves
+// samples and records drain readiness; drained() is emitted by a timer outside
+// the audio pull path.
+//
+class JttyTxStream
+ : public AudioDevice
+{
+ Q_OBJECT;
+
+public:
+ explicit JttyTxStream (TxAudioQueue& queue, QObject * parent = nullptr);
+
+ bool isActive () const {return m_active;}
+
+ Q_SLOT void start (TxEvidence::TxRequest request, SoundOutput * stream);
+ Q_SLOT void stop ();
+
+ Q_SIGNAL void drained (TxAudioQueueDrainState drain);
+ Q_SIGNAL void txSourceCommitted (TxEvidence::TxStartSnapshot snapshot);
+
+protected:
+ qint64 readData (char * data, qint64 maxSize) override;
+ qint64 writeData (char const * /* data */, qint64 /* maxSize */) override
+ {
+ return -1; // we don't consume data
+ }
+
+private:
+ Q_SLOT void pollDrain ();
+
+ TxAudioQueue& m_queue;
+ std::atomic<qint64> m_drainGuard;
+
+ QPointer<SoundOutput> m_stream;
+ QTimer * m_drainTimer;
+ std::atomic<bool> m_active;
+};
+
+#endif