[Linux] Make SO wrapper usage optional.

This commit is contained in:
bruvzg 2023-02-15 14:13:56 +02:00
parent 953383328a
commit dd068794c3
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
21 changed files with 259 additions and 32 deletions

View file

@ -3,6 +3,7 @@
Import("env")
if "alsa" in env and env["alsa"]:
env.add_source_files(env.drivers_sources, "asound-so_wrap.c")
if env["use_sowrap"]:
env.add_source_files(env.drivers_sources, "asound-so_wrap.c")
env.add_source_files(env.drivers_sources, "*.cpp")

View file

@ -37,7 +37,7 @@
#include <errno.h>
#ifdef PULSEAUDIO_ENABLED
#if defined(PULSEAUDIO_ENABLED) && defined(SOWRAP_ENABLED)
extern "C" {
extern int initialize_pulse(int verbose);
}
@ -153,6 +153,7 @@ Error AudioDriverALSA::init_output_device() {
}
Error AudioDriverALSA::init() {
#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
@ -167,7 +168,7 @@ Error AudioDriverALSA::init() {
if (initialize_asound(dylibloader_verbose)) {
return ERR_CANT_OPEN;
}
#endif
active.clear();
exit_thread.clear();

View file

@ -38,7 +38,11 @@
#include "core/templates/safe_refcount.h"
#include "servers/audio_server.h"
#ifdef SOWRAP_ENABLED
#include "asound-so_wrap.h"
#else
#include <alsa/asoundlib.h>
#endif
class AudioDriverALSA : public AudioDriver {
Thread thread;

View file

@ -39,7 +39,12 @@
#include "core/templates/safe_refcount.h"
#include "core/templates/vector.h"
#ifdef SOWRAP_ENABLED
#include "../alsa/asound-so_wrap.h"
#else
#include <alsa/asoundlib.h>
#endif
#include <stdio.h>
class MIDIDriverALSAMidi : public MIDIDriver {

View file

@ -3,6 +3,7 @@
Import("env")
if "pulseaudio" in env and env["pulseaudio"]:
env.add_source_files(env.drivers_sources, "pulse-so_wrap.c")
if env["use_sowrap"]:
env.add_source_files(env.drivers_sources, "pulse-so_wrap.c")
env.add_source_files(env.drivers_sources, "*.cpp")

View file

@ -37,7 +37,11 @@
#include "core/version.h"
#ifdef ALSAMIDI_ENABLED
#ifdef SOWRAP_ENABLED
#include "drivers/alsa/asound-so_wrap.h"
#else
#include <alsa/asoundlib.h>
#endif
#endif
void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
@ -272,6 +276,7 @@ Error AudioDriverPulseAudio::init_output_device() {
}
Error AudioDriverPulseAudio::init() {
#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
@ -284,7 +289,7 @@ Error AudioDriverPulseAudio::init() {
if (initialize_pulse(dylibloader_verbose)) {
return ERR_CANT_OPEN;
}
#endif
active.clear();
exit_thread.clear();

View file

@ -38,7 +38,11 @@
#include "core/templates/safe_refcount.h"
#include "servers/audio_server.h"
#ifdef SOWRAP_ENABLED
#include "pulse-so_wrap.h"
#else
#include <pulse/pulseaudio.h>
#endif
class AudioDriverPulseAudio : public AudioDriver {
Thread thread;