Skip to content

Commit

Permalink
FIX(client): Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Oct 15, 2024
1 parent cb01bfa commit 5dd26f4
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/mumble/AudioWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <cmath>

#include <QDebug>

AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
bInit = true;
bLastActive = false;
Expand Down Expand Up @@ -47,12 +49,23 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
if (AudioInputRegistrar::qmNew) {
foreach (AudioInputRegistrar *air, *AudioInputRegistrar::qmNew) {
qcbInput->addItem(air->name);
qDebug() << air->name;
if (air->name == AudioInputRegistrar::current) {
qDebug() << "is current";
qcbInput->setCurrentIndex(qcbInput->count() - 1);
EchoCancelOptionID echoCancelOptionId = firstUsableEchoCancellation(air, qcbOutput->currentText());
if (echoCancelOptionId != EchoCancelOptionID::DISABLED) {
qcbEcho->setEnabled(true);
bool echoCancelPossible = echoCancelOptionId != EchoCancelOptionID::DISABLED;
qcbEcho->setEnabled(echoCancelPossible);
if (echoCancelPossible) {
qDebug() << "echoCancelOptionId "
<< " is not disabled";
qDebug() << "echoOPtion"
<< " disabled?" << (Global::get().s.echoOption != EchoCancelOptionID::DISABLED);
qcbEcho->setChecked(Global::get().s.echoOption != EchoCancelOptionID::DISABLED);
} else {
qDebug() << "echoCancelOptionId "
<< " is disabled";
qcbEcho->setChecked(false);
}
}
QList< audioDevice > ql = air->getDeviceChoices();
Expand Down Expand Up @@ -244,6 +257,8 @@ void AudioWizard::on_qcbInputDevice_activated(int) {
}

EchoCancelOptionID echoCancelOptionId = firstUsableEchoCancellation(air, qcbOutput->currentText());
qDebug() << "inputDeviceActivated echoCancelOptionId "
<< " disabled?" << (echoCancelOptionId != EchoCancelOptionID::DISABLED);
qcbEcho->setEnabled(echoCancelOptionId != EchoCancelOptionID::DISABLED);

Global::get().ai = AudioInputPtr(air->create());
Expand Down Expand Up @@ -286,6 +301,8 @@ void AudioWizard::on_qcbOutputDevice_activated(int) {

AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
EchoCancelOptionID echoCancelOptionId = firstUsableEchoCancellation(air, qcbOutput->currentText());
qDebug() << "outputDeviceActivated echoCancelOptionId"
<< " disabled?" << (echoCancelOptionId != EchoCancelOptionID::DISABLED);
qcbEcho->setEnabled(echoCancelOptionId != EchoCancelOptionID::DISABLED);

Global::get().ao = AudioOutputPtr(aor->create());
Expand Down Expand Up @@ -684,6 +701,7 @@ void AudioWizard::on_qpbPTT_clicked() {
}

void AudioWizard::on_qcbEcho_clicked(bool on) {
qDebug() << "echoClicked on:" << on;
if (on) {
AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
Global::get().s.echoOption = firstUsableEchoCancellation(air, qcbOutput->currentText());
Expand Down Expand Up @@ -768,8 +786,15 @@ void AudioWizard::on_qrbQualityCustom_clicked() {
}

EchoCancelOptionID AudioWizard::firstUsableEchoCancellation(AudioInputRegistrar *air, const QString outputSys) {
const QString outputSystem;
if (!outputSys.isEmpty()) {
outputSystem = outputSys
} else {
outputSystem = Global::get().s.qsAudioOutput;
}
qDebug() << "First usable for " << air->name << " os " << outputSystem;
for (EchoCancelOptionID ecoid : air->echoOptions) {
if (air->canEcho(ecoid, outputSys)) {
if (air->canEcho(ecoid, outputSystem)) {
return ecoid;
}
}
Expand Down

0 comments on commit 5dd26f4

Please sign in to comment.