Add support for SDL CD audio, rename --enable-sdlsound to

--enable-sdl-audio
This commit is contained in:
Jeff Teunissen 2000-12-11 09:50:26 +00:00
parent 5023108000
commit e886b0566d
4 changed files with 88 additions and 65 deletions

View file

@ -505,6 +505,7 @@ AC_ARG_WITH(3dfx,
[ --with-3dfx support 3Dfx output for the V1/V2, if an argument [ --with-3dfx support 3Dfx output for the V1/V2, if an argument
is specified it will be used as the GL wrapper lib is specified it will be used as the GL wrapper lib
for glide.], for glide.],
HAS_3dfx=$withval, HAS_3dfx=auto) HAS_3dfx=$withval, HAS_3dfx=auto)
if test "x$HAS_3dfx" != "xno" -a "x$HAS_SVGA" != "xno" \ if test "x$HAS_3dfx" != "xno" -a "x$HAS_SVGA" != "xno" \
-a "x$HAS_GLIDE" != "xno"; then -a "x$HAS_GLIDE" != "xno"; then
@ -580,14 +581,20 @@ AC_ARG_ENABLE(alsa,
[ --disable-alsa disable alsa support], [ --disable-alsa disable alsa support],
) )
AC_ARG_ENABLE(sdlsound,
[ --enable-sdlsound use SDL for sound output]
)
SNDTYPE="" SNDTYPE=""
SOUND_LIBS="" SOUND_LIBS=""
SOUND_CFLAGS="" SOUND_CFLAGS=""
AC_MSG_CHECKING(for sound support) AC_MSG_CHECKING(for sound support)
dnl SDL digital audio
AC_ARG_ENABLE(sdl-audio,
[ --enable-sdl-audio use SDL for audio output],
if test -z "$SNDTYPE" -a "x$HAVE_SDL" = "xyes"; then
SNDTYPE="SDL"
SOUND_LIBS="$SDL_LIBS"
fi
)
if test "x$enable_alsa" != "xno"; then if test "x$enable_alsa" != "xno"; then
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE], AC_EGREP_CPP([QF_maGiC_VALUE],
@ -617,12 +624,6 @@ QF_maGiC_VALUE
fi fi
fi fi
dnl Must put SDL tests before other sound tests...
if test -z "$SNDTYPE" -a "x$HAVE_SDL" = "xyes" -a "x$enable_sdlsound" = "xyes"; then
SNDTYPE="SDL"
SOUND_LIBS="$SDL_LIBS"
fi
dnl MME dnl MME
if test -z "$SNDTYPE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a "x$HAVE_LIBMME" = "xyes"; then if test -z "$SNDTYPE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a "x$HAVE_LIBMME" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE], AC_EGREP_CPP([QF_maGiC_VALUE],
@ -745,8 +746,19 @@ dnl ==================================================================
CD_LIBS="" CD_LIBS=""
CD_CFLAGS="" CD_CFLAGS=""
AC_MSG_CHECKING(for CD audio support) AC_MSG_CHECKING(for CD audio support)
dnl SDL CD audio
AC_ARG_ENABLE(sdl-cd-audio,
[ --enable-sdl-cd-audio use SDL for CD audio output],
if test -z "$CDTYPE" -a "x$HAVE_SDL" = "xyes"; then
AC_MSG_RESULT([yes (SDL)])
CDTYPE=SDL
CD_LIBS="$SDL_LIBS"
fi
)
dnl Linux dnl Linux
if test -z "$CDTYPE"; then if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGiC_VALUE], AC_EGREP_CPP([QF_maGiC_VALUE],
@ -794,9 +806,10 @@ AC_SUBST(CD_LIBS)
AC_SUBST(CD_CFLAGS) AC_SUBST(CD_CFLAGS)
AM_CONDITIONAL(CDTYPE_LINUX, test "$CDTYPE" = "LINUX") AM_CONDITIONAL(CDTYPE_LINUX, test "$CDTYPE" = "LINUX")
AM_CONDITIONAL(CDTYPE_SDL, test "$CDTYPE" = "SDL")
AM_CONDITIONAL(CDTYPE_SGI, test "$CDTYPE" = "SGI") AM_CONDITIONAL(CDTYPE_SGI, test "$CDTYPE" = "SGI")
AM_CONDITIONAL(CDTYPE_WIN32, test "$CDTYPE" = "WIN32") AM_CONDITIONAL(CDTYPE_WIN32, test "$CDTYPE" = "WIN32")
AM_CONDITIONAL(CDTYPE_NULL, test "$CDTYPE" != "LINUX" -a "$CDTYPE" != "SGI" -a "$CDTYPE" != "WIN32") AM_CONDITIONAL(CDTYPE_NULL, test "$CDTYPE" != "LINUX" -a "$CDTYPE" != "SDL" -a "$CDTYPE" != "SGI" -a "$CDTYPE" != "WIN32")
dnl ================================================================== dnl ==================================================================
dnl Checks for networking dnl Checks for networking
@ -941,7 +954,7 @@ else
fi fi
AC_ARG_ENABLE(optimize, AC_ARG_ENABLE(optimize,
[ --disable-optimize compile without optimizations (for development)], [ --disable-optimize compile without optimizations (for development)],
optimize=$disable_optimize, optimize=$disable_optimize,
optimize=yes optimize=yes
) )
@ -986,7 +999,7 @@ fi
dnl CFLAGS for release and devel versions dnl CFLAGS for release and devel versions
AC_ARG_ENABLE(profile, AC_ARG_ENABLE(profile,
[ --enable-profile compile with profiling (for development)], [ --enable-profile compile with profiling (for development)],
profile=$enable_profile profile=$enable_profile
) )
if test "x$profile" = xyes; then if test "x$profile" = xyes; then
@ -1004,7 +1017,7 @@ if test "x$GCC" = xyes; then
dnl Check for -pipe vs -save-temps. dnl Check for -pipe vs -save-temps.
AC_MSG_CHECKING(for -pipe vs -save-temps) AC_MSG_CHECKING(for -pipe vs -save-temps)
AC_ARG_ENABLE(save-temps, AC_ARG_ENABLE(save-temps,
[ --enable-save-temps save temporay files], [ --enable-save-temps save temporary files],
AC_MSG_RESULT(-save-temps); CFLAGS="$CFLAGS -save-temps"; BUILD_TYPE="$BUILD_TYPE Save-temps", AC_MSG_RESULT(-save-temps); CFLAGS="$CFLAGS -save-temps"; BUILD_TYPE="$BUILD_TYPE Save-temps",
AC_MSG_RESULT(-pipe); check_pipe=yes) AC_MSG_RESULT(-pipe); check_pipe=yes)
fi fi
@ -1100,35 +1113,43 @@ dnl Find out what to build and finish
dnl ================================================================== dnl ==================================================================
AC_ARG_WITH(clients, AC_ARG_WITH(clients,
[ --with-clients=<list> compile clients in <list>; [ --with-clients=<list> compile clients in <list>;
mgl ggi sdl sgl svga x11 glx 3dfx], 3dfx ggi glx mgl sdl sgl svga x11],
clients="$withval", clients="all") clients="$withval",
clients="all"
)
if test "$clients" = "all"; then if test "$clients" = "all"; then
ENABLE_MGL=yes ENABLE_3DFX=yes
ENABLE_GGI=yes ENABLE_GGI=yes
ENABLE_GLX=yes
ENABLE_MGL=yes
ENABLE_SDL=yes ENABLE_SDL=yes
ENABLE_SGL=yes ENABLE_SGL=yes
ENABLE_SVGA=yes ENABLE_SVGA=yes
ENABLE_X11=yes ENABLE_X11=yes
ENABLE_GLX=yes
ENABLE_3DFX=yes
else else
ENABLE_MGL=no ENABLE_3DFX=no
ENABLE_GGI=no ENABLE_GGI=no
ENABLE_GLX=no
ENABLE_MGL=no
ENABLE_SDL=no ENABLE_SDL=no
ENABLE_SGL=no ENABLE_SGL=no
ENABLE_SVGA=no ENABLE_SVGA=no
ENABLE_X11=no ENABLE_X11=no
ENABLE_GLX=no
ENABLE_3DFX=no
for client in $clients; do for client in $clients; do
case "$client" in case "$client" in
mgl) 3dfx)
ENABLE_MGL=yes ENABLE_3DFX=yes
;; ;;
ggi) ggi)
ENABLE_GGI=yes ENABLE_GGI=yes
;; ;;
glx)
ENABLE_GLX=yes
;;
mgl)
ENABLE_MGL=yes
;;
sdl) sdl)
ENABLE_SDL=yes ENABLE_SDL=yes
;; ;;
@ -1141,12 +1162,6 @@ else
x11) x11)
ENABLE_X11=yes ENABLE_X11=yes
;; ;;
glx)
ENABLE_GLX=yes
;;
3dfx)
ENABLE_3DFX=yes
;;
esac esac
done done
fi fi
@ -1158,18 +1173,34 @@ AC_ARG_WITH(server,
CL_TARGETS="" CL_TARGETS=""
TARGETS="" TARGETS=""
if test "x$HAVE_MGL" = xyes -a "x$ENABLE_MGL" = xyes; then if test "x$HAVE_TDFXGL" = xyes -a "x$ENABLE_3DFX" = xyes; then
TARGETS="$TARGETS qf-client-mgl\$(EXEEXT)" TARGETS="$TARGETS qf-client-3dfx\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS MGL" CL_TARGETS="$CL_TARGETS 3dfx"
fi fi
if test "x$HAVE_GGI" = xyes -a "x$ENABLE_GGI" = xyes; then if test "x$HAVE_GGI" = xyes -a "x$ENABLE_GGI" = xyes; then
TARGETS="$TARGETS qf-client-ggi\$(EXEEXT)" TARGETS="$TARGETS qf-client-ggi\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS GGI" CL_TARGETS="$CL_TARGETS GGI"
fi fi
if test "x$HAVE_X" = xyes; then
if test "x$HAVE_GLX" = xyes -a "x$ENABLE_GLX" = xyes; then
TARGETS="$TARGETS qf-client-glx\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS GLX"
fi
fi
if test "x$HAVE_MGL" = xyes -a "x$ENABLE_MGL" = xyes; then
TARGETS="$TARGETS qf-client-mgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS MGL"
fi
if test "x$HAVE_SDL" = xyes -a "x$ENABLE_SDL" = xyes; then if test "x$HAVE_SDL" = xyes -a "x$ENABLE_SDL" = xyes; then
TARGETS="$TARGETS qf-client-sdl\$(EXEEXT)" TARGETS="$TARGETS qf-client-sdl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SDL" CL_TARGETS="$CL_TARGETS SDL"
fi fi
if test "x$HAVE_SGL" = xyes; then
if test "x$HAVE_GLX" = xyes -a "x$ENABLE_SGL" = xyes; then
TARGETS="$TARGETS qf-client-sgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SDL-GL"
fi
fi
if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then
TARGETS="$TARGETS qf-client-svga\$(EXEEXT)" TARGETS="$TARGETS qf-client-svga\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SVGAlib" CL_TARGETS="$CL_TARGETS SVGAlib"
@ -1178,22 +1209,6 @@ if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then
TARGETS="$TARGETS qf-client-x11\$(EXEEXT)" TARGETS="$TARGETS qf-client-x11\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS X11" CL_TARGETS="$CL_TARGETS X11"
fi fi
if test "x$HAVE_X" = xyes; then
if test "x$HAVE_GLX" = xyes -a "x$ENABLE_GLX" = xyes; then
TARGETS="$TARGETS qf-client-glx\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS GLX"
fi
fi
if test "x$HAVE_SGL" = xyes; then
if test "x$HAVE_GLX" = xyes -a "x$ENABLE_SGL" = xyes; then
TARGETS="$TARGETS qf-client-sgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SDL-GL"
fi
fi
if test "x$HAVE_TDFXGL" = xyes -a "x$ENABLE_3DFX" = xyes; then
TARGETS="$TARGETS qf-client-3dfx\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS 3dfx"
fi
if test "x$SV_TARGETS" = xyes; then if test "x$SV_TARGETS" = xyes; then
TARGETS="qf-server\$(EXEEXT) $TARGETS" TARGETS="qf-server\$(EXEEXT) $TARGETS"
fi fi
@ -1220,10 +1235,10 @@ AC_MSG_RESULT([
Build type:$BUILD_TYPE Build type:$BUILD_TYPE
Server support: $SV_TARGETS Server support: $SV_TARGETS
Client support:$CL_TARGETS Client support:$CL_TARGETS
Sound system: $SNDTYPE
System game data directory: $sharepath Shared game data directory: $sharepath
Per-user game data directory: $userpath Per-user game data directory: $userpath
Global configuration file: $globalconf Global configuration file: $globalconf
Sound sytem: $SNDTYPE
]) ])
test -d ./CVS && echo -e "WARNING: Hackers at work, watch for falling bits of code.\n(This is from a development CVS tree. Expect problems)\n" test -d ./CVS && echo -e "WARNING: Hackers at work, watch for falling bits of code.\n(This is from a development CVS tree. Expect problems)\n"

