summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
authorKloen Lansfiel <kloen@outlawkiwi.com>2017-01-26 04:33:26 +0100
committerSebastian Valle <subv2112@gmail.com>2017-01-26 04:33:26 +0100
commitf8523699864b6000572affaa0e36d9a4d89ffce6 (patch)
tree952a96e11d4efe860272ea7a47ebbee896fb5d61 /src/citra_qt
parentMerge pull request #2434 from mailwl/nfc-amiibo (diff)
downloadyuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar.gz
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar.bz2
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar.lz
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar.xz
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.tar.zst
yuzu-f8523699864b6000572affaa0e36d9a4d89ffce6.zip
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/config.cpp3
-rw-r--r--src/citra_qt/configure_audio.cpp33
-rw-r--r--src/citra_qt/configure_audio.h3
-rw-r--r--src/citra_qt/configure_audio.ui15
4 files changed, 54 insertions, 0 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 8021667d0..f776e16b2 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -63,6 +63,8 @@ void Config::ReadValues() {
Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString();
Settings::values.enable_audio_stretching =
qt_config->value("enable_audio_stretching", true).toBool();
+ Settings::values.audio_device_id =
+ qt_config->value("output_device", "auto").toString().toStdString();
qt_config->endGroup();
qt_config->beginGroup("Data Storage");
@@ -169,6 +171,7 @@ void Config::SaveValues() {
qt_config->beginGroup("Audio");
qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id));
qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching);
+ qt_config->setValue("output_device", QString::fromStdString(Settings::values.audio_device_id));
qt_config->endGroup();
qt_config->beginGroup("Data Storage");
diff --git a/src/citra_qt/configure_audio.cpp b/src/citra_qt/configure_audio.cpp
index 3cdd4c780..3ddcf9232 100644
--- a/src/citra_qt/configure_audio.cpp
+++ b/src/citra_qt/configure_audio.cpp
@@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <memory>
+#include "audio_core/audio_core.h"
+#include "audio_core/sink.h"
#include "audio_core/sink_details.h"
#include "citra_qt/configure_audio.h"
#include "core/settings.h"
@@ -18,6 +21,8 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
}
this->setConfiguration();
+ connect(ui->output_sink_combo_box, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(updateAudioDevices(int)));
}
ConfigureAudio::~ConfigureAudio() {}
@@ -33,6 +38,19 @@ void ConfigureAudio::setConfiguration() {
ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
+
+ // The device list cannot be pre-populated (nor listed) until the output sink is known.
+ updateAudioDevices(new_sink_index);
+
+ int new_device_index = -1;
+ for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
+ if (ui->audio_device_combo_box->itemText(index).toStdString() ==
+ Settings::values.audio_device_id) {
+ new_device_index = index;
+ break;
+ }
+ }
+ ui->audio_device_combo_box->setCurrentIndex(new_device_index);
}
void ConfigureAudio::applyConfiguration() {
@@ -40,5 +58,20 @@ void ConfigureAudio::applyConfiguration() {
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
.toStdString();
Settings::values.enable_audio_stretching = ui->toggle_audio_stretching->isChecked();
+ Settings::values.audio_device_id =
+ ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
+ .toStdString();
Settings::Apply();
}
+
+void ConfigureAudio::updateAudioDevices(int sink_index) {
+ ui->audio_device_combo_box->clear();
+ ui->audio_device_combo_box->addItem("auto");
+
+ std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
+ std::vector<std::string> device_list =
+ AudioCore::GetSinkDetails(sink_id).factory()->GetDeviceList();
+ for (const auto& device : device_list) {
+ ui->audio_device_combo_box->addItem(device.c_str());
+ }
+}
diff --git a/src/citra_qt/configure_audio.h b/src/citra_qt/configure_audio.h
index 51df2e27b..8190e694f 100644
--- a/src/citra_qt/configure_audio.h
+++ b/src/citra_qt/configure_audio.h
@@ -20,6 +20,9 @@ public:
void applyConfiguration();
+public slots:
+ void updateAudioDevices(int sink_index);
+
private:
void setConfiguration();
diff --git a/src/citra_qt/configure_audio.ui b/src/citra_qt/configure_audio.ui
index 3e2b4635f..dd870eb61 100644
--- a/src/citra_qt/configure_audio.ui
+++ b/src/citra_qt/configure_audio.ui
@@ -35,6 +35,21 @@
</property>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel">
+ <property name="text">
+ <string>Audio Device:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="audio_device_combo_box">
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>