kopia lustrzana https://gitlab.com/eliggett/wfview
Tidy code after merge
rodzic
ada263efed
commit
914477d1dc
|
@ -407,7 +407,7 @@ void audioHandler::start()
|
|||
|
||||
void audioHandler::setVolume(unsigned char volume)
|
||||
{
|
||||
//this->volume = (qreal)volume/255.0;
|
||||
|
||||
this->volume = audiopot[volume];
|
||||
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")";
|
||||
|
@ -494,12 +494,6 @@ qint64 audioHandler::readData(char* buffer, qint64 nBytes)
|
|||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Packet " << hex << packet.seq <<
|
||||
" arrived too late (increase output latency!) " <<
|
||||
dec << packet.time.msecsTo(QTime::currentTime()) << "ms";
|
||||
while (currentLatency > setup.latency/2) {
|
||||
if (!ringBuf->try_read(packet)) {
|
||||
break;
|
||||
}
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime());
|
||||
}
|
||||
delayedPackets++;
|
||||
}
|
||||
|
||||
|
@ -534,6 +528,7 @@ qint64 audioHandler::readData(char* buffer, qint64 nBytes)
|
|||
}
|
||||
|
||||
if (delayedPackets > 10) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Too many delayed packets, flushing buffer";
|
||||
while (ringBuf->try_read(packet)); // Empty buffer
|
||||
delayedPackets = 0;
|
||||
}
|
||||
|
@ -788,9 +783,6 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
|||
" arrived too late (increase latency!) " <<
|
||||
dec << packet.time.msecsTo(QTime::currentTime()) << "ms";
|
||||
delayedPackets++;
|
||||
// if (!ringBuf->try_read(packet))
|
||||
// break;
|
||||
// currentLatency = packet.time.msecsTo(QTime::currentTime());
|
||||
}
|
||||
|
||||
//qDebug(logAudio) << "Chunksize" << this->chunkSize << "Packet size" << packet.data.length();
|
||||
|
@ -889,6 +881,7 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
|||
ret = packet.data;
|
||||
//qDebug(logAudio()) << "Now radio format, length" << packet.data.length();
|
||||
if (delayedPackets > 10) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Too many delayed packets, flushing buffer";
|
||||
while (ringBuf->try_read(packet)); // Empty buffer
|
||||
delayedPackets = 0;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,13 @@
|
|||
#define TOKEN_RENEWAL 60000
|
||||
#define PING_PERIOD 500
|
||||
#define IDLE_PERIOD 100
|
||||
#define TXAUDIO_PERIOD 10
|
||||
#define AREYOUTHERE_PERIOD 500
|
||||
#define WATCHDOG_PERIOD 500
|
||||
#define RETRANSMIT_PERIOD 100 // How often to attempt retransmit
|
||||
#define LOCK_PERIOD 10 // How long to try to lock mutex (ms)
|
||||
#define STALE_CONNECTION 15 // Not heard from in this many seconds
|
||||
#define BUFSIZE 50 // Number of packets to buffer
|
||||
#define TXAUDIO_PERIOD 20
|
||||
|
||||
|
||||
// Fixed Size Packets
|
||||
|
@ -35,8 +36,6 @@
|
|||
#define AUDIO_SIZE 0x18
|
||||
#define DATA_SIZE 0x15
|
||||
|
||||
#define BUFSIZE 50 // Number of packets to buffer
|
||||
#define TXAUDIO_PERIOD 20
|
||||
|
||||
// 0x10 length control packet (connect/disconnect/idle.)
|
||||
typedef union control_packet {
|
||||
|
|
|
@ -24,14 +24,6 @@
|
|||
#include "audiohandler.h"
|
||||
#include "packettypes.h"
|
||||
|
||||
#define PURGE_SECONDS 10
|
||||
#define TOKEN_RENEWAL 60000
|
||||
#define PING_PERIOD 100
|
||||
#define IDLE_PERIOD 100
|
||||
#define AREYOUTHERE_PERIOD 500
|
||||
#define WATCHDOG_PERIOD 500
|
||||
#define RETRANSMIT_PERIOD 100
|
||||
#define LOCK_PERIOD 100
|
||||
|
||||
struct udpPreferences {
|
||||
QString ipAddress;
|
||||
|
|
|
@ -12,14 +12,9 @@ udpServer::udpServer(SERVERCONFIG config, audioSetup outAudio, audioSetup inAudi
|
|||
qInfo(logUdpServer()) << "Starting udp server";
|
||||
}
|
||||
|
||||
void udpServer::init(SERVERCONFIG conf, audioSetup out, audioSetup in)
|
||||
void udpServer::init()
|
||||
{
|
||||
|
||||
qInfo(logUdpServer()) << "Input audio device:" << in.name;
|
||||
qInfo(logUdpServer()) << "Output audio device:" << out.name;
|
||||
this->config = conf;
|
||||
this->outAudio = out;
|
||||
this->inAudio = in;
|
||||
srand(time(NULL)); // Generate random key
|
||||
timeStarted.start();
|
||||
// Convoluted way to find the external IP address, there must be a better way????
|
||||
|
|
|
@ -60,11 +60,11 @@ class udpServer : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
udpServer();
|
||||
udpServer(SERVERCONFIG config, audioSetup outAudio, audioSetup inAudio);
|
||||
~udpServer();
|
||||
|
||||
public slots:
|
||||
void init(SERVERCONFIG sc, audioSetup ai, audioSetup ao);
|
||||
void init();
|
||||
void dataForServer(QByteArray);
|
||||
void receiveAudioData(const audioPacket &data);
|
||||
void receiveRigCaps(rigCapabilities caps);
|
||||
|
|
|
@ -966,14 +966,14 @@ void wfmain::setServerToPrefs()
|
|||
serverConfig.lan = prefs.enableLAN;
|
||||
qInfo(logAudio()) << "Audio Input device " << serverRxSetup.name;
|
||||
qInfo(logAudio()) << "Audio Output device " << serverTxSetup.name;
|
||||
udp = new udpServer();
|
||||
udp = new udpServer(serverConfig, serverTxSetup, serverRxSetup);
|
||||
|
||||
serverThread = new QThread(this);
|
||||
|
||||
udp->moveToThread(serverThread);
|
||||
|
||||
|
||||
connect(this, SIGNAL(initServer(SERVERCONFIG, audioSetup, audioSetup)), udp, SLOT(init(SERVERCONFIG, audioSetup, audioSetup)));
|
||||
connect(this, SIGNAL(initServer()), udp, SLOT(init()));
|
||||
connect(serverThread, SIGNAL(finished()), udp, SLOT(deleteLater()));
|
||||
|
||||
if (rig != Q_NULLPTR) {
|
||||
|
@ -988,7 +988,7 @@ void wfmain::setServerToPrefs()
|
|||
|
||||
serverThread->start();
|
||||
|
||||
emit initServer(serverConfig, serverTxSetup, serverRxSetup);
|
||||
emit initServer();
|
||||
|
||||
connect(this, SIGNAL(sendRigCaps(rigCapabilities)), udp, SLOT(receiveRigCaps(rigCapabilities)));
|
||||
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -162,7 +162,7 @@ signals:
|
|||
void sendCommSetup(unsigned char rigCivAddr, udpPreferences prefs, audioSetup rxSetup, audioSetup txSetup, QString vsp);
|
||||
void sendCloseComm();
|
||||
void sendChangeLatency(quint16 latency);
|
||||
void initServer(SERVERCONFIG sc, audioSetup ai, audioSetup ao);
|
||||
void initServer();
|
||||
void sendRigCaps(rigCapabilities caps);
|
||||
void requestRigState();
|
||||
void stateUpdated();
|
||||
|
|
Ładowanie…
Reference in New Issue