summaryrefslogtreecommitdiff
path: root/qmap/soundin.h
diff options
context:
space:
mode:
authortony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
committertony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
commit393a486ee1d7e308a49f8e0b8c3a4b2f43223248 (patch)
tree6a6e8a56ace360795e1cf1a310d5652bb23f1386 /qmap/soundin.h
parent6a285ab382ebff18c88e52bec75dc1773ac33b74 (diff)
New upstream version 2.7.0~rc2+repackupstream/2.7.0_rc2+repack
Diffstat (limited to 'qmap/soundin.h')
-rwxr-xr-xqmap/soundin.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/qmap/soundin.h b/qmap/soundin.h
new file mode 100755
index 00000000..50417c0b
--- /dev/null
+++ b/qmap/soundin.h
@@ -0,0 +1,73 @@
+#ifndef SOUNDIN_H
+#define SOUNDIN_H
+
+#include <QtCore>
+#include <QtNetwork/QUdpSocket>
+#include <QDebug>
+#include <valarray>
+
+// Thread gets audio data from soundcard and signals when a buffer of
+// specified size is available.
+class SoundInThread : public QThread
+{
+ Q_OBJECT
+ bool quitExecution; // if true, thread exits gracefully
+ double m_rate; // sample rate
+ unsigned bufSize; // user's buffer size
+
+protected:
+ virtual void run();
+
+public:
+ bool m_dataSinkBusy;
+
+ SoundInThread():
+ quitExecution(false),
+ m_rate(0),
+ bufSize(0),
+ m_dataSinkBusy(false)
+ {
+ }
+
+ void setScale(qint32 n);
+ void setPort(qint32 n);
+ void setRate(double rate);
+ void setBufSize(unsigned bufSize);
+ void setNetwork(bool b);
+ void setMonitoring(bool b);
+ void setFadd(double x);
+ void setNrx(int n);
+ void setPeriod(int n);
+ int nrx();
+ int mhsym();
+
+signals:
+ void bufferAvailable(std::valarray<qint16> samples, double rate);
+ void readyForFFT(int k);
+ void error(const QString& message);
+ void status(const QString& message);
+
+public slots:
+ void quit();
+
+private:
+ void inputUDP();
+
+ double m_fAdd;
+ bool m_net;
+ bool m_monitoring;
+ qint32 m_nrx;
+ qint32 m_hsym;
+ qint32 m_udpPort;
+ qint32 m_TRperiod;
+ qint32 m_TRperiod0;
+ qint32 m_dB;
+
+ QUdpSocket *udpSocket;
+};
+
+extern "C" {
+ void recvpkt_(int* nsam, quint16* iblk, qint8* nrx, int* k, double s1[], double s2[]);
+}
+
+#endif // SOUNDIN_H