CubebInput: Avoid redundant CoInitializeEx (#449)

This commit is contained in:
Exzap 2022-11-03 18:29:21 +01:00 committed by GitHub
parent 521f2fb707
commit a40b226e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 19 deletions

View File

@ -158,22 +158,9 @@ void CubebInputAPI::SetVolume(sint32 volume)
bool CubebInputAPI::InitializeStatic() bool CubebInputAPI::InitializeStatic()
{ {
#if BOOST_OS_WINDOWS
s_com_initialized = (SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)));
#endif
if (cubeb_init(&s_context, "Cemu Input Cubeb", nullptr)) if (cubeb_init(&s_context, "Cemu Input Cubeb", nullptr))
{ {
cemuLog_force("can't create cubeb audio api"); cemuLog_force("can't create cubeb audio api");
#if BOOST_OS_WINDOWS
if (s_com_initialized)
{
CoUninitialize();
s_com_initialized = false;
}
#endif
return false; return false;
} }
@ -184,10 +171,6 @@ void CubebInputAPI::Destroy()
{ {
if (s_context) if (s_context)
cubeb_destroy(s_context); cubeb_destroy(s_context);
#if BOOST_OS_WINDOWS
if (s_com_initialized)
CoUninitialize();
#endif
} }
std::vector<IAudioInputAPI::DeviceDescriptionPtr> CubebInputAPI::GetDevices() std::vector<IAudioInputAPI::DeviceDescriptionPtr> CubebInputAPI::GetDevices()

View File

@ -40,7 +40,6 @@ public:
static void Destroy(); static void Destroy();
private: private:
inline static bool s_com_initialized = false;
inline static cubeb* s_context = nullptr; inline static cubeb* s_context = nullptr;
cubeb_stream* m_stream = nullptr; cubeb_stream* m_stream = nullptr;

View File

@ -436,7 +436,7 @@ wxPanel* GeneralSettings2::AddAudioPage(wxNotebook* notebook)
} }
{ {
auto box = new wxStaticBox(audio_panel, wxID_ANY, _("Microphone")); auto box = new wxStaticBox(audio_panel, wxID_ANY, _("Microphone (Experimental)"));
auto box_sizer = new wxStaticBoxSizer(box, wxVERTICAL); auto box_sizer = new wxStaticBoxSizer(box, wxVERTICAL);
auto audio_input_row = new wxFlexGridSizer(0, 3, 0, 0); auto audio_input_row = new wxFlexGridSizer(0, 3, 0, 0);