kopia lustrzana https://gitlab.com/eliggett/wfview
Set AFGain to 100% on LAN connections
rodzic
c2091e9c4e
commit
6bba4eb6dc
|
@ -781,7 +781,7 @@ bool audioHandler::init(const quint8 bits, const quint8 channels, const quint16
|
||||||
// chunk size is always relative to Internal Sample Rate.
|
// chunk size is always relative to Internal Sample Rate.
|
||||||
this->chunkSize = (INTERNAL_SAMPLE_RATE / 25) * radioChannels;
|
this->chunkSize = (INTERNAL_SAMPLE_RATE / 25) * radioChannels;
|
||||||
|
|
||||||
qDebug(logAudio()) << "Audio chunkSize: " << this->chunkSize;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "chunkSize: " << this->chunkSize;
|
||||||
|
|
||||||
int resample_error=0;
|
int resample_error=0;
|
||||||
|
|
||||||
|
@ -820,16 +820,15 @@ bool audioHandler::init(const quint8 bits, const quint8 channels, const quint16
|
||||||
}
|
}
|
||||||
|
|
||||||
wf_resampler_get_ratio(resampler, &ratioNum, &ratioDen);
|
wf_resampler_get_ratio(resampler, &ratioNum, &ratioDen);
|
||||||
qDebug(logAudio()) << "wf_resampler_init() returned: " << resample_error << " ratioNum" << ratioNum << " ratioDen" << ratioDen << " input " << isinput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "wf_resampler_init() returned: " << resample_error << " ratioNum" << ratioNum << " ratioDen" << ratioDen;
|
||||||
|
|
||||||
qDebug(logAudio()) << "Got audio port name: " << port;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "audio port name: " << port;
|
||||||
|
return isInitialized;
|
||||||
return isInitialized;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void audioHandler::setVolume(unsigned char volume)
|
void audioHandler::setVolume(unsigned char volume)
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << (isInput ? "Input" : "Output") << " setVolume: " << volume;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "setVolume: " << volume << "(" << (qreal)(volume/255.0) << ")";
|
||||||
if (audioOutput != Q_NULLPTR) {
|
if (audioOutput != Q_NULLPTR) {
|
||||||
audioOutput->setVolume((qreal)(volume / 255.0));
|
audioOutput->setVolume((qreal)(volume / 255.0));
|
||||||
}
|
}
|
||||||
|
@ -841,7 +840,7 @@ void audioHandler::setVolume(unsigned char volume)
|
||||||
bool audioHandler::setDevice(QAudioDeviceInfo deviceInfo)
|
bool audioHandler::setDevice(QAudioDeviceInfo deviceInfo)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << ": setDevice() running :" << deviceInfo.deviceName();
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "setDevice() running :" << deviceInfo.deviceName();
|
||||||
if (!deviceInfo.isFormatSupported(format)) {
|
if (!deviceInfo.isFormatSupported(format)) {
|
||||||
if (deviceInfo.isNull())
|
if (deviceInfo.isNull())
|
||||||
{
|
{
|
||||||
|
@ -878,7 +877,7 @@ bool audioHandler::setDevice(QAudioDeviceInfo deviceInfo)
|
||||||
|
|
||||||
void audioHandler::reinit()
|
void audioHandler::reinit()
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << ": reinit() running";
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "reinit() running";
|
||||||
if (audioOutput != Q_NULLPTR && audioOutput->state() != QAudio::StoppedState) {
|
if (audioOutput != Q_NULLPTR && audioOutput->state() != QAudio::StoppedState) {
|
||||||
this->stop();
|
this->stop();
|
||||||
}
|
}
|
||||||
|
@ -914,7 +913,7 @@ void audioHandler::reinit()
|
||||||
|
|
||||||
void audioHandler::start()
|
void audioHandler::start()
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << ": start() running";
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "start() running";
|
||||||
|
|
||||||
if ((audioOutput == Q_NULLPTR || audioOutput->state() != QAudio::StoppedState) &&
|
if ((audioOutput == Q_NULLPTR || audioOutput->state() != QAudio::StoppedState) &&
|
||||||
(audioInput == Q_NULLPTR || audioInput->state() != QAudio::StoppedState) ) {
|
(audioInput == Q_NULLPTR || audioInput->state() != QAudio::StoppedState) ) {
|
||||||
|
@ -934,7 +933,7 @@ void audioHandler::start()
|
||||||
|
|
||||||
void audioHandler::flush()
|
void audioHandler::flush()
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << ": flush() running";
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "flush() running";
|
||||||
this->stop();
|
this->stop();
|
||||||
if (isInput) {
|
if (isInput) {
|
||||||
audioInput->reset();
|
audioInput->reset();
|
||||||
|
@ -990,7 +989,7 @@ qint64 audioHandler::readData(char* data, qint64 maxlen)
|
||||||
int timediff = packet->time.msecsTo(QTime::currentTime());
|
int timediff = packet->time.msecsTo(QTime::currentTime());
|
||||||
|
|
||||||
if (timediff > (int)latency * 2) {
|
if (timediff > (int)latency * 2) {
|
||||||
qDebug(logAudio()) << "Packet " << hex << packet->seq <<
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Packet " << hex << packet->seq <<
|
||||||
" arrived too late (increase output latency!) " <<
|
" arrived too late (increase output latency!) " <<
|
||||||
dec << packet->time.msecsTo(QTime::currentTime()) << "ms";
|
dec << packet->time.msecsTo(QTime::currentTime()) << "ms";
|
||||||
while (packet !=audioBuffer.end() && timediff > (int)latency) {
|
while (packet !=audioBuffer.end() && timediff > (int)latency) {
|
||||||
|
@ -1027,7 +1026,7 @@ qint64 audioHandler::readData(char* data, qint64 maxlen)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug(logAudio()) << "Missing audio packet(s) from: " << hex << lastSeq + 1 << " to " << hex << packet->seq - 1;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Missing audio packet(s) from: " << hex << lastSeq + 1 << " to " << hex << packet->seq - 1;
|
||||||
lastSeq = packet->seq;
|
lastSeq = packet->seq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1103,31 +1102,31 @@ void audioHandler::stateChanged(QAudio::State state)
|
||||||
{
|
{
|
||||||
case QAudio::IdleState:
|
case QAudio::IdleState:
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << "Audio now in idle state: " << audioBuffer.length() << " packets in buffer, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Audio now in idle state: " << audioBuffer.length() << " packets in buffer";
|
||||||
if (audioOutput != Q_NULLPTR && audioOutput->error() == QAudio::UnderrunError)
|
if (audioOutput != Q_NULLPTR && audioOutput->error() == QAudio::UnderrunError)
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << "Output buffer underrun, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "buffer underrun";
|
||||||
audioOutput->suspend();
|
audioOutput->suspend();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAudio::ActiveState:
|
case QAudio::ActiveState:
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << "Audio now in active state: " << audioBuffer.length() << " packets in buffer, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Audio now in active state: " << audioBuffer.length() << " packets in buffer";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAudio::SuspendedState:
|
case QAudio::SuspendedState:
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << "Audio now in suspended state: " << audioBuffer.length() << " packets in buffer, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Audio now in suspended state: " << audioBuffer.length() << " packets in buffer";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAudio::StoppedState:
|
case QAudio::StoppedState:
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << "Audio now in stopped state: " << audioBuffer.length() << " packets in buffer, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Audio now in stopped state: " << audioBuffer.length() << " packets in buffer";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
qDebug(logAudio()) << "Unhandled audio state: " << audioBuffer.length() << " packets in buffer, isInput=" << isInput;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Unhandled audio state: " << audioBuffer.length() << " packets in buffer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1179,7 @@ void audioHandler::incomingAudio(audioPacket data)
|
||||||
err = wf_resampler_process_interleaved_int(resampler, (const qint16*)data.datain.constData(), &inFrames, (qint16*)data.dataout.data(), &outFrames);
|
err = wf_resampler_process_interleaved_int(resampler, (const qint16*)data.datain.constData(), &inFrames, (qint16*)data.dataout.data(), &outFrames);
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
qDebug(logAudio()) << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
qDebug(logAudio()) <<(isInput ? "Input" : "Output") << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1207,7 +1206,7 @@ void audioHandler::incomingAudio(audioPacket data)
|
||||||
|
|
||||||
void audioHandler::changeLatency(const quint16 newSize)
|
void audioHandler::changeLatency(const quint16 newSize)
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << this->metaObject()->className() << ": Changing latency to: " << newSize << " from " << latency;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << latency;
|
||||||
latency = newSize;
|
latency = newSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,7 +1259,7 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
||||||
err = wf_resampler_process_interleaved_int(resampler, in, &inFrames, out, &outFrames);
|
err = wf_resampler_process_interleaved_int(resampler, in, &inFrames, out, &outFrames);
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
qDebug(logAudio()) << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
qDebug(logAudio()) << (isInput ? "Input" : "Output") << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
||||||
}
|
}
|
||||||
//qDebug(logAudio()) << "Resampler run " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
//qDebug(logAudio()) << "Resampler run " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
||||||
//qDebug(logAudio()) << "Resampler run inLen:" << packet->datain.length() << " outLen:" << packet->dataout.length();
|
//qDebug(logAudio()) << "Resampler run inLen:" << packet->datain.length() << " outLen:" << packet->dataout.length();
|
||||||
|
|
|
@ -138,7 +138,7 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs)
|
||||||
|
|
||||||
connect(ptty, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
connect(ptty, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
||||||
connect(this, SIGNAL(getMoreDebug()), ptty, SLOT(debugThis()));
|
connect(this, SIGNAL(getMoreDebug()), ptty, SLOT(debugThis()));
|
||||||
|
emit haveAfGain(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
// data from the comm port to the program:
|
// data from the comm port to the program:
|
||||||
|
@ -976,8 +976,10 @@ void rigCommander::parseLevels()
|
||||||
switch(payloadIn[1])
|
switch(payloadIn[1])
|
||||||
{
|
{
|
||||||
case '\x01':
|
case '\x01':
|
||||||
// AF level
|
// AF level - ignore if LAN connection.
|
||||||
emit haveAfGain(level);
|
if (udp == Q_NULLPTR) {
|
||||||
|
emit haveAfGain(level);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '\x02':
|
case '\x02':
|
||||||
// RX RF Gain
|
// RX RF Gain
|
||||||
|
|
Ładowanie…
Reference in New Issue