diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp index 6d8b4740e8..e58812488d 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp @@ -7,7 +7,10 @@ #include +#ifdef HAVE_CUBEB #include "AudioCommon/CubebUtils.h" +#endif + #include "Common/Logging/Log.h" #include "Common/MathUtil.h" #include "Common/Swap.h" @@ -36,6 +39,23 @@ Microphone::~Microphone() StreamTerminate(); } +#ifndef HAVE_CUBEB +void Microphone::StreamInit() +{ +} + +void Microphone::StreamStart([[maybe_unused]] u32 sampling_rate) +{ +} + +void Microphone::StreamStop() +{ +} + +void Microphone::StreamTerminate() +{ +} +#else void Microphone::StreamInit() { if (!m_worker.Execute([this] { m_cubeb_ctx = CubebUtils::GetContext(); })) @@ -168,6 +188,7 @@ long Microphone::DataCallback(cubeb_stream* stream, void* user_data, const void* return nframes; } +#endif u16 Microphone::ReadIntoBuffer(u8* ptr, u32 size) { diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.h b/Source/Core/Core/IOS/USB/Emulated/Microphone.h index 638448dc11..4bb8229db4 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Microphone.h +++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.h @@ -13,11 +13,14 @@ #include #include -#include "AudioCommon/CubebUtils.h" #include "Common/CommonTypes.h" +#ifdef HAVE_CUBEB +#include "AudioCommon/CubebUtils.h" + struct cubeb; struct cubeb_stream; +#endif namespace IOS::HLE::USB { @@ -40,8 +43,10 @@ public: void SetSamplingRate(u32 sampling_rate); private: +#ifdef HAVE_CUBEB static long DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer, void* output_buffer, long nframes); +#endif void StreamInit(); void StreamTerminate(); @@ -114,11 +119,13 @@ private: Loudness m_loudness; std::mutex m_ring_lock; - std::shared_ptr m_cubeb_ctx = nullptr; - cubeb_stream* m_cubeb_stream = nullptr; const WiiSpeakState& m_sampler; +#ifdef HAVE_CUBEB + std::shared_ptr m_cubeb_ctx = nullptr; + cubeb_stream* m_cubeb_stream = nullptr; CubebUtils::CoInitSyncWorker m_worker{"Wii Speak Worker"}; +#endif }; } // namespace IOS::HLE::USB diff --git a/Source/Core/DolphinLib.props b/Source/Core/DolphinLib.props index e20ceb0fc9..bd68021aaf 100644 --- a/Source/Core/DolphinLib.props +++ b/Source/Core/DolphinLib.props @@ -1,9 +1,12 @@ - - + + + + + @@ -289,7 +292,6 @@ - @@ -773,10 +775,13 @@ - - + + + + + @@ -960,7 +965,6 @@ - diff --git a/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp b/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp index 67d8433677..f22fe93117 100644 --- a/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp +++ b/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp @@ -14,7 +14,9 @@ #include #include +#ifdef HAVE_CUBEB #include "AudioCommon/CubebUtils.h" +#endif #include "Core/Config/MainSettings.h" #include "Core/Core.h" #include "Core/System.h" @@ -93,6 +95,10 @@ void WiiSpeakWindow::CreateMainWindow() config_layout->setStretch(1, 3); m_combobox_microphones = new QComboBox(); +#ifndef HAVE_CUBEB + m_combobox_microphones->addItem(QLatin1String("(%1)").arg(tr("Audio backend unsupported")), + QString{}); +#else m_combobox_microphones->addItem(QLatin1String("(%1)").arg(tr("Autodetect preferred microphone")), QString{}); for (auto& [device_id, device_name] : CubebUtils::ListInputDevices()) @@ -100,6 +106,7 @@ void WiiSpeakWindow::CreateMainWindow() const auto user_data = QString::fromStdString(device_id); m_combobox_microphones->addItem(QString::fromStdString(device_name), user_data); } +#endif connect(m_combobox_microphones, &QComboBox::currentIndexChanged, this, &WiiSpeakWindow::OnInputDeviceChange); diff --git a/Source/VSProps/Base.Dolphin.props b/Source/VSProps/Base.Dolphin.props index 3410b9fef6..f2f213b009 100644 --- a/Source/VSProps/Base.Dolphin.props +++ b/Source/VSProps/Base.Dolphin.props @@ -3,6 +3,7 @@ $(ProjectName)$(TargetSuffix) + true @@ -47,7 +48,7 @@ USE_RETRO_ACHIEVEMENTS;%(PreprocessorDefinitions) RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions) RC_CLIENT_SUPPORTS_RAINTEGRATION;%(PreprocessorDefinitions) - HAVE_CUBEB;%(PreprocessorDefinitions) + HAVE_CUBEB;%(PreprocessorDefinitions)