[APU] Add ALSA apu on Linux

This commit is contained in:
Herman S.
2025-09-27 18:38:27 +09:00
parent 48c13be2d5
commit fade0cd889
9 changed files with 929 additions and 6 deletions

View File

@@ -101,6 +101,7 @@ project("xenia-app")
filter("platforms:Linux")
links({
"xenia-apu-alsa",
"X11",
"xcb",
"X11-xcb",

View File

@@ -36,6 +36,9 @@
// Available audio systems:
#include "xenia/apu/nop/nop_audio_system.h"
#if XE_PLATFORM_LINUX
#include "xenia/apu/alsa/alsa_audio_system.h"
#endif // XE_PLATFORM_LINUX
#if !XE_PLATFORM_ANDROID
#include "xenia/apu/sdl/sdl_audio_system.h"
#endif // !XE_PLATFORM_ANDROID
@@ -60,11 +63,23 @@
#include "xenia/hid/xinput/xinput_hid.h"
#endif // XE_PLATFORM_WIN32
DEFINE_string(apu, "any", "Audio system. Use: [any, nop, sdl, xaudio2]", "APU");
DEFINE_string(gpu, "any", "Graphics system. Use: [any, d3d12, vulkan, null]",
"GPU");
DEFINE_string(hid, "any", "Input system. Use: [any, nop, sdl, winkey, xinput]",
"HID");
#if XE_PLATFORM_WIN32
#define APU_OPTIONS "[any, nop, sdl, xaudio2]"
#define GPU_OPTIONS "[any, d3d12, vulkan, null]"
#define HID_OPTIONS "[any, nop, sdl, winkey, xinput]"
#elif XE_PLATFORM_LINUX
#define APU_OPTIONS "[any, alsa, nop, sdl]"
#define GPU_OPTIONS "[any, vulkan, null]"
#define HID_OPTIONS "[any, nop, sdl]"
#else
#define APU_OPTIONS "[any, nop, sdl]"
#define GPU_OPTIONS "[any, vulkan, null]"
#define HID_OPTIONS "[any, nop, sdl]"
#endif
DEFINE_string(apu, "any", "Audio system. Use: " APU_OPTIONS, "APU");
DEFINE_string(gpu, "any", "Graphics system. Use: " GPU_OPTIONS, "GPU");
DEFINE_string(hid, "any", "Input system. Use: " HID_OPTIONS, "HID");
DEFINE_path(
storage_root, "",
@@ -296,6 +311,9 @@ std::unique_ptr<apu::AudioSystem> EmulatorApp::CreateAudioSystem(
#if XE_PLATFORM_WIN32
factory.Add<apu::xaudio2::XAudio2AudioSystem>("xaudio2");
#endif // XE_PLATFORM_WIN32
#if XE_PLATFORM_LINUX
factory.Add<apu::alsa::ALSAAudioSystem>("alsa");
#endif // XE_PLATFORM_LINUX
#if !XE_PLATFORM_ANDROID
factory.Add<apu::sdl::SDLAudioSystem>("sdl");
#endif // !XE_PLATFORM_ANDROID