View file

@ -128,6 +128,9 @@ EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \
if CDTYPE_LINUX if CDTYPE_LINUX
libqfcd_a_SOURCES= cd_linux.c libqfcd_a_SOURCES= cd_linux.c
endif endif
if CDTYPE_SDL
libqfcd_a_SOURCES= cd_sdl.c
endif
if CDTYPE_SGI if CDTYPE_SGI
libqfcd_a_SOURCES= cd_sgi.c libqfcd_a_SOURCES= cd_sgi.c
endif endif

View file

@ -30,6 +30,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "qtypes.h"
void void
CDAudio_Play (byte track, qboolean looping) CDAudio_Play (byte track, qboolean looping)
{ {

View file

@ -29,9 +29,12 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <SDL.h> #include <SDL.h>
#include <windows.h>
#include "qargs.h" #include "qargs.h"
#include "console.h" #include "console.h"
#include "cdaudio.h" #include "cdaudio.h"
@ -44,13 +47,14 @@ static qboolean cdValid = false;
static qboolean initialized = false; static qboolean initialized = false;
static qboolean enabled = true; static qboolean enabled = true;
static qboolean playLooping = false; static qboolean playLooping = false;
static SDL_CD *cd_id;
static float cdvolume = 1.0;
static void CD_f (); static SDL_CD *cd_id;
static float cdvolume = 1.0;
static void CD_f (void);
static void static void
CDAudio_Eject () CDAudio_Eject (void)
{ {
if (!cd_id || !enabled) if (!cd_id || !enabled)
return; return;
@ -95,9 +99,8 @@ CDAudio_Play (byte track, qboolean looping)
playLooping = looping; playLooping = looping;
} }
void void
CDAudio_Stop () CDAudio_Stop (void)
{ {
int cdstate; int cdstate;
@ -112,7 +115,7 @@ CDAudio_Stop ()
} }
void void
CDAudio_Pause () CDAudio_Pause (void)
{ {
if (!cd_id || !enabled) if (!cd_id || !enabled)
return; return;
@ -125,7 +128,7 @@ CDAudio_Pause ()
void void
CDAudio_Resume () CDAudio_Resume (void)
{ {
if (!cd_id || !enabled) if (!cd_id || !enabled)
return; return;
@ -137,7 +140,7 @@ CDAudio_Resume ()
} }
void void
CDAudio_Update () CDAudio_Update (void)
{ {
if (!cd_id || !enabled) if (!cd_id || !enabled)
return; return;
@ -158,7 +161,7 @@ CDAudio_Update ()
} }
int int
CDAudio_Init () CDAudio_Init (void)
{ {
#ifdef UQUAKE #ifdef UQUAKE
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
@ -198,7 +201,7 @@ CDAudio_Init ()
void void
CDAudio_Shutdown () CDAudio_Shutdown (void)
{ {
if (!cd_id) if (!cd_id)
return; return;
@ -210,7 +213,7 @@ CDAudio_Shutdown ()
#define CD_f_DEFINED #define CD_f_DEFINED
static void static void
CD_f () CD_f (void)
{ {
char *command; char *command;
int cdstate; int cdstate;