Skip to content
Permalink
Browse files

Committed PulseAudio driver. Thanks, Stephan!

  • Loading branch information
icculus committed May 13, 2007
1 parent 13e4486 commit 71d69d8b70a7e29f69c2f51ad4b9f8c0cf115842
Showing with 496 additions and 0 deletions.
  1. +58 −0 configure.in
  2. +2 −0 include/SDL_config.h.in
  3. +3 −0 src/audio/SDL_audio.c
  4. +3 −0 src/audio/SDL_sysaudio.h
  5. +377 −0 src/audio/pulse/SDL_pulseaudio.c
  6. +53 −0 src/audio/pulse/SDL_pulseaudio.h
@@ -459,6 +459,63 @@ AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[defa
fi
}

dnl Find PulseAudio
CheckPulseAudio()
{
AC_ARG_ENABLE(pulseaudio,
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
, enable_pulse=yes)
if test x$enable_audio = xyes -a x$enable_pulse = xyes; then
audio_pulse=no

PULSE_REQUIRED_VERSION=0.9

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support)
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then
PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple`
audio_pulse=yes
fi
fi
AC_MSG_RESULT($audio_pulse)

if test x$audio_pulse = xyes; then
AC_ARG_ENABLE(pulseaudio-shared,
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
, enable_pulse_shared=yes)
if test "x`echo $PULSE_LIBS | grep -- -L`" = "x"; then
if test "x`ls /lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/lib $PULSE_LIBS"
elif test "x`ls /usr/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/usr/lib $PULSE_LIBS"
elif test "x`ls /usr/local/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/usr/local/lib $PULSE_LIBS"
fi
fi
pulse_lib_spec=`echo $PULSE_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
pulse_lib=`ls -- $pulse_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
echo "-- $pulse_lib_spec -> $pulse_lib"

AC_DEFINE(SDL_AUDIO_DRIVER_PULSE)
SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS"
if test x$have_loadso != xyes && \
test x$enable_pulse_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
fi
if test x$have_loadso = xyes && \
test x$enable_pulse_shared = xyes && test x$pulse_lib != x; then
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSE_DYNAMIC, "$pulse_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSE_LIBS"
fi
have_audio=yes
fi
fi
}

CheckARTSC()
{
AC_ARG_ENABLE(arts,
@@ -2150,6 +2207,7 @@ case "$host" in
CheckALSA
CheckARTSC
CheckESD
CheckPulseAudio
CheckNAS
CheckX11
CheckNANOX
@@ -163,6 +163,8 @@
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_PULSE
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_MINT
@@ -46,6 +46,9 @@ static AudioBootStrap *bootstrap[] = {
#if SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_PULSE
&PULSE_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_QNXNTO
&QNXNTOAUDIO_bootstrap,
#endif
@@ -103,6 +103,9 @@ typedef struct AudioBootStrap {
#if SDL_AUDIO_DRIVER_BSD
extern AudioBootStrap BSD_AUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PULSE
extern AudioBootStrap PULSE_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_OSS
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;

0 comments on commit 71d69d8

Please sign in to comment.