From 3edbeefdb73b650d466b76583c8dac664d4d6ee0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 4 Jul 2019 22:59:12 -0700 Subject: Add a setting for hrtf-mode to alsoft-config --- utils/alsoft-config/mainwindow.cpp | 37 ++++++++++++++++++++ utils/alsoft-config/mainwindow.h | 1 + utils/alsoft-config/mainwindow.ui | 71 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 4e2b2464..687f9134 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -123,6 +123,14 @@ static const struct NameValuePair { { "ACN, N3D", "acn+n3d" }, { "Furse-Malham", "fuma" }, + { "", "" } +}, hrtfModeList[] = { + { "1st Order Ambisonic", "ambi1" }, + { "2nd Order Ambisonic", "ambi2" }, + { "3rd Order Ambisonic", "ambi3" }, + { "Default (Full)", "" }, + { "Full", "full" }, + { "", "" } }; @@ -267,6 +275,9 @@ MainWindow::MainWindow(QWidget *parent) : } ui->resamplerSlider->setRange(0, count-1); + for(count = 0;hrtfModeList[count].name[0];count++) { + } + ui->hrtfqualitySlider->setRange(0, count-1); ui->hrtfStateComboBox->adjustSize(); #if !defined(HAVE_NEON) && !defined(HAVE_SSE) @@ -367,6 +378,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->preferredHrtfComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton())); connect(ui->hrtfStateComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton())); + connect(ui->hrtfqualitySlider, SIGNAL(valueChanged(int)), this, SLOT(updateHrtfModeLabel(int))); + connect(ui->hrtfAddButton, SIGNAL(clicked()), this, SLOT(addHrtfFile())); connect(ui->hrtfRemoveButton, SIGNAL(clicked()), this, SLOT(removeHrtfFile())); connect(ui->hrtfFileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateHrtfRemoveButton())); @@ -725,6 +738,21 @@ void MainWindow::loadConfig(const QString &fname) ui->enableSSE41CheckBox->setChecked(!disabledCpuExts.contains("sse4.1", Qt::CaseInsensitive)); ui->enableNeonCheckBox->setChecked(!disabledCpuExts.contains("neon", Qt::CaseInsensitive)); + QString hrtfmode = settings.value("hrtf-mode").toString().trimmed(); + ui->hrtfqualitySlider->setValue(3); + ui->hrtfqualityLabel->setText(hrtfModeList[3].name); + /* The "basic" mode name is no longer supported. Use "ambi2" instead. */ + if(hrtfmode == "basic") hrtfmode = "ambi2"; + for(int i = 0;hrtfModeList[i].name[0];i++) + { + if(hrtfmode == hrtfModeList[i].value) + { + ui->hrtfqualitySlider->setValue(i); + ui->hrtfqualityLabel->setText(hrtfModeList[i].name); + break; + } + } + QStringList hrtf_paths = settings.value("hrtf-paths").toStringList(); if(hrtf_paths.size() == 1) hrtf_paths = hrtf_paths[0].split(QChar(',')); @@ -973,6 +1001,8 @@ void MainWindow::saveConfig(const QString &fname) const strlist.append("neon"); settings.setValue("disable-cpu-exts", strlist.join(QChar(','))); + settings.setValue("hrtf-mode", hrtfModeList[ui->hrtfqualitySlider->value()].value); + if(ui->hrtfStateComboBox->currentIndex() == 1) settings.setValue("hrtf", "true"); else if(ui->hrtfStateComboBox->currentIndex() == 2) @@ -1208,6 +1238,13 @@ void MainWindow::updateJackBufferSizeSlider() } +void MainWindow::updateHrtfModeLabel(int num) +{ + ui->hrtfqualityLabel->setText(hrtfModeList[num].name); + enableApplyButton(); +} + + void MainWindow::addHrtfFile() { QString path = QFileDialog::getExistingDirectory(this, tr("Select HRTF Path")); diff --git a/utils/alsoft-config/mainwindow.h b/utils/alsoft-config/mainwindow.h index 8b763845..ca53582b 100644 --- a/utils/alsoft-config/mainwindow.h +++ b/utils/alsoft-config/mainwindow.h @@ -43,6 +43,7 @@ private slots: void updateJackBufferSizeEdit(int size); void updateJackBufferSizeSlider(); + void updateHrtfModeLabel(int num); void addHrtfFile(); void removeHrtfFile(); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 46d1b7a8..7ab27c09 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -1122,6 +1122,77 @@ application or system to determine if it should be used. The default HRTF to use if the application doesn't request one. + + + + 50 + 90 + 441 + 81 + + + + HRTF Quality + + + + + 20 + 30 + 51 + 21 + + + + Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 340 + 30 + 51 + 21 + + + + Quality + + + + + + 80 + 30 + 251 + 21 + + + + Qt::Horizontal + + + + + + 50 + 50 + 321 + 21 + + + + Default + + + Qt::AlignCenter + + + -- cgit v1.2.3