mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 16:01:42 +12:00
Qt: fix mic_none and move microphone creator code
This commit is contained in:
parent
4aae9a17c1
commit
4ff69dc0cd
8 changed files with 185 additions and 82 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue