Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added an SDL2 OpenBSD sndio(7) audio target.

  • Loading branch information
icculus committed Jul 7, 2013
1 parent bd5ec14 commit ba4d76cd940d22a5a945f4663ad6c17970b95e5f
@@ -203,6 +203,7 @@ dep_option(PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "PULSEAU
set_option(ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" OFF)
set_option(NAS "Support the NAS audio API" ${UNIX_SYS})
set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS})
set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF)
set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS})
@@ -621,6 +622,7 @@ if(UNIX AND NOT APPLE)
CheckESD()
CheckARTS()
CheckNAS()
CheckSNDIO()
CheckFusionSound()
endif(SDL_AUDIO)

@@ -225,6 +225,37 @@ macro(CheckNAS)
endif(NAS)
endmacro(CheckNAS)

# Requires:
# - n/a
# Optional:
# - SNDIO_SHARED opt
# - HAVE_DLOPEN opt
macro(CheckSNDIO)
if(SNDIO)
# TODO: set include paths properly, so the sndio headers are found
check_include_file(sndio.h HAVE_SNDIO_H)
find_library(D_SNDIO_LIB audio)
if(HAVE_SNDIO_H AND D_SNDIO_LIB)
set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1)
if(SNDIO_SHARED)
if(NOT HAVE_DLOPEN)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
else()
get_filename_component(F_SNDIO_LIB ${D_SNDIO_LIB} NAME)
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${F_SNDIO_LIB}\"")
set(HAVE_SNDIO_SHARED TRUE)
endif(NOT HAVE_DLOPEN)
else(SNDIO_SHARED)
list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
endif(SNDIO_SHARED)
set(HAVE_SDL_AUDIO TRUE)
endif(HAVE_SNDIO_H AND D_SNDIO_LIB)
endif(SNDIO)
endmacro(CheckSNDIO)

# Requires:
# - PkgCheckModules
# Optional:
@@ -910,6 +910,52 @@ AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[defa
fi
}

dnl See if the sndio audio interface is supported
CheckSNDIO()
{
AC_ARG_ENABLE(sndio,
AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
, enable_sndio=yes)
if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)

AC_MSG_CHECKING(for sndio audio support)
have_sndio=no

if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
have_sndio=yes
SNDIO_LIBS="-lsndio"
fi

AC_MSG_RESULT($have_sndio)

if test x$have_sndio = xyes; then
AC_ARG_ENABLE(sndio-shared,
AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
, enable_sndio_shared=yes)
sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]

if test x$have_loadso != xyes && \
test x$enable_sndio_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
fi
if test x$have_loadso = xyes && \
test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
echo "-- dynamic libsndio -> $sndio_lib"
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
fi

AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
have_audio=yes
fi
fi
}

dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
@@ -2262,6 +2308,7 @@ case "$host" in
CheckARTSC
CheckESD
CheckNAS
CheckSNDIO
CheckX11
CheckDirectFB
CheckFusionSound
@@ -195,6 +195,8 @@
#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
@@ -199,6 +199,8 @@
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
#undef SDL_AUDIO_DRIVER_SNDIO
#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
#undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUDIO
@@ -67,6 +67,7 @@ extern AudioBootStrap NDSAUD_bootstrap;
extern AudioBootStrap FUSIONSOUND_bootstrap;
extern AudioBootStrap ANDROIDAUD_bootstrap;
extern AudioBootStrap PSPAUD_bootstrap;
extern AudioBootStrap SNDIO_bootstrap;

/* Available audio drivers */
static const AudioBootStrap *const bootstrap[] = {
@@ -76,6 +77,9 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_SNDIO
&SNDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_BSD
&BSD_AUDIO_bootstrap,
#endif

0 comments on commit ba4d76c

Please sign in to comment.