summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-11-19 19:31:56 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-11-19 19:31:56 -0300
commit43ce972ddb60b8de684cb1e7a023bc070afd90db (patch)
treeb74616dd3cb02541a75989137dd178628700f93c /platform
parent0f71c90ff36c26ca5c7eec99eb1090ab1c864825 (diff)
parent3b9868d2e44740c03861c64020a8b5d4d6da031d (diff)
Merge pull request #903 from a12n/libao
libao audio driver
Diffstat (limited to 'platform')
-rw-r--r--platform/x11/detect.py13
-rw-r--r--platform/x11/os_x11.cpp9
-rw-r--r--platform/x11/os_x11.h5
-rw-r--r--platform/x11/platform_config.h2
4 files changed, 22 insertions, 7 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 9a52a7c92b..6b1347a3cc 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -1,6 +1,7 @@
import os
import sys
+import platform
def is_active():
@@ -143,10 +144,14 @@ def configure(env):
-
- env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
- env.Append(CPPFLAGS=["-DALSA_ENABLED"])
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
+ if platform.platform() == 'Linux':
+ env.Append(CPPFLAGS=["-DALSA_ENABLED"])
+ env.Append(LIBS=['asound'])
+ if env['ao'] == 'yes':
+ env.ParseConfig('pkg-config ao --cflags --libs')
+ env.Append(CPPFLAGS=['-DAO_ENABLED'])
if (env["pulseaudio"]=="yes"):
if not os.system("pkg-config --exists libpulse-simple"):
print("Enabling PulseAudio")
@@ -156,7 +161,7 @@ def configure(env):
print("PulseAudio development libraries not found, disabling driver")
env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
- env.Append(LIBS=['GL', 'GLU', 'pthread','asound','z']) #TODO detect linux/BSD!
+ env.Append(LIBS=['GL', 'GLU', 'pthread', 'z'])
#env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
#host compiler is default..
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 3218230d0b..bd60cf480e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -32,6 +32,7 @@
#include "key_mapping_x11.h"
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "print_string.h"
#include "servers/physics/physics_server_sw.h"
@@ -1672,7 +1673,7 @@ void OS_X11::close_joystick(int p_id) {
};
void OS_X11::probe_joystick(int p_id) {
- #ifndef __FreeBSD__
+ #if !defined(__FreeBSD__) && !defined(__OpenBSD__)
if (p_id == -1) {
@@ -1727,7 +1728,7 @@ void OS_X11::move_window_to_foreground() {
}
void OS_X11::process_joysticks() {
- #ifndef __FreeBSD__
+ #if !defined(__FreeBSD__) && !defined(__OpenBSD__)
int bytes;
js_event events[32];
InputEvent ievent;
@@ -1960,6 +1961,10 @@ OS_X11::OS_X11() {
AudioDriverManagerSW::add_driver(&driver_alsa);
#endif
+#ifdef AO_ENABLED
+ AudioDriverManagerSW::add_driver(&driver_ao);
+#endif
+
minimized = false;
xim_style=0L;
mouse_mode=MOUSE_MODE_VISIBLE;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index ed61df8f0e..a4b3d580d1 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/ao/audio_driver_ao.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
@@ -134,6 +135,10 @@ class OS_X11 : public OS_Unix {
AudioDriverALSA driver_alsa;
#endif
+#ifdef AO_ENABLED
+ AudioDriverAO driver_ao;
+#endif
+
#ifdef PULSEAUDIO_ENABLED
AudioDriverPulseAudio driver_pulseaudio;
#endif
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index c01d0aa380..1556b56058 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -29,7 +29,7 @@
#ifdef __linux__
#include <alloca.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <stdlib.h>
#endif