From b3f611543c23679a593e9bffb5bf5e51c6205cd1 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 14 May 2022 13:45:56 +0100 Subject: [PATCH] Make RT/PA a subclass of audioHandler --- pahandler.h | 3 ++- rthandler.h | 4 ++-- udpaudio.h | 4 ++-- udpserver.cpp | 8 ++++---- udpserver.h | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pahandler.h b/pahandler.h index cd55e95..a8fac05 100644 --- a/pahandler.h +++ b/pahandler.h @@ -18,6 +18,7 @@ /* Logarithmic taper for volume control */ #include "audiotaper.h" +#include "audiohandler.h" /* Audio converter class*/ #include "audioconverter.h" @@ -25,7 +26,7 @@ #include -class paHandler : public QObject +class paHandler : public audioHandler { Q_OBJECT diff --git a/rthandler.h b/rthandler.h index 10acd78..cbbd4b4 100644 --- a/rthandler.h +++ b/rthandler.h @@ -25,14 +25,14 @@ /* Logarithmic taper for volume control */ #include "audiotaper.h" - +#include "audiohandler.h" /* Audio converter class*/ #include "audioconverter.h" #include -class rtHandler : public QObject +class rtHandler : public audioHandler { Q_OBJECT diff --git a/udpaudio.h b/udpaudio.h index 478c342..87ae9cf 100644 --- a/udpaudio.h +++ b/udpaudio.h @@ -69,10 +69,10 @@ private: uint16_t sendAudioSeq = 0; - QObject* rxaudio = Q_NULLPTR; + audioHandler* rxaudio = Q_NULLPTR; QThread* rxAudioThread = Q_NULLPTR; - QObject* txaudio = Q_NULLPTR; + audioHandler* txaudio = Q_NULLPTR; QThread* txAudioThread = Q_NULLPTR; QTimer* txAudioTimer = Q_NULLPTR; diff --git a/udpserver.cpp b/udpserver.cpp index 255ba61..b99f2eb 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -395,13 +395,13 @@ void udpServer::controlReceived() connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); // Not sure how we make this work in QT5.9? -#if (QT_VERSION >= QT_VERSION_CHECK(7,10,0)) - QMetaObject::invokeMethod((audioHandler*)radio->txaudio, [=]() { +#if (QT_VERSION >= QT_VERSION_CHECK(5,10,0)) + QMetaObject::invokeMethod(radio->txaudio, [=]() { radio->txaudio->init(radio->txAudioSetup); }, Qt::QueuedConnection); #else emit setupTxAudio(radio->txAudioSetup); - //#warning "QT 5.9 is not fully supported multiple rigs will NOT work!" + #warning "QT 5.9 is not fully supported multiple rigs will NOT work!" #endif hasTxAudio = datagram.senderAddress(); @@ -442,7 +442,7 @@ void udpServer::controlReceived() connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); -#if (QT_VERSION >= QT_VERSION_CHECK(7,10,0)) +#if (QT_VERSION >= QT_VERSION_CHECK(5,10,0)) QMetaObject::invokeMethod(radio->rxaudio, [=]() { radio->rxaudio->init(radio->rxAudioSetup); }, Qt::QueuedConnection); diff --git a/udpserver.h b/udpserver.h index ff2e78d..3cbed99 100644 --- a/udpserver.h +++ b/udpserver.h @@ -70,9 +70,9 @@ struct RIGCONFIG { rigCapabilities rigCaps; rigCommander* rig = Q_NULLPTR; QThread* rigThread = Q_NULLPTR; - QObject* rxaudio = Q_NULLPTR; + audioHandler* rxaudio = Q_NULLPTR; QThread* rxAudioThread = Q_NULLPTR; - QObject* txaudio = Q_NULLPTR; + audioHandler* txaudio = Q_NULLPTR; QThread* txAudioThread = Q_NULLPTR; QTimer* rxAudioTimer = Q_NULLPTR; QTimer* connectTimer = Q_NULLPTR;