Initial Mic setup
This commit is contained in:
parent
ad1cfc8d50
commit
7fccc995ce
15 changed files with 528 additions and 59 deletions
|
@ -198,6 +198,9 @@ void Config::ReadValues() {
|
|||
Settings::values.audio_device_id =
|
||||
ReadSetting("output_device", "auto").toString().toStdString();
|
||||
Settings::values.volume = ReadSetting("volume", 1).toFloat();
|
||||
Settings::values.mic_input_type = ReadSetting("mic_input_type", 0).toInt();
|
||||
Settings::values.mic_input_device =
|
||||
ReadSetting("mic_input_device", "Default").toString().toStdString();
|
||||
qt_config->endGroup();
|
||||
|
||||
using namespace Service::CAM;
|
||||
|
@ -480,6 +483,8 @@ void Config::SaveValues() {
|
|||
WriteSetting("enable_audio_stretching", Settings::values.enable_audio_stretching, true);
|
||||
WriteSetting("output_device", QString::fromStdString(Settings::values.audio_device_id), "auto");
|
||||
WriteSetting("volume", Settings::values.volume, 1.0f);
|
||||
WriteSetting("mic_input_device", QString::fromStdString(Settings::values.mic_input_device), 0);
|
||||
WriteSetting("mic_input_type", Settings::values.mic_input_type, "Default");
|
||||
qt_config->endGroup();
|
||||
|
||||
using namespace Service::CAM;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QtGlobal>
|
||||
#include "audio_core/cubeb_input.h"
|
||||
#include "audio_core/sink.h"
|
||||
#include "audio_core/sink_details.h"
|
||||
#include "citra_qt/configuration/configure_audio.h"
|
||||
|
@ -28,10 +31,21 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
|||
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
||||
&ConfigureAudio::setVolumeIndicatorText);
|
||||
|
||||
ui->input_device_combo_box->clear();
|
||||
ui->input_device_combo_box->addItem(tr("Default"));
|
||||
for (const auto& device : AudioCore::ListCubebInputDevices()) {
|
||||
ui->input_device_combo_box->addItem(QString::fromStdString(device));
|
||||
}
|
||||
|
||||
connect(ui->input_type_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&ConfigureAudio::updateAudioInputDevices);
|
||||
|
||||
ui->input_type_combo_box->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||
ui->input_device_combo_box->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||
|
||||
this->setConfiguration();
|
||||
connect(ui->output_sink_combo_box,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&ConfigureAudio::updateAudioDevices);
|
||||
connect(ui->output_sink_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&ConfigureAudio::updateAudioOutputDevices);
|
||||
}
|
||||
|
||||
ConfigureAudio::~ConfigureAudio() {}
|
||||
|
@ -40,7 +54,7 @@ void ConfigureAudio::setConfiguration() {
|
|||
setOutputSinkFromSinkID();
|
||||
|
||||
// The device list cannot be pre-populated (nor listed) until the output sink is known.
|
||||
updateAudioDevices(ui->output_sink_combo_box->currentIndex());
|
||||
updateAudioOutputDevices(ui->output_sink_combo_box->currentIndex());
|
||||
|
||||
setAudioDeviceFromDeviceID();
|
||||
|
||||
|
@ -59,6 +73,11 @@ void ConfigureAudio::setConfiguration() {
|
|||
selection = 0;
|
||||
}
|
||||
ui->emulation_combo_box->setCurrentIndex(selection);
|
||||
|
||||
ui->input_type_combo_box->setCurrentIndex(Settings::values.mic_input_type);
|
||||
ui->input_device_combo_box->setCurrentText(
|
||||
QString::fromStdString(Settings::values.mic_input_device));
|
||||
updateAudioInputDevices(Settings::values.mic_input_type);
|
||||
}
|
||||
|
||||
void ConfigureAudio::setOutputSinkFromSinkID() {
|
||||
|
@ -105,9 +124,11 @@ void ConfigureAudio::applyConfiguration() {
|
|||
static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum();
|
||||
Settings::values.enable_dsp_lle = ui->emulation_combo_box->currentIndex() != 0;
|
||||
Settings::values.enable_dsp_lle_multithread = ui->emulation_combo_box->currentIndex() == 2;
|
||||
Settings::values.mic_input_type = ui->input_type_combo_box->currentIndex();
|
||||
Settings::values.mic_input_device = ui->input_device_combo_box->currentText().toStdString();
|
||||
}
|
||||
|
||||
void ConfigureAudio::updateAudioDevices(int sink_index) {
|
||||
void ConfigureAudio::updateAudioOutputDevices(int sink_index) {
|
||||
ui->audio_device_combo_box->clear();
|
||||
ui->audio_device_combo_box->addItem(AudioCore::auto_device_name);
|
||||
|
||||
|
@ -117,6 +138,13 @@ void ConfigureAudio::updateAudioDevices(int sink_index) {
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigureAudio::updateAudioInputDevices(int index) {
|
||||
// TODO: Don't hardcode this to the index for "Real Device" without making it a constant
|
||||
// somewhere
|
||||
ui->input_device_combo_box->setEnabled(index == 1 &&
|
||||
!Core::System::GetInstance().IsPoweredOn());
|
||||
}
|
||||
|
||||
void ConfigureAudio::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ public:
|
|||
void setConfiguration();
|
||||
|
||||
private:
|
||||
void updateAudioDevices(int sink_index);
|
||||
void updateAudioOutputDevices(int sink_index);
|
||||
void updateAudioInputDevices(int index);
|
||||
|
||||
void setOutputSinkFromSinkID();
|
||||
void setAudioDeviceFromDeviceID();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>188</width>
|
||||
<height>246</height>
|
||||
<width>329</width>
|
||||
<height>332</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
|
@ -39,7 +39,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label1">
|
||||
<property name="text">
|
||||
<string>Output Engine:</string>
|
||||
<string>Output Engine</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label2">
|
||||
<property name="text">
|
||||
<string>Audio Device:</string>
|
||||
<string>Audio Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -137,6 +137,54 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Microphone</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Input Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="input_type_combo_box">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Real Device</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Input Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="input_device_combo_box"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue