mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-06 00:40:11 +00:00
Qt: fix mic_none and move microphone creator code
This commit is contained in:
parent
4aae9a17c1
commit
4ff69dc0cd
@ -483,6 +483,11 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_microphone_creator.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_msg_dialog_frame.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
@ -753,6 +758,11 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_microphone_creator.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_msg_dialog_frame.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@ -1043,6 +1053,11 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_microphone_creator.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_msg_dialog_frame.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@ -1313,6 +1328,11 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_microphone_creator.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_msg_dialog_frame.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
@ -1450,6 +1470,7 @@
|
||||
<ClCompile Include="rpcs3qt\gui_application.cpp" />
|
||||
<ClCompile Include="rpcs3qt\input_dialog.cpp" />
|
||||
<ClCompile Include="rpcs3qt\localized.cpp" />
|
||||
<ClCompile Include="rpcs3qt\microphone_creator.cpp" />
|
||||
<ClCompile Include="rpcs3qt\osk_dialog_frame.cpp" />
|
||||
<ClCompile Include="rpcs3qt\pad_led_settings_dialog.cpp" />
|
||||
<ClCompile Include="rpcs3qt\pkg_install_dialog.cpp" />
|
||||
@ -2184,6 +2205,24 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\microphone_creator.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="rpcs3qt\stylesheets.h" />
|
||||
<CustomBuild Include="rpcs3qt\skylander_dialog.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
|
@ -1009,6 +1009,21 @@
|
||||
<ClCompile Include="rpcs3qt\fatal_error_dialog.cpp">
|
||||
<Filter>Gui\misc dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rpcs3qt\microphone_creator.cpp">
|
||||
<Filter>Gui\settings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_microphone_creator.cpp">
|
||||
<Filter>Generated Files\Release - LLVM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_microphone_creator.cpp">
|
||||
<Filter>Generated Files\Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_microphone_creator.cpp">
|
||||
<Filter>Generated Files\Release</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_microphone_creator.cpp">
|
||||
<Filter>Generated Files\Debug - LLVM</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="\rpcs3qt\*.h">
|
||||
@ -1304,6 +1319,9 @@
|
||||
<CustomBuild Include="rpcs3qt\fatal_error_dialog.h">
|
||||
<Filter>Gui\misc dialogs</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\microphone_creator.h">
|
||||
<Filter>Gui\settings</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="rpcs3.ico" />
|
||||
|
@ -30,6 +30,7 @@
|
||||
main_window.cpp
|
||||
memory_string_searcher.cpp
|
||||
memory_viewer_panel.cpp
|
||||
microphone_creator.cpp
|
||||
msg_dialog_frame.cpp
|
||||
osk_dialog_frame.cpp
|
||||
pad_led_settings_dialog.cpp
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "Utilities/Config.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QLineEdit>
|
||||
@ -18,8 +17,6 @@
|
||||
#include "Emu/RSX/VK/VKHelpers.h"
|
||||
#endif
|
||||
|
||||
#include "3rdparty/OpenAL/include/alext.h"
|
||||
|
||||
LOG_CHANNEL(cfg_log, "CFG");
|
||||
|
||||
extern std::string g_cfg_defaults; //! Default settings grabbed from Utilities/Config.h
|
||||
@ -199,59 +196,6 @@ emu_settings::Render_Creator::Render_Creator(const QString& name_null, const QSt
|
||||
renderers = { &Vulkan, &OpenGL, &NullRender };
|
||||
}
|
||||
|
||||
emu_settings::Microphone_Creator::Microphone_Creator()
|
||||
: mic_none(tr("None", "Microphone device"))
|
||||
{
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
void emu_settings::Microphone_Creator::RefreshList()
|
||||
{
|
||||
microphones_list.clear();
|
||||
microphones_list.append(mic_none);
|
||||
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE)
|
||||
{
|
||||
const char *devices = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
|
||||
|
||||
while (*devices != 0)
|
||||
{
|
||||
microphones_list.append(qstr(devices));
|
||||
devices += strlen(devices) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Without enumeration we can only use one device
|
||||
microphones_list.append(qstr(alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER)));
|
||||
}
|
||||
}
|
||||
|
||||
std::string emu_settings::Microphone_Creator::SetDevice(u32 num, QString& text)
|
||||
{
|
||||
if (text == mic_none)
|
||||
sel_list[num-1] = "";
|
||||
else
|
||||
sel_list[num-1] = text.toStdString();
|
||||
|
||||
const std::string final_list = sel_list[0] + "@@@" + sel_list[1] + "@@@" + sel_list[2] + "@@@" + sel_list[3] + "@@@";
|
||||
return final_list;
|
||||
}
|
||||
|
||||
void emu_settings::Microphone_Creator::ParseDevices(std::string list)
|
||||
{
|
||||
for (u32 index = 0; index < 4; index++)
|
||||
{
|
||||
sel_list[index] = "";
|
||||
}
|
||||
|
||||
const auto devices_list = fmt::split(list, { "@@@" });
|
||||
for (u32 index = 0; index < std::min<u32>(4, ::size32(devices_list)); index++)
|
||||
{
|
||||
sel_list[index] = devices_list[index];
|
||||
}
|
||||
}
|
||||
|
||||
emu_settings::emu_settings()
|
||||
: QObject()
|
||||
, m_render_creator(
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "microphone_creator.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QStringList>
|
||||
@ -200,17 +202,6 @@ public:
|
||||
Render_Creator(const QString& name_null, const QString& name_vulkan, const QString& name_openGL);
|
||||
};
|
||||
|
||||
struct Microphone_Creator
|
||||
{
|
||||
QStringList microphones_list;
|
||||
QString mic_none;
|
||||
std::array<std::string, 4> sel_list;
|
||||
std::string SetDevice(u32 num, QString& text);
|
||||
void ParseDevices(std::string list);
|
||||
void RefreshList();
|
||||
Microphone_Creator();
|
||||
};
|
||||
|
||||
std::set<SettingsType> m_broken_types; // list of broken settings
|
||||
|
||||
/** Creates a settings object which reads in the config.yml file at rpcs3/bin/%path%/config.yml
|
||||
@ -262,7 +253,7 @@ public:
|
||||
Render_Creator m_render_creator;
|
||||
|
||||
/** Gets a list of all the microphones available.*/
|
||||
Microphone_Creator m_microphone_creator;
|
||||
microphone_creator m_microphone_creator;
|
||||
|
||||
/** Loads the settings from path.*/
|
||||
void LoadSettings(const std::string& title_id = "");
|
||||
|
76
rpcs3/rpcs3qt/microphone_creator.cpp
Normal file
76
rpcs3/rpcs3qt/microphone_creator.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
#include "microphone_creator.h"
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
|
||||
#include "3rdparty/OpenAL/include/alext.h"
|
||||
|
||||
constexpr auto qstr = QString::fromStdString;
|
||||
|
||||
microphone_creator::microphone_creator()
|
||||
{
|
||||
setObjectName("microphone_creator");
|
||||
refresh_list();
|
||||
}
|
||||
|
||||
// We need to recreate the localized string because the microphone creator is currently only created once.
|
||||
QString microphone_creator::get_none()
|
||||
{
|
||||
return tr("None", "Microphone device");
|
||||
}
|
||||
|
||||
void microphone_creator::refresh_list()
|
||||
{
|
||||
m_microphone_list.clear();
|
||||
m_microphone_list.append(get_none());
|
||||
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE)
|
||||
{
|
||||
const char* devices = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
|
||||
|
||||
while (*devices != 0)
|
||||
{
|
||||
m_microphone_list.append(qstr(devices));
|
||||
devices += strlen(devices) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Without enumeration we can only use one device
|
||||
m_microphone_list.append(qstr(alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER)));
|
||||
}
|
||||
}
|
||||
|
||||
QStringList microphone_creator::get_microphone_list()
|
||||
{
|
||||
return m_microphone_list;
|
||||
}
|
||||
|
||||
std::array<std::string, 4> microphone_creator::get_selection_list()
|
||||
{
|
||||
return m_sel_list;
|
||||
}
|
||||
|
||||
std::string microphone_creator::set_device(u32 num, const QString& text)
|
||||
{
|
||||
if (text == get_none())
|
||||
m_sel_list[num - 1] = "";
|
||||
else
|
||||
m_sel_list[num - 1] = text.toStdString();
|
||||
|
||||
const std::string final_list = m_sel_list[0] + "@@@" + m_sel_list[1] + "@@@" + m_sel_list[2] + "@@@" + m_sel_list[3] + "@@@";
|
||||
return final_list;
|
||||
}
|
||||
|
||||
void microphone_creator::parse_devices(const std::string& list)
|
||||
{
|
||||
for (u32 index = 0; index < 4; index++)
|
||||
{
|
||||
m_sel_list[index] = "";
|
||||
}
|
||||
|
||||
const auto devices_list = fmt::split(list, { "@@@" });
|
||||
for (u32 index = 0; index < std::min<u32>(4, ::size32(devices_list)); index++)
|
||||
{
|
||||
m_sel_list[index] = devices_list[index];
|
||||
}
|
||||
}
|
27
rpcs3/rpcs3qt/microphone_creator.h
Normal file
27
rpcs3/rpcs3qt/microphone_creator.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
|
||||
#include <array>
|
||||
|
||||
class microphone_creator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
microphone_creator();
|
||||
QString get_none();
|
||||
std::string set_device(u32 num, const QString& text);
|
||||
void parse_devices(const std::string& list);
|
||||
void refresh_list();
|
||||
QStringList get_microphone_list();
|
||||
std::array<std::string, 4> get_selection_list();
|
||||
|
||||
private:
|
||||
QStringList m_microphone_list;
|
||||
std::array<std::string, 4> m_sel_list;
|
||||
};
|
@ -624,6 +624,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||
enable_buffering_options(enabled && ui->enableBuffering->isChecked());
|
||||
};
|
||||
|
||||
const QString mic_none = m_emu_settings->m_microphone_creator.get_none();
|
||||
|
||||
auto change_microphone_type = [=, this](QString text)
|
||||
{
|
||||
std::string s_standard, s_singstar, s_realsingstar, s_rocksmith;
|
||||
@ -632,15 +634,15 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||
{
|
||||
ui->microphone1Box->setEnabled(true);
|
||||
|
||||
if (max == 1 || ui->microphone1Box->currentText() == m_emu_settings->m_microphone_creator.mic_none)
|
||||
if (max == 1 || ui->microphone1Box->currentText() == mic_none)
|
||||
return;
|
||||
|
||||
ui->microphone2Box->setEnabled(true);
|
||||
|
||||
if (max > 2 && ui->microphone2Box->currentText() != m_emu_settings->m_microphone_creator.mic_none)
|
||||
if (max > 2 && ui->microphone2Box->currentText() != mic_none)
|
||||
{
|
||||
ui->microphone3Box->setEnabled(true);
|
||||
if (ui->microphone3Box->currentText() != m_emu_settings->m_microphone_creator.mic_none)
|
||||
if (ui->microphone3Box->currentText() != mic_none)
|
||||
{
|
||||
ui->microphone4Box->setEnabled(true);
|
||||
}
|
||||
@ -679,10 +681,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||
for (u32 index = 0; index < 4; index++)
|
||||
{
|
||||
const QString cur_item = mics_combo[index]->currentText();
|
||||
QStringList cur_list = m_emu_settings->m_microphone_creator.microphones_list;
|
||||
QStringList cur_list = m_emu_settings->m_microphone_creator.get_microphone_list();
|
||||
for (u32 subindex = 0; subindex < 4; subindex++)
|
||||
{
|
||||
if (subindex != index && mics_combo[subindex]->currentText() != m_emu_settings->m_microphone_creator.mic_none)
|
||||
if (subindex != index && mics_combo[subindex]->currentText() != mic_none)
|
||||
cur_list.removeOne(mics_combo[subindex]->currentText());
|
||||
}
|
||||
mics_combo[index]->blockSignals(true);
|
||||
@ -696,9 +698,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||
|
||||
auto change_microphone_device = [=, this](u32 next_index, QString text)
|
||||
{
|
||||
m_emu_settings->SetSetting(emu_settings::MicrophoneDevices, m_emu_settings->m_microphone_creator.SetDevice(next_index, text));
|
||||
if (next_index < 4 && text == m_emu_settings->m_microphone_creator.mic_none)
|
||||
mics_combo[next_index]->setCurrentText(m_emu_settings->m_microphone_creator.mic_none);
|
||||
m_emu_settings->SetSetting(emu_settings::MicrophoneDevices, m_emu_settings->m_microphone_creator.set_device(next_index, text));
|
||||
if (next_index < 4 && text == mic_none)
|
||||
mics_combo[next_index]->setCurrentText(mic_none);
|
||||
propagate_used_devices();
|
||||
};
|
||||
|
||||
@ -721,21 +723,26 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||
connect(mics_combo[1], &QComboBox::currentTextChanged, [=, this](const QString& text) { change_microphone_device(2, text); });
|
||||
connect(mics_combo[2], &QComboBox::currentTextChanged, [=, this](const QString& text) { change_microphone_device(3, text); });
|
||||
connect(mics_combo[3], &QComboBox::currentTextChanged, [=, this](const QString& text) { change_microphone_device(4, text); });
|
||||
m_emu_settings->m_microphone_creator.RefreshList();
|
||||
m_emu_settings->m_microphone_creator.refresh_list();
|
||||
propagate_used_devices(); // Fills comboboxes list
|
||||
|
||||
m_emu_settings->m_microphone_creator.ParseDevices(m_emu_settings->GetSetting(emu_settings::MicrophoneDevices));
|
||||
m_emu_settings->m_microphone_creator.parse_devices(m_emu_settings->GetSetting(emu_settings::MicrophoneDevices));
|
||||
|
||||
const auto mic_sel_list = m_emu_settings->m_microphone_creator.get_selection_list();
|
||||
|
||||
for (s32 index = 3; index >= 0; index--)
|
||||
{
|
||||
if (m_emu_settings->m_microphone_creator.sel_list[index].empty() || mics_combo[index]->findText(qstr(m_emu_settings->m_microphone_creator.sel_list[index])) == -1)
|
||||
const auto mic = mic_sel_list[index];
|
||||
const auto qmic = qstr(mic);
|
||||
|
||||
if (mic.empty() || mics_combo[index]->findText(qmic) == -1)
|
||||
{
|
||||
mics_combo[index]->setCurrentText(m_emu_settings->m_microphone_creator.mic_none);
|
||||
change_microphone_device(index+1, m_emu_settings->m_microphone_creator.mic_none); // Ensures the value is set in config
|
||||
mics_combo[index]->setCurrentText(mic_none);
|
||||
change_microphone_device(index+1, mic_none); // Ensures the value is set in config
|
||||
}
|
||||
else
|
||||
{
|
||||
mics_combo[index]->setCurrentText(qstr(m_emu_settings->m_microphone_creator.sel_list[index]));
|
||||
mics_combo[index]->setCurrentText(qmic);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user