mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
Microphone implementation
This commit is contained in:
parent
2898309f68
commit
6c6b973342
10 changed files with 1428 additions and 230 deletions
|
@ -774,6 +774,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
ui->timeStretchingThresholdLabel->setEnabled(enabled);
|
||||
ui->timeStretchingThreshold->setEnabled(enabled);
|
||||
};
|
||||
|
||||
auto EnableBufferingOptions = [this, EnableTimeStretchingOptions](bool enabled)
|
||||
{
|
||||
ui->audioBufferDuration->setEnabled(enabled);
|
||||
|
@ -781,6 +782,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
ui->enableTimeStretching->setEnabled(enabled);
|
||||
EnableTimeStretchingOptions(enabled && ui->enableTimeStretching->isChecked());
|
||||
};
|
||||
|
||||
auto EnableBuffering = [this, EnableBufferingOptions](const QString& text)
|
||||
{
|
||||
const bool enabled = text == "XAudio2" || text == "OpenAL";
|
||||
|
@ -788,6 +790,84 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
EnableBufferingOptions(enabled && ui->enableBuffering->isChecked());
|
||||
};
|
||||
|
||||
auto ChangeMicrophoneType = [=](QString text)
|
||||
{
|
||||
std::string s_standard, s_singstar, s_realsingstar, s_rocksmith;
|
||||
|
||||
auto enableMicsCombo = [=](u32 max)
|
||||
{
|
||||
ui->microphone1Box->setEnabled(true);
|
||||
|
||||
if (max == 1 || ui->microphone1Box->currentText() == xemu_settings->m_microphone_creator.mic_none)
|
||||
return;
|
||||
|
||||
ui->microphone2Box->setEnabled(true);
|
||||
|
||||
if (max > 2 && ui->microphone2Box->currentText() != xemu_settings->m_microphone_creator.mic_none)
|
||||
{
|
||||
ui->microphone3Box->setEnabled(true);
|
||||
if (ui->microphone3Box->currentText() != xemu_settings->m_microphone_creator.mic_none)
|
||||
{
|
||||
ui->microphone4Box->setEnabled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ui->microphone1Box->setEnabled(false);
|
||||
ui->microphone2Box->setEnabled(false);
|
||||
ui->microphone3Box->setEnabled(false);
|
||||
ui->microphone4Box->setEnabled(false);
|
||||
|
||||
fmt_class_string<microphone_handler>::format(s_standard, static_cast<u64>(microphone_handler::standard));
|
||||
fmt_class_string<microphone_handler>::format(s_singstar, static_cast<u64>(microphone_handler::singstar));
|
||||
fmt_class_string<microphone_handler>::format(s_realsingstar, static_cast<u64>(microphone_handler::real_singstar));
|
||||
fmt_class_string<microphone_handler>::format(s_rocksmith, static_cast<u64>(microphone_handler::rocksmith));
|
||||
|
||||
if (text == s_standard.c_str())
|
||||
{
|
||||
enableMicsCombo(4);
|
||||
return;
|
||||
}
|
||||
if (text == s_singstar.c_str())
|
||||
{
|
||||
enableMicsCombo(2);
|
||||
return;
|
||||
}
|
||||
if (text == s_realsingstar.c_str() || text == s_rocksmith.c_str())
|
||||
{
|
||||
enableMicsCombo(1);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
auto PropagateUsedDevices = [=]()
|
||||
{
|
||||
for (u32 index = 0; index < 4; index++)
|
||||
{
|
||||
const QString cur_item = mics_combo[index]->currentText();
|
||||
QStringList cur_list = xemu_settings->m_microphone_creator.microphones_list;
|
||||
for (u32 subindex = 0; subindex < 4; subindex++)
|
||||
{
|
||||
if (subindex != index && mics_combo[subindex]->currentText() != xemu_settings->m_microphone_creator.mic_none)
|
||||
cur_list.removeOne(mics_combo[subindex]->currentText());
|
||||
}
|
||||
mics_combo[index]->blockSignals(true);
|
||||
mics_combo[index]->clear();
|
||||
mics_combo[index]->addItems(cur_list);
|
||||
mics_combo[index]->setCurrentText(cur_item);
|
||||
mics_combo[index]->blockSignals(false);
|
||||
}
|
||||
ChangeMicrophoneType(ui->microphoneBox->currentText());
|
||||
};
|
||||
|
||||
auto ChangeMicrophoneDevice = [=](u32 next_index, QString text)
|
||||
{
|
||||
xemu_settings->SetSetting(emu_settings::MicrophoneDevices, xemu_settings->m_microphone_creator.SetDevice(next_index, text));
|
||||
if (next_index < 4 && text == xemu_settings->m_microphone_creator.mic_none)
|
||||
mics_combo[next_index]->setCurrentText(xemu_settings->m_microphone_creator.mic_none);
|
||||
PropagateUsedDevices();
|
||||
};
|
||||
|
||||
// Comboboxes
|
||||
|
||||
xemu_settings->EnhanceComboBox(ui->audioOutBox, emu_settings::AudioRenderer);
|
||||
|
@ -800,6 +880,36 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
ui->audioOutBox->setItemText(ui->renderBox->findData("Null"), tr("Disable Audio Output"));
|
||||
connect(ui->audioOutBox, &QComboBox::currentTextChanged, EnableBuffering);
|
||||
|
||||
// Microphone Comboboxes
|
||||
mics_combo[0] = ui->microphone1Box;
|
||||
mics_combo[1] = ui->microphone2Box;
|
||||
mics_combo[2] = ui->microphone3Box;
|
||||
mics_combo[3] = ui->microphone4Box;
|
||||
connect(mics_combo[0], &QComboBox::currentTextChanged, [=](const QString& text) { ChangeMicrophoneDevice(1, text); });
|
||||
connect(mics_combo[1], &QComboBox::currentTextChanged, [=](const QString& text) { ChangeMicrophoneDevice(2, text); });
|
||||
connect(mics_combo[2], &QComboBox::currentTextChanged, [=](const QString& text) { ChangeMicrophoneDevice(3, text); });
|
||||
connect(mics_combo[3], &QComboBox::currentTextChanged, [=](const QString& text) { ChangeMicrophoneDevice(4, text); });
|
||||
xemu_settings->m_microphone_creator.RefreshList();
|
||||
PropagateUsedDevices(); // Fills comboboxes list
|
||||
|
||||
xemu_settings->m_microphone_creator.ParseDevices(xemu_settings->GetSetting(emu_settings::MicrophoneDevices));
|
||||
|
||||
for (s32 index = 3; index >= 0; index--)
|
||||
{
|
||||
if (xemu_settings->m_microphone_creator.sel_list[index] == "" || mics_combo[index]->findText(qstr(xemu_settings->m_microphone_creator.sel_list[index])) == -1)
|
||||
{
|
||||
mics_combo[index]->setCurrentText(xemu_settings->m_microphone_creator.mic_none);
|
||||
ChangeMicrophoneDevice(index+1, xemu_settings->m_microphone_creator.mic_none); // Ensures the value is set in config
|
||||
}
|
||||
else
|
||||
mics_combo[index]->setCurrentText(qstr(xemu_settings->m_microphone_creator.sel_list[index]));
|
||||
}
|
||||
|
||||
xemu_settings->EnhanceComboBox(ui->microphoneBox, emu_settings::MicrophoneType);
|
||||
SubscribeTooltip(ui->microphoneBox, json_audio["microphoneBox"].toString());
|
||||
connect(ui->microphoneBox, &QComboBox::currentTextChanged, ChangeMicrophoneType);
|
||||
PropagateUsedDevices(); // Enables/Disables comboboxes and checks values from config for sanity
|
||||
|
||||
// Checkboxes
|
||||
|
||||
xemu_settings->EnhanceCheckBox(ui->audioDump, emu_settings::DumpToFile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue