summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorAlexander Stillich <dr.west@zoho.com>2014-12-19 13:44:34 +0100
committerAlexander Stillich <dr.west@zoho.com>2014-12-19 13:44:34 +0100
commitf2843209a5439eb6bf8a6382e8c8ef378175c111 (patch)
treeb92613a2e2fdebc578b92a638febd9eeca39fb89 /platform/x11
parent04362defe7c5cb0d41164dcc533f0383a0edb98b (diff)
Implemented PulseAudio backend and fixed audio driver selection on X11
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/detect.py8
-rw-r--r--platform/x11/os_x11.cpp16
-rw-r--r--platform/x11/os_x11.h10
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();