summaryrefslogtreecommitdiff
path: root/Modulator/JttyTxStream.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /Modulator/JttyTxStream.hpp
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
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