kopia lustrzana https://gitlab.com/eliggett/wfview
Add audio buffersize slider and ability to select samplerate and number of channels.
rodzic
b6ad6218e1
commit
228fb07eed
|
@ -62,7 +62,7 @@ void rigCommander::commSetup(unsigned char rigCivAddr, QString rigSerialPort, qu
|
|||
|
||||
}
|
||||
|
||||
void rigCommander::commSetup(unsigned char rigCivAddr, QString ip, int cport, int sport, int aport, QString username, QString password)
|
||||
void rigCommander::commSetup(unsigned char rigCivAddr, QString ip, quint16 cport, quint16 sport, quint16 aport, QString username, QString password, quint16 buffer, quint16 sample, quint8 channels)
|
||||
{
|
||||
// construct
|
||||
// TODO: Bring this parameter and the comm port from the UI.
|
||||
|
@ -83,11 +83,12 @@ void rigCommander::commSetup(unsigned char rigCivAddr, QString ip, int cport, in
|
|||
this->username = username;
|
||||
this->password = password;
|
||||
if (udp == Q_NULLPTR) {
|
||||
udp = new udpHandler(ip, cport, sport, aport, username, password);
|
||||
udp = new udpHandler(ip, cport, sport, aport, username, password,buffer,sample,channels);
|
||||
connect(udp, SIGNAL(haveDataFromPort(QByteArray)), this, SLOT(handleNewData(QByteArray)));
|
||||
|
||||
// data from the program to the comm port:
|
||||
connect(this, SIGNAL(dataForComm(QByteArray)), udp, SLOT(receiveDataFromUserToRig(QByteArray)));
|
||||
connect(this, SIGNAL(haveChangeBufferSize(quint16)), udp, SLOT(changeBufferSize(quint16)));
|
||||
|
||||
// Connect for errors/alerts
|
||||
connect(udp, SIGNAL(haveNetworkError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
||||
|
@ -1414,6 +1415,11 @@ void rigCommander::getRigID()
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::changeBufferSize(const quint16 value)
|
||||
{
|
||||
emit haveChangeBufferSize(value);
|
||||
}
|
||||
|
||||
void rigCommander::sayAll()
|
||||
{
|
||||
QByteArray payload;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
public slots:
|
||||
void process();
|
||||
void commSetup(unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate);
|
||||
void commSetup(unsigned char rigCivAddr, QString ip, int cport, int sport, int aport, QString username, QString password);
|
||||
void commSetup(unsigned char rigCivAddr, QString ip, quint16 cport, quint16 sport, quint16 aport, QString username, QString password, quint16 buffer, quint16 sample, quint8 channels);
|
||||
void closeComm();
|
||||
|
||||
void enableSpectOutput();
|
||||
|
@ -65,6 +65,7 @@ public slots:
|
|||
void handleNewData(const QByteArray &data);
|
||||
void handleSerialPortError(const QString port, const QString errorText);
|
||||
void handleStatusUpdate(const QString text);
|
||||
void changeBufferSize(const quint16 value);
|
||||
void sayFrequency();
|
||||
void sayMode();
|
||||
void sayAll();
|
||||
|
@ -94,6 +95,7 @@ signals:
|
|||
void finished();
|
||||
void havePTTStatus(bool pttOn);
|
||||
void haveATUStatus(unsigned char status);
|
||||
void haveChangeBufferSize(quint16 value);
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -16,7 +16,7 @@ void rxAudioHandler::process()
|
|||
qDebug() << "rxAudio Handler created.";
|
||||
}
|
||||
|
||||
void rxAudioHandler::setup(const QAudioFormat format, const int bufferSize)
|
||||
void rxAudioHandler::setup(const QAudioFormat format, const quint16 bufferSize)
|
||||
{
|
||||
this->format = format;
|
||||
this->bufferSize = bufferSize;
|
||||
|
@ -32,12 +32,13 @@ void rxAudioHandler::incomingAudio(const QByteArray data)
|
|||
device->write(data,data.length());
|
||||
}
|
||||
|
||||
void rxAudioHandler::changeBufferSize(const int newSize)
|
||||
void rxAudioHandler::changeBufferSize(const quint16 newSize)
|
||||
{
|
||||
// TODO: make a way to change the buffer size.
|
||||
// possibly deleting the buffer and re-creating
|
||||
|
||||
QMutexLocker locker(&mutex);
|
||||
qDebug() << "Changing buffer size to: " << newSize << " from " << audio->bufferSize();
|
||||
audio->stop();
|
||||
audio->setBufferSize(newSize);
|
||||
device = audio->start();
|
||||
}
|
||||
|
||||
void rxAudioHandler::getBufferSize()
|
||||
|
|
|
@ -20,16 +20,15 @@ public:
|
|||
|
||||
public slots:
|
||||
void process();
|
||||
void setup(const QAudioFormat format, const int bufferSize);
|
||||
void setup(const QAudioFormat format, const quint16 bufferSize);
|
||||
|
||||
void incomingAudio(const QByteArray data);
|
||||
void changeBufferSize(const int newSize);
|
||||
void changeBufferSize(const quint16 newSize);
|
||||
void getBufferSize();
|
||||
|
||||
signals:
|
||||
void audioMessage(QString message);
|
||||
void sendBufferSize(int newSize);
|
||||
void sendAudioBufferSize(int newSize);
|
||||
void sendBufferSize(quint16 newSize);
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "udphandler.h"
|
||||
|
||||
|
||||
udpHandler::udpHandler(QString ip, int cport, int sport, int aport, QString username, QString password)
|
||||
udpHandler::udpHandler(QString ip, quint16 cport, quint16 sport, quint16 aport, QString username, QString password, quint16 buffer, quint16 sample,quint8 channels)
|
||||
{
|
||||
qDebug() << "Starting udpHandler";
|
||||
qDebug() << "Starting udpHandler user:" << username << " buffer:" << buffer << " sample rate: " << sample << " channels: " << channels;
|
||||
|
||||
// Lookup IP address
|
||||
|
||||
|
@ -15,6 +15,9 @@ udpHandler::udpHandler(QString ip, int cport, int sport, int aport, QString user
|
|||
this->sport = sport;
|
||||
this->username = username;
|
||||
this->password = password;
|
||||
this->bufferSize = buffer;
|
||||
this->sampleRate = sample;
|
||||
this->channelCount = channels;
|
||||
|
||||
// Try to set the IP address, if it is a hostname then perform a DNS lookup.
|
||||
if (!radioIP.setAddress(ip))
|
||||
|
@ -77,6 +80,11 @@ udpHandler::~udpHandler()
|
|||
}
|
||||
}
|
||||
|
||||
void udpHandler::changeBufferSize(quint16 value)
|
||||
{
|
||||
emit haveChangeBufferSize(value);
|
||||
}
|
||||
|
||||
void udpHandler::ReAuth()
|
||||
{
|
||||
qDebug() << "Performing ReAuth";
|
||||
|
@ -213,9 +221,10 @@ void udpHandler::DataReceived()
|
|||
{
|
||||
|
||||
serial = new udpSerial(localIP, radioIP, sport);
|
||||
audio = new udpAudio(localIP, radioIP, aport);
|
||||
audio = new udpAudio(localIP, radioIP, aport,bufferSize,sampleRate,channelCount);
|
||||
|
||||
QObject::connect(serial, SIGNAL(Receive(QByteArray)), this, SLOT(receiveFromSerialStream(QByteArray)));
|
||||
QObject::connect(this, SIGNAL(haveChangeBufferSize(quint16)), audio, SLOT(changeBufferSize(quint16)));
|
||||
|
||||
serialAndAudioOpened = true;
|
||||
|
||||
|
@ -277,7 +286,6 @@ qint64 udpHandler::SendRequestSerialAndAudio()
|
|||
|
||||
unsigned char* usernameEncoded = Passcode(username);
|
||||
int txSeqBufLengthMs = 100;
|
||||
int audioSampleRate = 48000;
|
||||
|
||||
const unsigned char p[] = {
|
||||
0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -300,8 +308,8 @@ qint64 udpHandler::SendRequestSerialAndAudio()
|
|||
usernameEncoded[4], usernameEncoded[5], usernameEncoded[6], usernameEncoded[7],
|
||||
usernameEncoded[8], usernameEncoded[9], usernameEncoded[10], usernameEncoded[11],
|
||||
usernameEncoded[12], usernameEncoded[13], usernameEncoded[14], usernameEncoded[15],
|
||||
0x01, 0x01, 0x04, 0x04, 0x00, 0x00, static_cast<unsigned char>(audioSampleRate >> 8 & 0xff), static_cast<unsigned char>(audioSampleRate & 0xff),
|
||||
0x00, 0x00, static_cast<unsigned char>(audioSampleRate >> 8 & 0xff), static_cast<unsigned char>(audioSampleRate & 0xff),
|
||||
0x01, 0x01, 0x04, 0x04, 0x00, 0x00, static_cast<unsigned char>(sampleRate >> 8 & 0xff), static_cast<unsigned char>(sampleRate & 0xff),
|
||||
0x00, 0x00, static_cast<unsigned char>(sampleRate >> 8 & 0xff), static_cast<unsigned char>(sampleRate & 0xff),
|
||||
0x00, 0x00, static_cast<unsigned char>(sport >> 8 & 0xff), static_cast<unsigned char>(sport & 0xff),
|
||||
0x00, 0x00, static_cast<unsigned char>(aport >> 8 & 0xff), static_cast<unsigned char>(aport & 0xff), 0x00, 0x00,
|
||||
static_cast<unsigned char>(txSeqBufLengthMs >> 8 & 0xff), static_cast<unsigned char>(txSeqBufLengthMs & 0xff), 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
@ -377,7 +385,7 @@ qint64 udpHandler::SendPacketAuth(uint8_t magic)
|
|||
|
||||
|
||||
// (pseudo) serial class
|
||||
udpSerial::udpSerial(QHostAddress local, QHostAddress ip, int sport)
|
||||
udpSerial::udpSerial(QHostAddress local, QHostAddress ip, quint16 sport)
|
||||
{
|
||||
qDebug() << "Starting udpSerial";
|
||||
localIP = local;
|
||||
|
@ -519,20 +527,23 @@ void udpSerial::DataReceived()
|
|||
|
||||
|
||||
// Audio stream
|
||||
udpAudio::udpAudio(QHostAddress local, QHostAddress ip, int aport)
|
||||
udpAudio::udpAudio(QHostAddress local, QHostAddress ip, quint16 aport, quint16 buffer, quint16 sample, quint8 channels)
|
||||
{
|
||||
qDebug() << "Starting udpAudio";
|
||||
localIP = local;
|
||||
port = aport;
|
||||
radioIP = ip;
|
||||
bufferSize = buffer;
|
||||
sampleRate = sample;
|
||||
channelCount = channels;
|
||||
|
||||
init(); // Perform connection
|
||||
|
||||
QUdpSocket::connect(udp, &QUdpSocket::readyRead, this, &udpAudio::DataReceived);
|
||||
|
||||
// Init audio
|
||||
format.setSampleRate(48000);
|
||||
format.setChannelCount(1);
|
||||
format.setSampleRate(sampleRate);
|
||||
format.setChannelCount(channelCount);
|
||||
format.setSampleSize(16);
|
||||
format.setCodec("audio/pcm");
|
||||
format.setByteOrder(QAudioFormat::LittleEndian);
|
||||
|
@ -581,12 +592,13 @@ udpAudio::udpAudio(QHostAddress local, QHostAddress ip, int aport)
|
|||
|
||||
rxaudio->moveToThread(rxAudioThread);
|
||||
|
||||
connect(this,SIGNAL(setupAudio(QAudioFormat,int)), rxaudio, SLOT(setup(QAudioFormat,int)));
|
||||
connect(this,SIGNAL(setupAudio(QAudioFormat,quint16)), rxaudio, SLOT(setup(QAudioFormat,quint16)));
|
||||
connect(this, SIGNAL(haveAudioData(QByteArray)), rxaudio, SLOT(incomingAudio(QByteArray)));
|
||||
connect(this, SIGNAL(haveChangeBufferSize(quint16)), rxaudio, SLOT(changeBufferSize(quint16)));
|
||||
connect(rxAudioThread, SIGNAL(finished()), rxaudio, SLOT(deleteLater()));
|
||||
|
||||
rxAudioThread->start();
|
||||
emit setupAudio(format, 12000);
|
||||
emit setupAudio(format, bufferSize);
|
||||
SendPacketConnect(); // First connect packet, audio should start very soon after.
|
||||
}
|
||||
|
||||
|
@ -598,6 +610,11 @@ udpAudio::~udpAudio()
|
|||
}
|
||||
}
|
||||
|
||||
void udpAudio::changeBufferSize(quint16 value)
|
||||
{
|
||||
emit haveChangeBufferSize(value);
|
||||
}
|
||||
|
||||
void udpAudio::DataReceived()
|
||||
{
|
||||
while (udp->hasPendingDatagrams()) {
|
||||
|
|
32
udphandler.h
32
udphandler.h
|
@ -66,8 +66,8 @@ public:
|
|||
QHostAddress radioIP;
|
||||
QHostAddress localIP;
|
||||
bool isAuthenticated = false;
|
||||
int localPort=0;
|
||||
int port=0;
|
||||
quint16 localPort=0;
|
||||
quint16 port=0;
|
||||
QTimer *pkt7Timer=Q_NULLPTR; // Send pkt7 packets every 3 seconds
|
||||
QTimer *pkt0Timer=Q_NULLPTR; // Send pkt0 packets every 1000ms.
|
||||
QTimer *periodic=Q_NULLPTR; // Send pkt0 packets every 1000ms.
|
||||
|
@ -94,7 +94,7 @@ class udpSerial : public udpBase
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
udpSerial(QHostAddress local, QHostAddress ip, int sport);
|
||||
udpSerial(QHostAddress local, QHostAddress ip, quint16 sport);
|
||||
QMutex serialmutex;
|
||||
|
||||
signals:
|
||||
|
@ -119,19 +119,26 @@ class udpAudio : public udpBase
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
udpAudio(QHostAddress local, QHostAddress ip, int aport);
|
||||
udpAudio(QHostAddress local, QHostAddress ip, quint16 aport, quint16 buffer, quint16 sample, quint8 channels);
|
||||
~udpAudio();
|
||||
QAudioOutput* audio;
|
||||
|
||||
signals:
|
||||
void haveAudioData(QByteArray data);
|
||||
void setupAudio(const QAudioFormat format, const int bufferSize);
|
||||
void setupAudio(const QAudioFormat format, const quint16 bufferSize);
|
||||
void haveChangeBufferSize(quint16 value);
|
||||
|
||||
public slots:
|
||||
void changeBufferSize(quint16 value);
|
||||
|
||||
private:
|
||||
|
||||
void DataReceived();
|
||||
|
||||
QBuffer* buffer;
|
||||
QAudioFormat format;
|
||||
quint16 bufferSize;
|
||||
quint16 sampleRate;
|
||||
quint8 channelCount;
|
||||
|
||||
bool sentPacketConnect2 = false;
|
||||
uint16_t sendAudioSeq = 0;
|
||||
|
@ -150,7 +157,7 @@ class udpHandler: public udpBase
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
udpHandler(QString ip, int cport, int sport, int aport, QString username, QString password);
|
||||
udpHandler(QString ip, quint16 cport, quint16 sport, quint16 aport, QString username, QString password, quint16 buffer, quint16 sample,quint8 channels);
|
||||
~udpHandler();
|
||||
|
||||
udpSerial *serial=Q_NULLPTR;
|
||||
|
@ -163,6 +170,7 @@ public:
|
|||
public slots:
|
||||
void receiveDataFromUserToRig(QByteArray); // This slot will send data on to
|
||||
void receiveFromSerialStream(QByteArray);
|
||||
void changeBufferSize(quint16 value);
|
||||
|
||||
|
||||
signals:
|
||||
|
@ -170,6 +178,7 @@ signals:
|
|||
void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander
|
||||
void haveNetworkError(QString, QString);
|
||||
void haveNetworkStatus(QString);
|
||||
void haveChangeBufferSize(quint16 value);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -187,9 +196,12 @@ private:
|
|||
|
||||
bool radioInUse = false;
|
||||
|
||||
int aport;
|
||||
int sport;
|
||||
int reauthInterval = 60000;
|
||||
quint16 aport;
|
||||
quint16 sport;
|
||||
quint16 sampleRate;
|
||||
quint16 bufferSize;
|
||||
quint8 channelCount;
|
||||
quint16 reauthInterval = 60000;
|
||||
QTimer reauthTimer;
|
||||
QByteArray devName;
|
||||
QByteArray compName;
|
||||
|
|
82
wfmain.cpp
82
wfmain.cpp
|
@ -147,10 +147,15 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
|
|||
connect(keyM, SIGNAL(activated()), this, SLOT(shortcutM()));
|
||||
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
const auto deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
for (const QAudioDeviceInfo& deviceInfo : deviceInfos) {
|
||||
const auto audioOutputs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
for (const QAudioDeviceInfo& deviceInfo : audioOutputs) {
|
||||
ui->audioOutputCombo->addItem(deviceInfo.deviceName());
|
||||
}
|
||||
const auto audioInputs = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
|
||||
for (const QAudioDeviceInfo& deviceInfo : audioInputs) {
|
||||
ui->audioInputCombo->addItem(deviceInfo.deviceName());
|
||||
}
|
||||
|
||||
setDefaultColors(); // set of UI colors with defaults populated
|
||||
setDefPrefs(); // other default options
|
||||
loadSettings(); // Look for saved preferences
|
||||
|
@ -412,19 +417,20 @@ void wfmain::openRig()
|
|||
connect(rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString)));
|
||||
connect(rig, SIGNAL(haveStatusUpdate(QString)), this, SLOT(receiveStatusUpdate(QString)));
|
||||
|
||||
connect(this, SIGNAL(sendCommSetup(unsigned char, QString, int, int, int, QString, QString)), rig, SLOT(commSetup(unsigned char, QString, int, int, int, QString, QString)));
|
||||
connect(this, SIGNAL(sendCommSetup(unsigned char, QString, quint16, quint16, quint16, QString, QString,quint16,quint16,quint8)), rig, SLOT(commSetup(unsigned char, QString, quint16, quint16, quint16, QString, QString,quint16,quint16,quint8)));
|
||||
connect(this, SIGNAL(sendCommSetup(unsigned char, QString, quint32)), rig, SLOT(commSetup(unsigned char, QString, quint32)));
|
||||
|
||||
connect(this, SIGNAL(sendCloseComm()), rig, SLOT(closeComm()));
|
||||
connect(this, SIGNAL(sendChangeBufferSize(quint16)), rig, SLOT(changeBufferSize(quint16)));
|
||||
connect(this, SIGNAL(getRigCIV()), rig, SLOT(findRigs()));
|
||||
connect(rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities)));
|
||||
connect(rig, SIGNAL(commReady()), this, SLOT(receiveCommReady()));
|
||||
|
||||
}
|
||||
|
||||
if (prefs.enableLAN)
|
||||
{
|
||||
emit sendCommSetup(prefs.radioCIVAddr, prefs.ipAddress, prefs.controlLANPort, prefs.serialLANPort, prefs.audioLANPort, prefs.username, prefs.password);
|
||||
emit sendCommSetup(prefs.radioCIVAddr, prefs.ipAddress, prefs.controlLANPort,
|
||||
prefs.serialLANPort, prefs.audioLANPort, prefs.username, prefs.password,prefs.audioBufferSize,prefs.audioSampleRate,prefs.audioChannels);
|
||||
} else {
|
||||
|
||||
if( (prefs.serialPortRadio == QString("auto")) && (serialPortCL.isEmpty()))
|
||||
|
@ -573,7 +579,11 @@ void wfmain::setDefPrefs()
|
|||
defPrefs.audioLANPort = 50003;
|
||||
defPrefs.username = QString("");
|
||||
defPrefs.password = QString("");
|
||||
defPrefs.audioOutput = QString("");
|
||||
defPrefs.audioOutput = QAudioDeviceInfo::defaultOutputDevice().deviceName();
|
||||
defPrefs.audioInput = QAudioDeviceInfo::defaultInputDevice().deviceName();
|
||||
defPrefs.audioBufferSize = 12000;
|
||||
defPrefs.audioChannels = 1;
|
||||
defPrefs.audioSampleRate = 48000;
|
||||
|
||||
}
|
||||
|
||||
|
@ -612,15 +622,19 @@ void wfmain::loadSettings()
|
|||
settings.beginGroup("LAN");
|
||||
prefs.enableLAN = settings.value("EnableLAN", defPrefs.enableLAN).toBool();
|
||||
ui->lanEnableChk->setChecked(prefs.enableLAN);
|
||||
|
||||
prefs.ipAddress = settings.value("IPAddress", defPrefs.ipAddress).toString();
|
||||
ui->ipAddressTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->ipAddressTxt->setText(prefs.ipAddress);
|
||||
|
||||
prefs.controlLANPort = settings.value("ControlLANPort", defPrefs.controlLANPort).toInt();
|
||||
ui->controlPortTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->controlPortTxt->setText(QString("%1").arg(prefs.controlLANPort));
|
||||
|
||||
prefs.serialLANPort = settings.value("SerialLANPort", defPrefs.serialLANPort).toInt();
|
||||
ui->serialPortTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->serialPortTxt->setText(QString("%1").arg(prefs.serialLANPort));
|
||||
|
||||
prefs.audioLANPort = settings.value("AudioLANPort", defPrefs.audioLANPort).toInt();
|
||||
ui->audioPortTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->audioPortTxt->setText(QString("%1").arg(prefs.audioLANPort));
|
||||
|
@ -628,15 +642,39 @@ void wfmain::loadSettings()
|
|||
prefs.username = settings.value("Username", defPrefs.username).toString();
|
||||
ui->usernameTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->usernameTxt->setText(QString("%1").arg(prefs.username));
|
||||
|
||||
prefs.password = settings.value("Password", defPrefs.password).toString();
|
||||
ui->passwordTxt->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->passwordTxt->setText(QString("%1").arg(prefs.password));
|
||||
|
||||
prefs.audioBufferSize = settings.value("AudioBufferSize", defPrefs.audioBufferSize).toInt();
|
||||
ui->audioBufferSizeSlider->setEnabled(ui->lanEnableChk->isChecked());
|
||||
ui->audioBufferSizeSlider->setValue(prefs.audioBufferSize);
|
||||
ui->audioBufferSizeSlider->setTracking(false); // Stop it sending value on every change.
|
||||
|
||||
prefs.audioSampleRate = settings.value("AudioSampleRate", defPrefs.audioSampleRate).toInt();
|
||||
ui->audioSampleRateCombo->setEnabled(ui->lanEnableChk->isChecked());
|
||||
int audioSampleRateIndex = ui->audioSampleRateCombo->findText(QString::number(prefs.audioSampleRate));
|
||||
if (audioSampleRateIndex != -1)
|
||||
ui->audioOutputCombo->setCurrentIndex(audioSampleRateIndex);
|
||||
|
||||
prefs.audioChannels = settings.value("AudioNumChannels", defPrefs.audioChannels).toInt();
|
||||
ui->audioChannelsCombo->setEnabled(ui->lanEnableChk->isChecked());
|
||||
int audioChannelsIndex = ui->audioChannelsCombo->findText(QString::number(prefs.audioChannels));
|
||||
if (audioChannelsIndex != -1)
|
||||
ui->audioChannelsCombo->setCurrentIndex(audioChannelsIndex);
|
||||
|
||||
prefs.audioOutput = settings.value("AudioOutput", defPrefs.audioOutput).toString();
|
||||
ui->audioOutputCombo->setEnabled(ui->lanEnableChk->isChecked());
|
||||
int audioIndex = ui->audioOutputCombo->findText("prefs.audioOutput");
|
||||
if (audioIndex -1)
|
||||
ui->audioOutputCombo->setCurrentIndex(audioIndex);
|
||||
int audioOutputIndex = ui->audioOutputCombo->findText(prefs.audioOutput);
|
||||
if (audioOutputIndex != -1)
|
||||
ui->audioOutputCombo->setCurrentIndex(audioOutputIndex);
|
||||
|
||||
prefs.audioInput = settings.value("AudioInput", defPrefs.audioInput).toString();
|
||||
ui->audioInputCombo->setEnabled(ui->lanEnableChk->isChecked());
|
||||
int audioInputIndex = ui->audioInputCombo->findText(prefs.audioInput);
|
||||
if (audioInputIndex != - 1)
|
||||
ui->audioOutputCombo->setCurrentIndex(audioInputIndex);
|
||||
|
||||
settings.endGroup();
|
||||
// Memory channels
|
||||
|
@ -713,7 +751,11 @@ void wfmain::saveSettings()
|
|||
settings.setValue("AudioLANPort", prefs.audioLANPort);
|
||||
settings.setValue("Username", prefs.username);
|
||||
settings.setValue("Password", prefs.password);
|
||||
settings.setValue("AudioBufferSize", prefs.audioBufferSize);
|
||||
settings.setValue("AudioSampleRate", prefs.audioSampleRate);
|
||||
settings.setValue("AudioNumChannels", prefs.audioChannels);
|
||||
settings.setValue("AudioOutput", prefs.audioOutput);
|
||||
settings.setValue("AudioInput", prefs.audioInput);
|
||||
settings.endGroup();
|
||||
|
||||
// Memory channels
|
||||
|
@ -2238,6 +2280,28 @@ void wfmain::on_audioOutputCombo_currentIndexChanged(QString text)
|
|||
prefs.audioOutput = text;
|
||||
}
|
||||
|
||||
void wfmain::on_audioInputCombo_currentIndexChanged(QString text)
|
||||
{
|
||||
prefs.audioInput = text;
|
||||
}
|
||||
|
||||
void wfmain::on_audioSampleRateCombo_currentIndexChanged(QString text)
|
||||
{
|
||||
prefs.audioSampleRate = text.toInt();
|
||||
}
|
||||
|
||||
void wfmain::on_audioChannelsCombo_currentIndexChanged(QString text)
|
||||
{
|
||||
prefs.audioChannels = text.toInt();
|
||||
}
|
||||
|
||||
void wfmain::on_audioBufferSizeSlider_valueChanged(int value)
|
||||
{
|
||||
prefs.audioBufferSize = value;
|
||||
ui->bufferValue->setText(QString::number(value));
|
||||
emit sendChangeBufferSize(value);
|
||||
}
|
||||
|
||||
void wfmain::on_toFixedBtn_clicked()
|
||||
{
|
||||
emit setScopeFixedEdge(oldLowerFreq, oldUpperFreq, ui->scopeEdgeCombo->currentIndex()+1);
|
||||
|
|
21
wfmain.h
21
wfmain.h
|
@ -69,8 +69,9 @@ signals:
|
|||
void sayMode();
|
||||
void sayAll();
|
||||
void sendCommSetup(unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate);
|
||||
void sendCommSetup(unsigned char rigCivAddr, QString ip, int cport, int sport, int aport, QString username, QString password);
|
||||
void sendCommSetup(unsigned char rigCivAddr, QString ip, quint16 cport, quint16 sport, quint16 aport, QString username, QString password, quint16 buffer, quint16 sample, quint8 channels);
|
||||
void sendCloseComm();
|
||||
void sendChangeBufferSize(quint16 value);
|
||||
|
||||
private slots:
|
||||
void shortcutF1();
|
||||
|
@ -259,10 +260,18 @@ private slots:
|
|||
|
||||
void on_audioOutputCombo_currentIndexChanged(QString text);
|
||||
|
||||
void on_audioInputCombo_currentIndexChanged(QString text);
|
||||
|
||||
void on_toFixedBtn_clicked();
|
||||
|
||||
void on_connectBtn_clicked();
|
||||
|
||||
void on_audioBufferSizeSlider_valueChanged(int value);
|
||||
|
||||
void on_audioChannelsCombo_currentIndexChanged(QString text);
|
||||
|
||||
void on_audioSampleRateCombo_currentIndexChanged(QString text);
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
QSettings settings;
|
||||
|
@ -393,12 +402,16 @@ private:
|
|||
bool niceTS;
|
||||
bool enableLAN;
|
||||
QString ipAddress;
|
||||
quint32 controlLANPort;
|
||||
quint32 serialLANPort;
|
||||
quint32 audioLANPort;
|
||||
quint16 controlLANPort;
|
||||
quint16 serialLANPort;
|
||||
quint16 audioLANPort;
|
||||
QString username;
|
||||
QString password;
|
||||
QString audioOutput;
|
||||
QString audioInput;
|
||||
quint16 audioBufferSize;
|
||||
quint16 audioSampleRate;
|
||||
quint8 audioChannels;
|
||||
} prefs;
|
||||
|
||||
preferences defPrefs;
|
||||
|
|
90
wfmain.ui
90
wfmain.ui
|
@ -1345,6 +1345,86 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Audio Buffer Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="audioBufferSizeSlider">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65536</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bufferValue">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Channels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="audioChannelsCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Sample Rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="audioSampleRateCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>48000</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>44100</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
|
@ -1355,6 +1435,16 @@
|
|||
<item>
|
||||
<widget class="QComboBox" name="audioOutputCombo"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Audio Input</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="audioInputCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Ładowanie…
Reference in New Issue