diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /Modulator/JttyTxStream.hpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'Modulator/JttyTxStream.hpp')
| -rw-r--r-- | Modulator/JttyTxStream.hpp | 60 |
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 |
