mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34: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>
|
#include <cubeb/cubeb.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
#include "AudioCommon/CubebUtils.h"
|
#include "AudioCommon/CubebUtils.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
#include "Common/Swap.h"
|
#include "Common/Swap.h"
|
||||||
|
@ -36,6 +39,23 @@ Microphone::~Microphone()
|
||||||
StreamTerminate();
|
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()
|
void Microphone::StreamInit()
|
||||||
{
|
{
|
||||||
if (!m_worker.Execute([this] { m_cubeb_ctx = CubebUtils::GetContext(); }))
|
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;
|
return nframes;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
u16 Microphone::ReadIntoBuffer(u8* ptr, u32 size)
|
u16 Microphone::ReadIntoBuffer(u8* ptr, u32 size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,11 +13,14 @@
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "AudioCommon/CubebUtils.h"
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
|
#include "AudioCommon/CubebUtils.h"
|
||||||
|
|
||||||
struct cubeb;
|
struct cubeb;
|
||||||
struct cubeb_stream;
|
struct cubeb_stream;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace IOS::HLE::USB
|
namespace IOS::HLE::USB
|
||||||
{
|
{
|
||||||
|
@ -40,8 +43,10 @@ public:
|
||||||
void SetSamplingRate(u32 sampling_rate);
|
void SetSamplingRate(u32 sampling_rate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
static long DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
|
static long DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
|
||||||
void* output_buffer, long nframes);
|
void* output_buffer, long nframes);
|
||||||
|
#endif
|
||||||
|
|
||||||
void StreamInit();
|
void StreamInit();
|
||||||
void StreamTerminate();
|
void StreamTerminate();
|
||||||
|
@ -114,11 +119,13 @@ private:
|
||||||
Loudness m_loudness;
|
Loudness m_loudness;
|
||||||
|
|
||||||
std::mutex m_ring_lock;
|
std::mutex m_ring_lock;
|
||||||
std::shared_ptr<cubeb> m_cubeb_ctx = nullptr;
|
|
||||||
cubeb_stream* m_cubeb_stream = nullptr;
|
|
||||||
|
|
||||||
const WiiSpeakState& m_sampler;
|
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"};
|
CubebUtils::CoInitSyncWorker m_worker{"Wii Speak Worker"};
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} // namespace IOS::HLE::USB
|
} // namespace IOS::HLE::USB
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project>
|
<Project>
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(EnableCubeb)'!='false'">
|
||||||
<ClInclude Include="AudioCommon\AudioCommon.h" />
|
|
||||||
<ClInclude Include="AudioCommon\CubebStream.h" />
|
<ClInclude Include="AudioCommon\CubebStream.h" />
|
||||||
<ClInclude Include="AudioCommon\CubebUtils.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\Enums.h" />
|
||||||
<ClInclude Include="AudioCommon\Mixer.h" />
|
<ClInclude Include="AudioCommon\Mixer.h" />
|
||||||
<ClInclude Include="AudioCommon\NullSoundStream.h" />
|
<ClInclude Include="AudioCommon\NullSoundStream.h" />
|
||||||
|
@ -289,7 +292,6 @@
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceGecko.h" />
|
<ClInclude Include="Core\HW\EXI\EXI_DeviceGecko.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceIPL.h" />
|
<ClInclude Include="Core\HW\EXI\EXI_DeviceIPL.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceMemoryCard.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_DeviceModem.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI.h" />
|
<ClInclude Include="Core\HW\EXI\EXI.h" />
|
||||||
<ClInclude Include="Core\HW\GBACore.h" />
|
<ClInclude Include="Core\HW\GBACore.h" />
|
||||||
|
@ -773,10 +775,13 @@
|
||||||
<ClInclude Include="VideoCommon\XFStateManager.h" />
|
<ClInclude Include="VideoCommon\XFStateManager.h" />
|
||||||
<ClInclude Include="VideoCommon\XFStructs.h" />
|
<ClInclude Include="VideoCommon\XFStructs.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(EnableCubeb)'!='false'">
|
||||||
<ClCompile Include="AudioCommon\AudioCommon.cpp" />
|
|
||||||
<ClCompile Include="AudioCommon\CubebStream.cpp" />
|
<ClCompile Include="AudioCommon\CubebStream.cpp" />
|
||||||
<ClCompile Include="AudioCommon\CubebUtils.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\Mixer.cpp" />
|
||||||
<ClCompile Include="AudioCommon\NullSoundStream.cpp" />
|
<ClCompile Include="AudioCommon\NullSoundStream.cpp" />
|
||||||
<ClCompile Include="AudioCommon\OpenALStream.cpp" />
|
<ClCompile Include="AudioCommon\OpenALStream.cpp" />
|
||||||
|
@ -960,7 +965,6 @@
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceIPL.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI_DeviceIPL.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceMemoryCard.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_DeviceModem.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI.cpp" />
|
||||||
<ClCompile Include="Core\HW\GBACore.cpp" />
|
<ClCompile Include="Core\HW\GBACore.cpp" />
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
#include "AudioCommon/CubebUtils.h"
|
#include "AudioCommon/CubebUtils.h"
|
||||||
|
#endif
|
||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
@ -93,6 +95,10 @@ void WiiSpeakWindow::CreateMainWindow()
|
||||||
config_layout->setStretch(1, 3);
|
config_layout->setStretch(1, 3);
|
||||||
|
|
||||||
m_combobox_microphones = new QComboBox();
|
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")),
|
m_combobox_microphones->addItem(QLatin1String("(%1)").arg(tr("Autodetect preferred microphone")),
|
||||||
QString{});
|
QString{});
|
||||||
for (auto& [device_id, device_name] : CubebUtils::ListInputDevices())
|
for (auto& [device_id, device_name] : CubebUtils::ListInputDevices())
|
||||||
|
@ -100,6 +106,7 @@ void WiiSpeakWindow::CreateMainWindow()
|
||||||
const auto user_data = QString::fromStdString(device_id);
|
const auto user_data = QString::fromStdString(device_id);
|
||||||
m_combobox_microphones->addItem(QString::fromStdString(device_name), user_data);
|
m_combobox_microphones->addItem(QString::fromStdString(device_name), user_data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
connect(m_combobox_microphones, &QComboBox::currentIndexChanged, this,
|
connect(m_combobox_microphones, &QComboBox::currentIndexChanged, this,
|
||||||
&WiiSpeakWindow::OnInputDeviceChange);
|
&WiiSpeakWindow::OnInputDeviceChange);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<!--This file is included by Dolphin code only-->
|
<!--This file is included by Dolphin code only-->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetName Condition="'$(ConfigurationType)'=='Application'">$(ProjectName)$(TargetSuffix)</TargetName>
|
<TargetName Condition="'$(ConfigurationType)'=='Application'">$(ProjectName)$(TargetSuffix)</TargetName>
|
||||||
|
<EnableCubeb>true</EnableCubeb>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
<PreprocessorDefinitions>USE_RETRO_ACHIEVEMENTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_RETRO_ACHIEVEMENTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;%(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.
|
<!-- Warnings one may want to ignore when using Level4.
|
||||||
4201 nonstandard extension used : nameless struct/union
|
4201 nonstandard extension used : nameless struct/union
|
||||||
|
|
Loading…
Add table
Reference in a new issue