diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/detect.py | 8 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 16 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 10 |
3 files changed, 33 insertions, 1 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 1c8d231d4a..dd5fa827ff 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -114,6 +114,14 @@ def configure(env): env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) env.Append(CPPFLAGS=["-DALSA_ENABLED"]) + + if not os.system("pkg-config --exists libpulse-simple"): + print("Enabling PulseAudio") + env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"]) + env.ParseConfig('pkg-config --cflags --libs libpulse-simple') + else: + print("PulseAudio development libraries not found, disabling driver") + env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES1_ENABLED','-DGLES_OVER_GL']) env.Append(LIBS=['GL', 'GLU', 'pthread','asound','z']) #TODO detect linux/BSD! #env.Append(CPPFLAGS=['-DMPC_FIXED_POINT']) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 0466984359..804809a87d 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -74,6 +74,18 @@ OS::VideoMode OS_X11::get_default_video_mode() const { return OS::VideoMode(800,600,false); } +int OS_X11::get_audio_driver_count() const { + + return AudioDriverManagerSW::get_driver_count(); +} + +const char *OS_X11::get_audio_driver_name(int p_driver) const { + + AudioDriverSW* driver = AudioDriverManagerSW::get_driver(p_driver); + ERR_FAIL_COND_V( !driver, "" ); + return AudioDriverManagerSW::get_driver(p_driver)->get_name(); +} + void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { last_button_state=0; @@ -1450,6 +1462,10 @@ OS_X11::OS_X11() { AudioDriverManagerSW::add_driver(&driver_alsa); #endif +#ifdef PULSEAUDIO_ENABLED + AudioDriverManagerSW::add_driver(&driver_pulseaudio); +#endif + minimized = false; xim_style=NULL; mouse_mode=MOUSE_MODE_VISIBLE; diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 67772894fa..dd2476ec1b 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -43,6 +43,7 @@ #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" #include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/alsa/audio_driver_alsa.h" +#include "drivers/pulseaudio/audio_driver_pulseaudio.h" #include "servers/physics_2d/physics_2d_server_sw.h" #include <X11/keysym.h> @@ -129,6 +130,10 @@ class OS_X11 : public OS_Unix { AudioDriverALSA driver_alsa; #endif +#ifdef PULSEAUDIO_ENABLED + AudioDriverPulseAudio driver_pulseaudio; +#endif + enum { JOYSTICKS_MAX = 8, MAX_JOY_AXIS = 32768, // I've no idea @@ -160,7 +165,10 @@ protected: virtual int get_video_driver_count() const; virtual const char * get_video_driver_name(int p_driver) const; virtual VideoMode get_default_video_mode() const; - + + virtual int get_audio_driver_count() const; + virtual const char * get_audio_driver_name(int p_driver) const; + virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); virtual void finalize(); |