Settings: Fix build without cubeb

This commit is contained in:
Connor McLaughlin 2022-08-04 21:39:15 +10:00
parent 31a17cd3c6
commit bdb486ccaa
3 changed files with 15 additions and 13 deletions

View File

@ -386,12 +386,14 @@ struct Settings
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled; static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled;
#endif #endif
#if defined(__ANDROID__) #if defined(WITH_CUBEB)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::OpenSLES;
#elif defined(_UWP)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;
#else
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb; static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb;
#elif defined(_WIN32)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;
#elif defined(__ANDROID__)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::AAudio;
#else
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Null;
#endif #endif
static constexpr DisplayCropMode DEFAULT_DISPLAY_CROP_MODE = DisplayCropMode::Overscan; static constexpr DisplayCropMode DEFAULT_DISPLAY_CROP_MODE = DisplayCropMode::Overscan;

View File

@ -136,10 +136,7 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
{ {
switch (backend) switch (backend)
{ {
case AudioBackend::Null: #ifdef WITH_CUBEB
return AudioStream::CreateNullStream(sample_rate, channels, buffer_ms);
#ifndef _UWP
case AudioBackend::Cubeb: case AudioBackend::Cubeb:
return CommonHost::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch); return CommonHost::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif #endif
@ -149,6 +146,9 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
return CommonHost::CreateXAudio2Stream(sample_rate, channels, buffer_ms, latency_ms, stretch); return CommonHost::CreateXAudio2Stream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif #endif
case AudioBackend::Null:
return AudioStream::CreateNullStream(sample_rate, channels, buffer_ms);
default: default:
return nullptr; return nullptr;
} }

View File

@ -30,14 +30,14 @@ void PumpMessagesOnCPUThread();
bool CreateHostDisplayResources(); bool CreateHostDisplayResources();
void ReleaseHostDisplayResources(); void ReleaseHostDisplayResources();
#ifdef WITH_CUBEB
std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch);
#endif
#ifdef _WIN32 #ifdef _WIN32
std::unique_ptr<AudioStream> CreateXAudio2Stream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms, std::unique_ptr<AudioStream> CreateXAudio2Stream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch); AudioStretchMode stretch);
#endif #endif
#ifndef _UWP
std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch);
#endif
} // namespace CommonHost } // namespace CommonHost
namespace ImGuiManager { namespace ImGuiManager {