Skip to content

Commit

Permalink
CubebInput: Avoid redundant CoInitializeEx (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap authored Nov 3, 2022
1 parent 521f2fb commit a40b226
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
17 changes: 0 additions & 17 deletions src/audio/CubebInputAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,9 @@ void CubebInputAPI::SetVolume(sint32 volume)

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))
{
cemuLog_force("can't create cubeb audio api");

#if BOOST_OS_WINDOWS
if (s_com_initialized)
{
CoUninitialize();
s_com_initialized = false;
}
#endif

return false;
}

Expand All @@ -184,10 +171,6 @@ void CubebInputAPI::Destroy()
{
if (s_context)
cubeb_destroy(s_context);
#if BOOST_OS_WINDOWS
if (s_com_initialized)
CoUninitialize();
#endif
}

std::vector<IAudioInputAPI::DeviceDescriptionPtr> CubebInputAPI::GetDevices()
Expand Down
1 change: 0 additions & 1 deletion src/audio/CubebInputAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class CubebInputAPI : public IAudioInputAPI
static void Destroy();

private:
inline static bool s_com_initialized = false;
inline static cubeb* s_context = nullptr;

cubeb_stream* m_stream = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/GeneralSettings2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 audio_input_row = new wxFlexGridSizer(0, 3, 0, 0);
Expand Down

0 comments on commit a40b226

Please sign in to comment.