Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to …
Browse files Browse the repository at this point in the history
…the trunk.

  Fixes Bugzilla #439.
  • Loading branch information
icculus committed Aug 20, 2007
1 parent b573cda commit 1d5aa72
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 0 deletions.
58 changes: 58 additions & 0 deletions configure.in
Expand Up @@ -644,6 +644,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_pulseaudio=yes)
if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
audio_pulseaudio=no

PULSEAUDIO_REQUIRED_VERSION=0.9

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

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

AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
if test x$have_loadso != xyes && \
test x$enable_pulseaudio_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_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
fi
have_audio=yes
fi
fi
}

CheckARTSC()
{
AC_ARG_ENABLE(arts,
Expand Down Expand Up @@ -2065,6 +2122,7 @@ case "$host" in
CheckDMEDIA
CheckMME
CheckALSA
CheckPulseAudio
CheckARTSC
CheckESD
CheckNAS
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.in
Expand Up @@ -159,6 +159,8 @@
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#undef SDL_AUDIO_DRIVER_ARTS
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
#undef SDL_AUDIO_DRIVER_PULSEAUDIO
#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
#undef SDL_AUDIO_DRIVER_BEOSAUDIO
#undef SDL_AUDIO_DRIVER_BSD
#undef SDL_AUDIO_DRIVER_COREAUDIO
Expand Down
4 changes: 4 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -47,6 +47,7 @@ extern AudioBootStrap BSD_AUDIO_bootstrap;
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;
extern AudioBootStrap ALSA_bootstrap;
extern AudioBootStrap PULSEAUDIO_bootstrap;
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap DMEDIA_bootstrap;
Expand Down Expand Up @@ -83,6 +84,9 @@ static AudioBootStrap *bootstrap[] = {
#if SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_PULSEAUDIO
&PULSEAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_QNXNTO
&QNXNTOAUDIO_bootstrap,
#endif
Expand Down

0 comments on commit 1d5aa72

Please sign in to comment.