Linux audio configuration during compilation

On gentoo, the sound in libsdl2 is enabled at installation time via USE flags. It is no USE flag for jack, which imply the jack support will be enabled by configure if it find it. On my system I get:

SDL2 Configure Summary:
Building Shared Libraries
Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx sse sse2 sse3
Audio drivers   : disk dummy alsa jack(dynamic)
Video drivers   : dummy x11 opengl
X11 libraries   : xcursor xdbe xinerama xinput2 xinput2_multitouch xrandr xshape xvidmode
Input drivers   : linuxev linuxkd
Using libsamplerate : YES
Using libudev       : YES
Using dbus          : YES
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO
>>> Source configured.

Also, with my audio setup, the default alsa card, a virtual one, is redirected into jack via the jack ALSA plugin. This seam to confuse sdl which insist to use the alsa default card even when jackd is running. I find a workaround; it is to set the SDL_AUDIODRIVER variable:

SDL_AUDIODRIVER=“jack” my_sdl_app

Or maybe it is no other way to tell libsdl to use jack audio when other audio drivers are compiled in.

I want to fix that ebuild. For that, I need to know the difference between “alsa jack” and “alsa(dynamic) jack(dynamic)”.

I’m not sure I fully understood your question, but you can force a given driver in runtime, using putenv(), on Linux

putenv((char *)"SDL_AUDIODRIVER=alsa");

Source (line ~499) : https://framagit.org/ericb/miniDart/blob/master/Sources/src/miniDart.cpp

On Windows (the code is not public, I’m simply using SDL_setenv()

#ifndef NATIVE_BUILD
SDL_setenv(“SDL_AUDIODRIVER”, “DirectSound”, true);
putenv((char *)“SDL_AUDIODRIVER=DirectSound”);
#else
// Linux, both work as expected
// SDL_setenv(“SDL_AUDIODRIVER”, “alsa”, true);
putenv((char *)“SDL_AUDIODRIVER=alsa”);
#endif

HTH

Thanks. I am not developing software with sdl, but trying to fix the ebuild script used to build and install libsdl on gentoo. I am talking about the configure option --enable-shared-alsa and --enable-shared-jack, which result into alsa(dynamic and jack(dynamic) into the configure summary.

I try both “–enable-alsa --disable-shared-alsa…” and “–enable-alsa --enable-shared-alsa …”. With the resulting builds, alsa and jack seam to work the same with the sdl applications. I find nothing about that into the installation doc and googled, but find nothing about that , which imply I just don’t understand how I can choose if I want an alsa(dynamic) build, or an alsa build. The same for jack.