Skip to content

Commit

Permalink
[FIX] Enable openal-soft backend for Pipewire and PulseAudio for Linux.
Browse files Browse the repository at this point in the history
1. Enable backend: Pipewire, PulseAudio, and ALSA. It's OK to enable all
   of them because openal-soft loads them via dlopen(). See
   alc/backends for details.
2. Sndio is explicitly disabled. It's not a widely used backend.
3. ALSA should not be the only backend because it does not have a lot of
   features like sound mixing.

For macOS and Windows - We use default settings so they will use
CoreAudio and DirectSound.
  • Loading branch information
fuzhouch committed Dec 21, 2023
1 parent 26cce68 commit f797382
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions deps/packages/o/openal-soft-alsa/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,26 @@ package("openal-soft-alsa")
if package:config("shared") then
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
if is_plat("linux") then
table.insert(configs, "-DALSOFT_BACKEND_PIPEWIRE=OFF")
table.insert(configs, "-DALSOFT_BACKEND_PULSEAUDIO=OFF")
-- For Linux, let's enable ALSA, Pipewire and PulseAudio
-- as available backend. They are fine to enable at the
-- same time, as openal-soft uses dlopen() to load them.
-- We should not use ALSA by default because it disables a
-- lot of audio mixing features.
--
-- With Pipewire, PulseAudio and ALSA enabled, we should
-- be able to work on most modern Linux systems.
--
-- We also explicitly disable sndio as it's not really
-- needed.
--
-- Player can use ALSOFT_DRIVERS environment variable
-- to switch different backends.
table.insert(configs, "-DALSOFT_BACKEND_PIPEWIRE=ON")
table.insert(configs, "-DALSOFT_BACKEND_PULSEAUDIO=ON")
table.insert(configs, "-DALSOFT_BACKEND_OSS=OFF")
table.insert(configs, "-DALSOFT_BACKEND_SNDIO=OFF")
table.insert(configs, "-DALSOFT_BACKEND_JACK=OFF")
table.insert(configs, "-DALSOFT_BACKEND_PORTAUDIO=OFF")

-- Enable only NULL, Wavefile and ALSA

table.insert(configs, "-DALSOFT_STATIC_LIBGCC=ON")
table.insert(configs, "-DALSOFT_STATIC_STDCXX=ON")
io.replace("CMakeLists.txt", "set(LINKER_FLAGS )", "set(LINKER_FLAGS \"-static-libstdc++\")", {plain = true})
Expand Down

0 comments on commit f797382

Please sign in to comment.