mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-10 03:27:42 +01:00
CMakeLists: Add flag to disable Cubeb
This commit is contained in:
parent
d0b7c96fdb
commit
d89e7c84fb
@ -98,6 +98,7 @@ option(ENABLE_GENERIC "Enables generic build that should run on any little-endia
|
|||||||
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
|
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
|
||||||
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
|
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
|
||||||
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
|
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
|
||||||
|
option(ENABLE_CUBEB "Enables Cubeb sound backend" ON)
|
||||||
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
|
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
|
||||||
option(ENABLE_TESTS "Enables building the unit tests" ON)
|
option(ENABLE_TESTS "Enables building the unit tests" ON)
|
||||||
option(ENABLE_VULKAN "Enables vulkan video backend" ON)
|
option(ENABLE_VULKAN "Enables vulkan video backend" ON)
|
||||||
@ -700,7 +701,10 @@ endif()
|
|||||||
add_subdirectory(Externals/soundtouch)
|
add_subdirectory(Externals/soundtouch)
|
||||||
include_directories(Externals/soundtouch)
|
include_directories(Externals/soundtouch)
|
||||||
|
|
||||||
dolphin_find_optional_system_library(CUBEB Externals/cubeb)
|
if(ENABLE_CUBEB)
|
||||||
|
dolphin_find_optional_system_library(CUBEB Externals/cubeb)
|
||||||
|
add_definitions(-DHAVE_CUBEB)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
dolphin_find_optional_system_library_pkgconfig(
|
dolphin_find_optional_system_library_pkgconfig(
|
||||||
|
@ -28,7 +28,7 @@ constexpr int AUDIO_VOLUME_MAX = 100;
|
|||||||
|
|
||||||
static std::unique_ptr<SoundStream> CreateSoundStreamForBackend(std::string_view backend)
|
static std::unique_ptr<SoundStream> CreateSoundStreamForBackend(std::string_view backend)
|
||||||
{
|
{
|
||||||
if (backend == BACKEND_CUBEB)
|
if (backend == BACKEND_CUBEB && CubebStream::IsValid())
|
||||||
return std::make_unique<CubebStream>();
|
return std::make_unique<CubebStream>();
|
||||||
else if (backend == BACKEND_OPENAL && OpenALStream::IsValid())
|
else if (backend == BACKEND_OPENAL && OpenALStream::IsValid())
|
||||||
return std::make_unique<OpenALStream>();
|
return std::make_unique<OpenALStream>();
|
||||||
@ -100,9 +100,10 @@ std::string GetDefaultSoundBackend()
|
|||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
if (AlsaSound::IsValid())
|
if (AlsaSound::IsValid())
|
||||||
backend = BACKEND_ALSA;
|
backend = BACKEND_ALSA;
|
||||||
else
|
else if (CubebStream::IsValid())
|
||||||
backend = BACKEND_CUBEB;
|
backend = BACKEND_CUBEB;
|
||||||
#elif defined(__APPLE__) || defined(_WIN32) || defined(__OpenBSD__)
|
#elif defined(__APPLE__) || defined(_WIN32) || defined(__OpenBSD__)
|
||||||
|
if (CubebStream::IsValid())
|
||||||
backend = BACKEND_CUBEB;
|
backend = BACKEND_CUBEB;
|
||||||
#endif
|
#endif
|
||||||
return backend;
|
return backend;
|
||||||
@ -118,6 +119,7 @@ std::vector<std::string> GetSoundBackends()
|
|||||||
std::vector<std::string> backends;
|
std::vector<std::string> backends;
|
||||||
|
|
||||||
backends.emplace_back(BACKEND_NULLSOUND);
|
backends.emplace_back(BACKEND_NULLSOUND);
|
||||||
|
if (CubebStream::IsValid())
|
||||||
backends.emplace_back(BACKEND_CUBEB);
|
backends.emplace_back(BACKEND_CUBEB);
|
||||||
if (AlsaSound::IsValid())
|
if (AlsaSound::IsValid())
|
||||||
backends.emplace_back(BACKEND_ALSA);
|
backends.emplace_back(BACKEND_ALSA);
|
||||||
|
@ -3,10 +3,7 @@ add_library(audiocommon
|
|||||||
AudioCommon.h
|
AudioCommon.h
|
||||||
AudioStretcher.cpp
|
AudioStretcher.cpp
|
||||||
AudioStretcher.h
|
AudioStretcher.h
|
||||||
CubebStream.cpp
|
|
||||||
CubebStream.h
|
CubebStream.h
|
||||||
CubebUtils.cpp
|
|
||||||
CubebUtils.h
|
|
||||||
Enums.h
|
Enums.h
|
||||||
Mixer.cpp
|
Mixer.cpp
|
||||||
Mixer.h
|
Mixer.h
|
||||||
@ -18,6 +15,16 @@ add_library(audiocommon
|
|||||||
WaveFile.h
|
WaveFile.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(ENABLE_CUBEB)
|
||||||
|
message(STATUS "Cubeb found, enabling Cubeb sound backend")
|
||||||
|
target_sources(audiocommon PRIVATE
|
||||||
|
CubebStream.cpp
|
||||||
|
CubebUtils.cpp
|
||||||
|
CubebUtils.h
|
||||||
|
)
|
||||||
|
target_link_libraries(audiocommon PRIVATE cubeb)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
find_package(OpenSLES)
|
find_package(OpenSLES)
|
||||||
if(OPENSLES_FOUND)
|
if(OPENSLES_FOUND)
|
||||||
@ -83,10 +90,13 @@ PUBLIC
|
|||||||
common
|
common
|
||||||
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
cubeb::cubeb
|
|
||||||
SoundTouch
|
SoundTouch
|
||||||
FreeSurround)
|
FreeSurround)
|
||||||
|
|
||||||
|
if(ENABLE_CUBEB)
|
||||||
|
target_link_libraries(audiocommon PRIVATE cubeb::cubeb)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Add precompiled header
|
# Add precompiled header
|
||||||
target_link_libraries(audiocommon PRIVATE use_pch)
|
target_link_libraries(audiocommon PRIVATE use_pch)
|
||||||
|
@ -11,10 +11,13 @@
|
|||||||
#include "AudioCommon/SoundStream.h"
|
#include "AudioCommon/SoundStream.h"
|
||||||
#include "Common/WorkQueueThread.h"
|
#include "Common/WorkQueueThread.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
#include <cubeb/cubeb.h>
|
#include <cubeb/cubeb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class CubebStream final : public SoundStream
|
class CubebStream final : public SoundStream
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
public:
|
public:
|
||||||
CubebStream();
|
CubebStream();
|
||||||
CubebStream(const CubebStream& other) = delete;
|
CubebStream(const CubebStream& other) = delete;
|
||||||
@ -25,6 +28,7 @@ public:
|
|||||||
bool Init() override;
|
bool Init() override;
|
||||||
bool SetRunning(bool running) override;
|
bool SetRunning(bool running) override;
|
||||||
void SetVolume(int) override;
|
void SetVolume(int) override;
|
||||||
|
static bool IsValid() { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_stereo = false;
|
bool m_stereo = false;
|
||||||
@ -43,4 +47,5 @@ private:
|
|||||||
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 num_frames);
|
void* output_buffer, long num_frames);
|
||||||
static void StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state);
|
static void StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -213,8 +213,6 @@ add_library(core
|
|||||||
HW/EXI/EXI_DeviceIPL.h
|
HW/EXI/EXI_DeviceIPL.h
|
||||||
HW/EXI/EXI_DeviceMemoryCard.cpp
|
HW/EXI/EXI_DeviceMemoryCard.cpp
|
||||||
HW/EXI/EXI_DeviceMemoryCard.h
|
HW/EXI/EXI_DeviceMemoryCard.h
|
||||||
HW/EXI/EXI_DeviceMic.cpp
|
|
||||||
HW/EXI/EXI_DeviceMic.h
|
|
||||||
HW/EXI/EXI_DeviceModem.cpp
|
HW/EXI/EXI_DeviceModem.cpp
|
||||||
HW/EXI/EXI_DeviceModem.h
|
HW/EXI/EXI_DeviceModem.h
|
||||||
HW/EXI/EXI.cpp
|
HW/EXI/EXI.cpp
|
||||||
@ -645,7 +643,6 @@ PUBLIC
|
|||||||
videosoftware
|
videosoftware
|
||||||
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
cubeb::cubeb
|
|
||||||
FatFs
|
FatFs
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
LZO::LZO
|
LZO::LZO
|
||||||
@ -668,6 +665,14 @@ elseif (ANDROID)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_CUBEB)
|
||||||
|
target_link_libraries(core PUBLIC cubeb)
|
||||||
|
target_sources(core PRIVATE
|
||||||
|
HW/EXI/EXI_DeviceMic.cpp
|
||||||
|
HW/EXI/EXI_DeviceMic.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TARGET LibUSB::LibUSB)
|
if(TARGET LibUSB::LibUSB)
|
||||||
target_link_libraries(core PUBLIC LibUSB::LibUSB)
|
target_link_libraries(core PUBLIC LibUSB::LibUSB)
|
||||||
target_sources(core PRIVATE
|
target_sources(core PRIVATE
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/MsgHandler.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceAD16.h"
|
#include "Core/HW/EXI/EXI_DeviceAD16.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceAGP.h"
|
#include "Core/HW/EXI/EXI_DeviceAGP.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceDummy.h"
|
#include "Core/HW/EXI/EXI_DeviceDummy.h"
|
||||||
@ -13,11 +14,14 @@
|
|||||||
#include "Core/HW/EXI/EXI_DeviceGecko.h"
|
#include "Core/HW/EXI/EXI_DeviceGecko.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceMemoryCard.h"
|
#include "Core/HW/EXI/EXI_DeviceMemoryCard.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceMic.h"
|
|
||||||
#include "Core/HW/EXI/EXI_DeviceModem.h"
|
#include "Core/HW/EXI/EXI_DeviceModem.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
|
#include "Core/HW/EXI/EXI_DeviceMic.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ExpansionInterface
|
namespace ExpansionInterface
|
||||||
{
|
{
|
||||||
IEXIDevice::IEXIDevice(Core::System& system) : m_system(system)
|
IEXIDevice::IEXIDevice(Core::System& system) : m_system(system)
|
||||||
@ -131,7 +135,12 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, const EXIDevi
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIDeviceType::Microphone:
|
case EXIDeviceType::Microphone:
|
||||||
|
#ifdef HAVE_CUBEB
|
||||||
result = std::make_unique<CEXIMic>(system, channel_num);
|
result = std::make_unique<CEXIMic>(system, channel_num);
|
||||||
|
#else
|
||||||
|
PanicAlertFmtT("Dolphin was built with Cubeb disabled. The Microphone device cannot be used.");
|
||||||
|
result = std::make_unique<IEXIDevice>(system);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIDeviceType::Ethernet:
|
case EXIDeviceType::Ethernet:
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
<PreprocessorDefinitions Condition="'$(Steam)'=='true'">STEAM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Steam)'=='true'">STEAM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<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>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…
x
Reference in New Issue
Block a user