mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 06:14:54 +00:00
DolphinLib: Fix compilation issues when HAVE_CUBEB is not defined
This commit is contained in:
parent
76387cbd6c
commit
85b29e4f96
5 changed files with 50 additions and 10 deletions
|
@ -7,7 +7,10 @@
|
|||
|
||||
#include <cubeb/cubeb.h>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
#include <ranges>
|
||||
#include <type_traits>
|
||||
|
||||
#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<cubeb> m_cubeb_ctx = nullptr;
|
||||
cubeb_stream* m_cubeb_stream = nullptr;
|
||||
|
||||
const WiiSpeakState& m_sampler;
|
||||
|
||||
#ifdef HAVE_CUBEB
|
||||
std::shared_ptr<cubeb> m_cubeb_ctx = nullptr;
|
||||
cubeb_stream* m_cubeb_stream = nullptr;
|
||||
CubebUtils::CoInitSyncWorker m_worker{"Wii Speak Worker"};
|
||||
#endif
|
||||
};
|
||||
} // namespace IOS::HLE::USB
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AudioCommon\AudioCommon.h" />
|
||||
<ItemGroup Condition="'$(EnableCubeb)'!='false'">
|
||||
<ClInclude Include="AudioCommon\CubebStream.h" />
|
||||
<ClInclude Include="AudioCommon\CubebUtils.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceMic.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AudioCommon\AudioCommon.h" />
|
||||
<ClInclude Include="AudioCommon\Enums.h" />
|
||||
<ClInclude Include="AudioCommon\Mixer.h" />
|
||||
<ClInclude Include="AudioCommon\NullSoundStream.h" />
|
||||
|
@ -289,7 +292,6 @@
|
|||
<ClInclude Include="Core\HW\EXI\EXI_DeviceGecko.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceIPL.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceMemoryCard.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceMic.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceModem.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI.h" />
|
||||
<ClInclude Include="Core\HW\GBACore.h" />
|
||||
|
@ -773,10 +775,13 @@
|
|||
<ClInclude Include="VideoCommon\XFStateManager.h" />
|
||||
<ClInclude Include="VideoCommon\XFStructs.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCommon\AudioCommon.cpp" />
|
||||
<ItemGroup Condition="'$(EnableCubeb)'!='false'">
|
||||
<ClCompile Include="AudioCommon\CubebStream.cpp" />
|
||||
<ClCompile Include="AudioCommon\CubebUtils.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceMic.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCommon\AudioCommon.cpp" />
|
||||
<ClCompile Include="AudioCommon\Mixer.cpp" />
|
||||
<ClCompile Include="AudioCommon\NullSoundStream.cpp" />
|
||||
<ClCompile Include="AudioCommon\OpenALStream.cpp" />
|
||||
|
@ -960,7 +965,6 @@
|
|||
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceIPL.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceMemoryCard.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceMic.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceModem.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI.cpp" />
|
||||
<ClCompile Include="Core\HW\GBACore.cpp" />
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<!--This file is included by Dolphin code only-->
|
||||
<PropertyGroup>
|
||||
<TargetName Condition="'$(ConfigurationType)'=='Application'">$(ProjectName)$(TargetSuffix)</TargetName>
|
||||
<EnableCubeb>true</EnableCubeb>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
|
@ -47,7 +48,7 @@
|
|||
<PreprocessorDefinitions>USE_RETRO_ACHIEVEMENTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HAVE_CUBEB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(EnableCubeb)'!='false'">HAVE_CUBEB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
||||
<!-- Warnings one may want to ignore when using Level4.
|
||||
4201 nonstandard extension used : nameless struct/union
|
||||
|
|
Loading…
Add table
Reference in a new issue