mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-21 19:51:18 +00:00
context_x11.h -- didn't mean to commit my local changes
rest: Apply patches from Michael Weiser <michael@weiser.saale-net.de>
This commit is contained in:
parent
54e2a4d9d3
commit
329d51b4e8
7 changed files with 798 additions and 98 deletions
159
configure.in
159
configure.in
|
@ -61,8 +61,8 @@ AC_CHECK_HEADERS(
|
||||||
sys/param.h sys/stat.h sys/time.h sys/timeb.h sys/types.h \
|
sys/param.h sys/stat.h sys/time.h sys/timeb.h sys/types.h \
|
||||||
sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \
|
sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \
|
||||||
sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \
|
sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \
|
||||||
dsound.h mmsystem.h initguid.h mme/mmsystem.h mme/mme_public.h \
|
dmedia/audio.h dsound.h mmsystem.h initguid.h mme/mmsystem.h \
|
||||||
sys/asoundlib.h string.h strings.h memory.h malloc.h \
|
mme/mme_public.h sys/asoundlib.h string.h strings.h memory.h malloc.h \
|
||||||
errno.h sys/dir.h fnmatch.h \
|
errno.h sys/dir.h fnmatch.h \
|
||||||
mgraph.h linux/joystick.h
|
mgraph.h linux/joystick.h
|
||||||
)
|
)
|
||||||
|
@ -629,28 +629,40 @@ fi
|
||||||
|
|
||||||
dnl OSS
|
dnl OSS
|
||||||
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then
|
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then
|
||||||
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
#ifdef SNDCTL_DSP_SETTRIGGER
|
#ifdef SNDCTL_DSP_SETTRIGGER
|
||||||
QF_maGiC_VALUE
|
QF_maGiC_VALUE
|
||||||
#endif
|
#endif
|
||||||
], SNDTYPE="OSS")
|
], SNDTYPE="OSS")
|
||||||
fi
|
fi
|
||||||
if test -z "$SNDTYPE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then
|
if test -z "$SNDTYPE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then
|
||||||
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
||||||
#include <linux/soundcard.h>
|
#include <linux/soundcard.h>
|
||||||
#ifdef SNDCTL_DSP_SETTRIGGER
|
#ifdef SNDCTL_DSP_SETTRIGGER
|
||||||
QF_maGiC_VALUE
|
QF_maGiC_VALUE
|
||||||
#endif
|
#endif
|
||||||
], SNDTYPE="OSS")
|
], SNDTYPE="OSS")
|
||||||
fi
|
fi
|
||||||
if test -z "$SNDTYPE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then
|
if test -z "$SNDTYPE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then
|
||||||
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
||||||
#include <machine/soundcard.h>
|
#include <machine/soundcard.h>
|
||||||
#ifdef SNDCTL_DSP_SETTRIGGER
|
#ifdef SNDCTL_DSP_SETTRIGGER
|
||||||
QF_maGiC_VALUE
|
QF_maGiC_VALUE
|
||||||
#endif
|
#endif
|
||||||
], SNDTYPE="OSS")
|
], SNDTYPE="OSS")
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl SGI
|
||||||
|
if test -z "$SNDTYPE" -a "x$ac_cv_header_dmedia_audio_h" = "xyes"; then
|
||||||
|
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
||||||
|
#include <dmedia/audio.h>
|
||||||
|
#ifdef AL_SAMPLE_16
|
||||||
|
#ifdef AL_RATE
|
||||||
|
QF_maGiC_VALUE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
], SNDTYPE="SGI" SOUND_LIBS="-laudio")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Sun
|
dnl Sun
|
||||||
|
@ -660,7 +672,7 @@ if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_audioio_h" = "xyes"; then
|
||||||
#ifdef AUDIO_SETINFO
|
#ifdef AUDIO_SETINFO
|
||||||
QF_maGiC_VALUE
|
QF_maGiC_VALUE
|
||||||
#endif
|
#endif
|
||||||
], SNDTYPE="SUN")
|
], SNDTYPE="SUN")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Win32
|
dnl Win32
|
||||||
|
@ -685,23 +697,25 @@ else
|
||||||
fi
|
fi
|
||||||
AC_SUBST(SOUND_LIBS)
|
AC_SUBST(SOUND_LIBS)
|
||||||
AC_SUBST(SOUND_CFLAGS)
|
AC_SUBST(SOUND_CFLAGS)
|
||||||
|
|
||||||
AM_CONDITIONAL(SNDTYPE_ALSA_0_5, test "$SNDTYPE" = "ALSA_0_5")
|
AM_CONDITIONAL(SNDTYPE_ALSA_0_5, test "$SNDTYPE" = "ALSA_0_5")
|
||||||
AM_CONDITIONAL(SNDTYPE_ALSA_0_6, test "$SNDTYPE" = "ALSA_0_6")
|
AM_CONDITIONAL(SNDTYPE_ALSA_0_6, test "$SNDTYPE" = "ALSA_0_6")
|
||||||
AM_CONDITIONAL(SNDTYPE_MME, test "$SNDTYPE" = "MME")
|
AM_CONDITIONAL(SNDTYPE_MME, test "$SNDTYPE" = "MME")
|
||||||
AM_CONDITIONAL(SNDTYPE_OSS, test "$SNDTYPE" = "OSS")
|
AM_CONDITIONAL(SNDTYPE_OSS, test "$SNDTYPE" = "OSS")
|
||||||
|
AM_CONDITIONAL(SNDTYPE_SGI, test "$SNDTYPE" = "SGI")
|
||||||
AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN")
|
AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN")
|
||||||
AM_CONDITIONAL(SNDTYPE_WIN32, test "$SNDTYPE" = "WIN32")
|
AM_CONDITIONAL(SNDTYPE_WIN32, test "$SNDTYPE" = "WIN32")
|
||||||
AM_CONDITIONAL(SNDTYPE_NULL, test "$SNDTYPE" != "ALSA_0_5" -a "$SNDTYPE" != "ALSA_0_6" -a "$SNDTYPE" != "MME" -a "$SNDTYPE" != "OSS" -a "$SNDTYPE" != "SUN" -a "$SNDTYPE" != "WIN32")
|
AM_CONDITIONAL(SNDTYPE_NULL, test "$SNDTYPE" != "ALSA_0_5" -a "$SNDTYPE" != "ALSA_0_6" -a "$SNDTYPE" != "MME" -a "$SNDTYPE" != "OSS" -a "$SNDTYPE" != "SGI" -a "$SNDTYPE" != "SUN" -a "$SNDTYPE" != "WIN32")
|
||||||
|
|
||||||
dnl Tests for joystick support
|
dnl Tests for joystick support
|
||||||
AC_MSG_CHECKING(for joystick support)
|
AC_MSG_CHECKING(for joystick support)
|
||||||
if test -z "$JOYTYPE" -a "x$ac_cv_header_linux_joystick_h" = "xyes"; then
|
if test -z "$JOYTYPE" -a "x$ac_cv_header_linux_joystick_h" = "xyes"; then
|
||||||
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
AC_EGREP_CPP([QF_maGiC_VALUE],[
|
||||||
#include <linux/joystick.h>
|
#include <linux/joystick.h>
|
||||||
#ifdef JS_VERSION
|
#ifdef JS_VERSION
|
||||||
QF_maGiC_VALUE
|
QF_maGiC_VALUE
|
||||||
#endif
|
#endif
|
||||||
], JOYTYPE="Linux")
|
], JOYTYPE="Linux")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$JOYTYPE"; then
|
if test "$JOYTYPE"; then
|
||||||
|
@ -736,6 +750,21 @@ QF_maGiC_VALUE
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl SGI
|
||||||
|
if test -z "$CDTYPE"; then
|
||||||
|
AC_EGREP_CPP([QF_maGiC_VALUE],
|
||||||
|
[
|
||||||
|
#include <dmedia/cdaudio.h>
|
||||||
|
#ifdef CD_READY
|
||||||
|
QF_maGiC_VALUE
|
||||||
|
#endif
|
||||||
|
],
|
||||||
|
AC_MSG_RESULT([yes (SGI)])
|
||||||
|
CDTYPE=SGI
|
||||||
|
CD_LIBS="-lcdaudio -lmediad -lds"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
if test -z "$CDTYPE"; then
|
if test -z "$CDTYPE"; then
|
||||||
AC_EGREP_CPP([QF_maGIC_VALUE],
|
AC_EGREP_CPP([QF_maGIC_VALUE],
|
||||||
[
|
[
|
||||||
|
@ -752,23 +781,27 @@ fi
|
||||||
test -z "$CDTYPE" && AC_MSG_RESULT([no, using null CD audio driver])
|
test -z "$CDTYPE" && AC_MSG_RESULT([no, using null CD audio driver])
|
||||||
AC_SUBST(CD_LIBS)
|
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_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" != "WIN32")
|
AM_CONDITIONAL(CDTYPE_NULL, test "$CDTYPE" != "LINUX" -a "$CDTYPE" != "SGI" -a "$CDTYPE" != "WIN32")
|
||||||
|
|
||||||
dnl ==================================================================
|
dnl ==================================================================
|
||||||
dnl Checks for networking
|
dnl Checks for networking
|
||||||
dnl ==================================================================
|
dnl ==================================================================
|
||||||
|
|
||||||
if test "x$ac_cv_func_connect" != "xyes"; then
|
if test "x$ac_cv_func_connect" != "xyes"; then
|
||||||
AC_CHECK_LIB(socket,connect,
|
AC_CHECK_LIB(socket, connect,
|
||||||
NET_LIBS="$NET_LIBS -lsocket"
|
NET_LIBS="$NET_LIBS -lsocket"
|
||||||
ac_cv_func_connect=yes)
|
ac_cv_func_connect=yes
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
if test "x$ac_cv_func_gethostbyname" != "xyes"; then
|
if test "x$ac_cv_func_gethostbyname" != "xyes"; then
|
||||||
AC_CHECK_LIB(nsl,gethostbyname,
|
AC_CHECK_LIB(nsl, gethostbyname,
|
||||||
NET_LIBS="$NET_LIBS -lnsl"
|
NET_LIBS="$NET_LIBS -lnsl"
|
||||||
ac_cv_func_gethostbyname=yes)
|
ac_cv_func_gethostbyname=yes
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([for connect in -lwsock32])
|
AC_MSG_CHECKING([for connect in -lwsock32])
|
||||||
|
@ -779,36 +812,37 @@ AC_TRY_LINK([
|
||||||
],[
|
],[
|
||||||
connect(0, NULL, 42);
|
connect(0, NULL, 42);
|
||||||
],
|
],
|
||||||
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
|
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
|
||||||
ac_cv_func_connect=yes
|
ac_cv_func_connect=yes
|
||||||
ac_cv_func_gethostbyname=yes
|
ac_cv_func_gethostbyname=yes
|
||||||
HAVE_WSOCK=yes
|
HAVE_WSOCK=yes
|
||||||
AC_MSG_RESULT(yes),
|
AC_MSG_RESULT(yes),
|
||||||
AC_MSG_RESULT(no))
|
AC_MSG_RESULT(no)
|
||||||
|
)
|
||||||
LIBS="$SAVELIBS"
|
LIBS="$SAVELIBS"
|
||||||
|
|
||||||
AC_MSG_CHECKING(for UDP support)
|
AC_MSG_CHECKING(for UDP support)
|
||||||
if test "x$ac_cv_func_connect" = "xyes" -a \
|
if test "x$ac_cv_func_connect" = "xyes" -a "x$ac_cv_func_gethostbyname" = "xyes"; then
|
||||||
"x$ac_cv_func_gethostbyname" = "xyes"; then
|
HAVE_UDP=yes
|
||||||
HAVE_UDP=yes
|
AC_MSG_RESULT(yes)
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$ac_cv_func_connect" != "xyes"; then
|
if test "x$ac_cv_func_connect" != "xyes"; then
|
||||||
AC_MSG_CHECKING([for connect in -lwsock32])
|
AC_MSG_CHECKING([for connect in -lwsock32])
|
||||||
SAVELIBS="$LIBS"
|
SAVELIBS="$LIBS"
|
||||||
LIBS="$LIBS -lwsock32"
|
LIBS="$LIBS -lwsock32"
|
||||||
AC_TRY_LINK([
|
AC_TRY_LINK([
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
],[
|
],[
|
||||||
connect(0, NULL, 42);
|
connect(0, NULL, 42);
|
||||||
],
|
],
|
||||||
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
|
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
|
||||||
AC_MSG_RESULT(yes),
|
AC_MSG_RESULT(yes),
|
||||||
AC_MSG_RESULT(no))
|
AC_MSG_RESULT(no)
|
||||||
LIBS="$SAVELIBS"
|
)
|
||||||
|
LIBS="$SAVELIBS"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(NET_LIBS)
|
AC_SUBST(NET_LIBS)
|
||||||
|
|
||||||
|
@ -1009,8 +1043,8 @@ fi
|
||||||
|
|
||||||
dnl We want warnings, lots of warnings...
|
dnl We want warnings, lots of warnings...
|
||||||
if test "x$GCC" = xyes; then
|
if test "x$GCC" = xyes; then
|
||||||
CFLAGS="$CFLAGS -Wall -Werror"
|
CFLAGS="$CFLAGS -Wall -Werror"
|
||||||
# CFLAGS="$CFLAGS -Wall -pedantic"
|
# CFLAGS="$CFLAGS -Wall -pedantic"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl ==================================================================
|
dnl ==================================================================
|
||||||
|
@ -1020,10 +1054,10 @@ dnl ==================================================================
|
||||||
AC_MSG_CHECKING(for libz.a in X11)
|
AC_MSG_CHECKING(for libz.a in X11)
|
||||||
need_abs_libz=no
|
need_abs_libz=no
|
||||||
for d in `echo $X_LIBS | sed -e 's/-L//'`; do
|
for d in `echo $X_LIBS | sed -e 's/-L//'`; do
|
||||||
if test -f $d/libz.a; then
|
if test -f $d/libz.a; then
|
||||||
need_abs_libz=yes
|
need_abs_libz=yes
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
AC_MSG_RESULT($need_abs_libz)
|
AC_MSG_RESULT($need_abs_libz)
|
||||||
|
|
||||||
|
@ -1031,22 +1065,22 @@ AC_ARG_WITH(libz,
|
||||||
[ --with-libz=<path list> specify directories to search for zlib],
|
[ --with-libz=<path list> specify directories to search for zlib],
|
||||||
zlib_paths="$withval", zlib_paths="")
|
zlib_paths="$withval", zlib_paths="")
|
||||||
if test "x$need_abs_libz" = "xyes"; then
|
if test "x$need_abs_libz" = "xyes"; then
|
||||||
AC_MSG_CHECKING(for location of libz.a or libz.so)
|
AC_MSG_CHECKING(for location of libz.a or libz.so)
|
||||||
zlib_location="unknown"
|
zlib_location="unknown"
|
||||||
for d in $zlib_paths /usr/local/lib /usr/lib; do
|
for d in $zlib_paths /usr/local/lib /usr/lib; do
|
||||||
for f in libz.so libz.a; do
|
for f in libz.so libz.a; do
|
||||||
if test -f $d/$f; then
|
if test -f $d/$f; then
|
||||||
zlib_location=$d/$f
|
zlib_location=$d/$f
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
AC_MSG_RESULT($zlib_location)
|
AC_MSG_RESULT($zlib_location)
|
||||||
if test "$zlib_location" = unknown; then
|
if test "$zlib_location" = unknown; then
|
||||||
echo need to specify zlib location with --with-zlib
|
echo need to specify zlib location with --with-zlib
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
Z_LIBS="$zlib_location"
|
Z_LIBS="$zlib_location"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(Z_LIBS)
|
AC_SUBST(Z_LIBS)
|
||||||
|
|
||||||
|
@ -1107,8 +1141,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(server,
|
AC_ARG_WITH(server,
|
||||||
[ --with-server compile dedicated server],
|
[ --with-server compile dedicated server],
|
||||||
SV_TARGETS="$withval", SV_TARGETS=yes)
|
SV_TARGETS="$withval", SV_TARGETS=yes
|
||||||
|
)
|
||||||
|
|
||||||
CL_TARGETS=""
|
CL_TARGETS=""
|
||||||
TARGETS=""
|
TARGETS=""
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONTEXT_X11_H__
|
#ifndef __context_x11_h_
|
||||||
#define __CONTEXT_X11_H__
|
#define __context_x11_h_
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
@ -57,7 +57,7 @@ void x11_process_events (void);
|
||||||
void x11_open_display (void);
|
void x11_open_display (void);
|
||||||
void x11_close_display (void);
|
void x11_close_display (void);
|
||||||
void x11_create_null_cursor (void);
|
void x11_create_null_cursor (void);
|
||||||
void x11_update_vidmode (int, int);
|
void x11_set_vidmode (int, int);
|
||||||
void x11_restore_vidmode (void);
|
void x11_restore_vidmode (void);
|
||||||
void x11_create_window (int, int);
|
void x11_create_window (int, int);
|
||||||
void x11_grab_keyboard (void);
|
void x11_grab_keyboard (void);
|
||||||
|
@ -65,4 +65,4 @@ void x11_set_caption (char *);
|
||||||
void x11_force_view_port (void);
|
void x11_force_view_port (void);
|
||||||
void x11_Init_Cvars (void);
|
void x11_Init_Cvars (void);
|
||||||
|
|
||||||
#endif // __CONTEXT_X11_H__
|
#endif // __context_x11_h_
|
||||||
|
|
|
@ -98,50 +98,57 @@ if SNDTYPE_ALSA_0_6
|
||||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_6.c
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_6.c
|
||||||
endif
|
endif
|
||||||
if SNDTYPE_MME
|
if SNDTYPE_MME
|
||||||
libqfsnd_a_SOURCES = snd_dma.c snd_mem.c snd_mix.c snd_mme.c
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_mme.c
|
||||||
endif
|
endif
|
||||||
if SNDTYPE_OSS
|
if SNDTYPE_OSS
|
||||||
libqfsnd_a_SOURCES = snd_dma.c snd_mem.c snd_mix.c snd_oss.c
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_oss.c
|
||||||
|
endif
|
||||||
|
if SNDTYPE_SGI
|
||||||
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sgi.c
|
||||||
endif
|
endif
|
||||||
if SNDTYPE_SUN
|
if SNDTYPE_SUN
|
||||||
libqfsnd_a_SOURCES = snd_dma.c snd_mem.c snd_mix.c snd_sun.c
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sun.c
|
||||||
endif
|
endif
|
||||||
if SNDTYPE_WIN32
|
if SNDTYPE_WIN32
|
||||||
libqfsnd_a_SOURCES = snd_dma.c snd_mem.c snd_mix.c snd_win.c
|
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_win.c
|
||||||
endif
|
endif
|
||||||
if SNDTYPE_NULL
|
if SNDTYPE_NULL
|
||||||
libqfsnd_a_SOURCES = snd_null.c
|
libqfsnd_a_SOURCES= snd_null.c
|
||||||
endif
|
endif
|
||||||
EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \
|
EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \
|
||||||
snd_alsa_0_6.c snd_oss.c snd_sun.c snd_win.c snd_null.c
|
snd_alsa_0_6.c snd_oss.c snd_sdl.c snd_sgi.c \
|
||||||
|
snd_sun.c snd_win.c snd_null.c
|
||||||
|
|
||||||
#
|
#
|
||||||
# ... CD audio
|
# ... CD audio
|
||||||
#
|
#
|
||||||
if CDTYPE_WIN32
|
|
||||||
libqfcd_a_SOURCES = cd_win.c
|
|
||||||
endif
|
|
||||||
if CDTYPE_LINUX
|
if CDTYPE_LINUX
|
||||||
libqfcd_a_SOURCES = cd_linux.c
|
libqfcd_a_SOURCES= cd_linux.c
|
||||||
|
endif
|
||||||
|
if CDTYPE_SGI
|
||||||
|
libqfcd_a_SOURCES= cd_sgi.c
|
||||||
|
endif
|
||||||
|
if CDTYPE_WIN32
|
||||||
|
libqfcd_a_SOURCES= cd_win.c
|
||||||
endif
|
endif
|
||||||
if CDTYPE_NULL
|
if CDTYPE_NULL
|
||||||
libqfcd_a_SOURCES = cd_null.c
|
libqfcd_a_SOURCES= cd_null.c
|
||||||
endif
|
endif
|
||||||
EXTRA_libqfcd_a_SOURCES = cd_audio.c cd_linux.c cd_null.c cd_sdl.c cd_win.c
|
EXTRA_libqfcd_a_SOURCES= cd_dos.c cd_linux.c cd_sdl.c cd_sgi.c cd_win.c cd_null.c
|
||||||
|
|
||||||
#
|
#
|
||||||
# ... Joystick
|
# ... Joystick
|
||||||
#
|
#
|
||||||
if JOYTYPE_LINUX
|
if JOYTYPE_LINUX
|
||||||
libqfjs_a_SOURCES = joy_linux.c
|
libqfjs_a_SOURCES= joy_linux.c
|
||||||
endif
|
endif
|
||||||
if JOYTYPE_NULL
|
if JOYTYPE_NULL
|
||||||
libqfjs_a_SOURCES = joy_null.c
|
libqfjs_a_SOURCES= joy_null.c
|
||||||
endif
|
endif
|
||||||
libqfjs_a_CFLAGS= $(JOY_CFLAGS)
|
libqfjs_a_CFLAGS= $(JOY_CFLAGS)
|
||||||
EXTRA_libqfjs_a_SOURCES = joy_linux.c joy_null.c
|
EXTRA_libqfjs_a_SOURCES= joy_linux.c joy_null.c
|
||||||
|
|
||||||
CLIENT_LIBS= -L. -lqfsys_cl -lqfsnd -lqfcd -lqfjs $(SOUND_LIBS) $(NET_LIBS) $(JOY_LIBS) $(Z_LIBS)
|
CLIENT_LIBS= -L. -lqfsys_cl -lqfsnd -lqfcd -lqfjs $(SOUND_LIBS) $(NET_LIBS) $(CD_LIBS) $(JOY_LIBS) $(Z_LIBS)
|
||||||
|
|
||||||
if ASM_ARCH
|
if ASM_ARCH
|
||||||
client_ASM= snd_mixa.S cl_math.S
|
client_ASM= snd_mixa.S cl_math.S
|
||||||
|
|
347
source/cd_sgi.c
Normal file
347
source/cd_sgi.c
Normal file
|
@ -0,0 +1,347 @@
|
||||||
|
/*
|
||||||
|
cd_sgi.c
|
||||||
|
|
||||||
|
audio cd playback support for sgi irix machines
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <dmedia/cdaudio.h>
|
||||||
|
|
||||||
|
#include "qtypes.h"
|
||||||
|
#include "console.h"
|
||||||
|
#include "qargs.h"
|
||||||
|
#include "cmd.h"
|
||||||
|
#include "cdaudio.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
static qboolean initialized = false;
|
||||||
|
static qboolean enabled = true;
|
||||||
|
static qboolean playLooping = false;
|
||||||
|
static float cdvolume;
|
||||||
|
static byte remap[100];
|
||||||
|
static byte playTrack;
|
||||||
|
|
||||||
|
static char cd_dev[64] = "/dev/cdrom";
|
||||||
|
|
||||||
|
static CDPLAYER *cdp = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
CDAudio_Eject (void)
|
||||||
|
{
|
||||||
|
if (cdp == NULL || !enabled)
|
||||||
|
return; // no cd init'd
|
||||||
|
|
||||||
|
if (CDeject (cdp) == 0)
|
||||||
|
Con_DPrintf ("CDAudio_Eject: CDeject failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
CDAudio_GetState (void)
|
||||||
|
{
|
||||||
|
CDSTATUS cds;
|
||||||
|
|
||||||
|
if (cdp == NULL || !enabled)
|
||||||
|
return -1; // no cd init'd
|
||||||
|
|
||||||
|
if (CDgetstatus (cdp, &cds) == 0) {
|
||||||
|
Con_DPrintf ("CDAudio_GetStatus: CDgetstatus failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cds.state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
CDAudio_MaxTrack (void)
|
||||||
|
{
|
||||||
|
CDSTATUS cds;
|
||||||
|
|
||||||
|
if (cdp == NULL || !enabled)
|
||||||
|
return -1; // no cd init'd
|
||||||
|
|
||||||
|
if (CDgetstatus (cdp, &cds) == 0) {
|
||||||
|
Con_DPrintf ("CDAudio_MaxTrack: CDgetstatus failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cds.last;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Play (byte track, qboolean looping)
|
||||||
|
{
|
||||||
|
int maxtrack = CDAudio_MaxTrack ();
|
||||||
|
|
||||||
|
if (!initialized || !enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* cd == audio cd? */
|
||||||
|
if (CDAudio_GetState () != CD_READY) {
|
||||||
|
Con_Printf ("CDAudio_Play: CD in player not an audio CD.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxtrack < 0) {
|
||||||
|
Con_DPrintf ("CDAudio_Play: Error getting maximum track number\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
track = remap[track];
|
||||||
|
|
||||||
|
if (track < 1 || track > maxtrack) {
|
||||||
|
Con_DPrintf ("CDAudio_Play: Bad track number %u.\n", track);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// don't try to play a non-audio track
|
||||||
|
/* mw: how to do this on irix? entry0.cdte_track = track;
|
||||||
|
entry0.cdte_format = CDROM_MSF; if ( ioctl(cdfile, CDROMREADTOCENTRY,
|
||||||
|
&entry0) == -1 ) { Con_DPrintf("CDAudio: ioctl cdromreadtocentry
|
||||||
|
failed\n"); return; }
|
||||||
|
|
||||||
|
entry1.cdte_track = track + 1; entry1.cdte_format = CDROM_MSF; if
|
||||||
|
(entry1.cdte_track > maxTrack) { entry1.cdte_track = CDROM_LEADOUT; }
|
||||||
|
|
||||||
|
if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry1) == -1 ) {
|
||||||
|
Con_DPrintf("CDAudio: ioctl cdromreadtocentry failed\n"); return; }
|
||||||
|
|
||||||
|
if (entry0.cdte_ctrl == CDROM_DATA_TRACK) { Con_Printf("track %i is
|
||||||
|
not audio\n", track); return; } */
|
||||||
|
|
||||||
|
if (CDAudio_GetState () == CD_PLAYING) {
|
||||||
|
if (playTrack == track)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CDAudio_Stop ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) {
|
||||||
|
Con_DPrintf ("CDAudio_Play: CDplay failed (%d)\n", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playLooping = looping;
|
||||||
|
playTrack = track;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Stop (void)
|
||||||
|
{
|
||||||
|
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PLAYING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CDstop (cdp) == 0)
|
||||||
|
Con_DPrintf ("CDAudio_Stop: CDStop failed (%d)\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Pause (void)
|
||||||
|
{
|
||||||
|
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PLAYING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CDtogglepause (cdp) == 0)
|
||||||
|
Con_DPrintf ("CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Resume (void)
|
||||||
|
{
|
||||||
|
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PAUSED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CDtogglepause (cdp) == 0)
|
||||||
|
Con_DPrintf ("CDAudio_Resume: CDtogglepause failed (%d)\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
CD_f (void)
|
||||||
|
{
|
||||||
|
char *command;
|
||||||
|
int ret;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (Cmd_Argc () < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
command = Cmd_Argv (1);
|
||||||
|
|
||||||
|
if (strcasecmp (command, "on") == 0) {
|
||||||
|
enabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "off") == 0) {
|
||||||
|
CDAudio_Stop ();
|
||||||
|
enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "reset") == 0) {
|
||||||
|
enabled = true;
|
||||||
|
CDAudio_Stop ();
|
||||||
|
|
||||||
|
for (n = 0; n < 100; n++)
|
||||||
|
remap[n] = n;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "remap") == 0) {
|
||||||
|
ret = Cmd_Argc () - 2;
|
||||||
|
|
||||||
|
if (ret <= 0) {
|
||||||
|
for (n = 1; n < 100; n++)
|
||||||
|
if (remap[n] != n)
|
||||||
|
Con_Printf (" %u -> %u\n", n, remap[n]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (n = 1; n <= ret; n++)
|
||||||
|
remap[n] = atoi (Cmd_Argv (n + 1));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "play") == 0) {
|
||||||
|
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "loop") == 0) {
|
||||||
|
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "stop") == 0) {
|
||||||
|
CDAudio_Stop ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "pause") == 0) {
|
||||||
|
CDAudio_Pause ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "resume") == 0) {
|
||||||
|
CDAudio_Resume ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "eject") == 0) {
|
||||||
|
CDAudio_Stop ();
|
||||||
|
CDAudio_Eject ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp (command, "info") == 0) {
|
||||||
|
Con_Printf ("%u tracks\n", CDAudio_MaxTrack ());
|
||||||
|
if (CDAudio_GetState () == CD_PLAYING)
|
||||||
|
Con_Printf ("Currently %s track %u\n",
|
||||||
|
playLooping ? "looping" : "playing", playTrack);
|
||||||
|
else if (CDAudio_GetState () == CD_PAUSED)
|
||||||
|
Con_Printf ("Paused %s track %u\n",
|
||||||
|
playLooping ? "looping" : "playing", playTrack);
|
||||||
|
|
||||||
|
Con_Printf ("Volume is %g\n", cdvolume);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Update (void)
|
||||||
|
{
|
||||||
|
if (!initialized || !enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (bgmvolume->value != cdvolume) {
|
||||||
|
if (cdvolume) {
|
||||||
|
Cvar_SetValue (bgmvolume, 0.0);
|
||||||
|
cdvolume = bgmvolume->value;
|
||||||
|
CDAudio_Pause ();
|
||||||
|
} else {
|
||||||
|
Cvar_SetValue (bgmvolume, 1.0);
|
||||||
|
cdvolume = bgmvolume->value;
|
||||||
|
CDAudio_Resume ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CDAudio_GetState () != CD_PLAYING &&
|
||||||
|
CDAudio_GetState () != CD_PAUSED && playLooping)
|
||||||
|
CDAudio_Play (playTrack, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
CDAudio_Init (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (COM_CheckParm ("-nocdaudio"))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ((i = COM_CheckParm ("-cddev")) != 0 && i < com_argc - 1) {
|
||||||
|
strncpy (cd_dev, com_argv[i + 1], sizeof (cd_dev));
|
||||||
|
cd_dev[sizeof (cd_dev) - 1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cdp = CDopen (cd_dev, "r");
|
||||||
|
|
||||||
|
if (cdp == NULL) {
|
||||||
|
Con_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n",
|
||||||
|
cd_dev, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 100; i++)
|
||||||
|
remap[i] = i;
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
enabled = true;
|
||||||
|
|
||||||
|
Cmd_AddCommand ("cd", CD_f);
|
||||||
|
|
||||||
|
Con_Printf ("CD Audio Initialized\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDAudio_Shutdown (void)
|
||||||
|
{
|
||||||
|
if (!initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CDAudio_Stop ();
|
||||||
|
CDclose (cdp);
|
||||||
|
cdp = NULL;
|
||||||
|
initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end of file */
|
313
source/snd_sgi.c
Normal file
313
source/snd_sgi.c
Normal file
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
snd_sgi.c
|
||||||
|
|
||||||
|
sound support for sgi
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <dmedia/audio.h>
|
||||||
|
|
||||||
|
#include "qtypes.h"
|
||||||
|
#include "qargs.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "console.h"
|
||||||
|
|
||||||
|
static int snd_inited = 0;
|
||||||
|
static ALconfig alc;
|
||||||
|
static ALport alp;
|
||||||
|
|
||||||
|
static int tryrates[] = { 11025, 22050, 44100, 8000 };
|
||||||
|
|
||||||
|
static unsigned char *dma_buffer, *write_buffer;
|
||||||
|
static int bufsize;
|
||||||
|
static int wbufp;
|
||||||
|
static int framecount;
|
||||||
|
|
||||||
|
qboolean
|
||||||
|
SNDDMA_Init (void)
|
||||||
|
{
|
||||||
|
ALpv alpv;
|
||||||
|
int i;
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
alc = alNewConfig ();
|
||||||
|
|
||||||
|
if (!alc) {
|
||||||
|
Con_Printf ("Could not make an new sound config: %s\n",
|
||||||
|
alGetErrorString (oserror ()));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
shm = &sn;
|
||||||
|
shm->splitbuffer = 0;
|
||||||
|
|
||||||
|
/* get & probe settings */
|
||||||
|
/* sample format */
|
||||||
|
if (alSetSampFmt (alc, AL_SAMPFMT_TWOSCOMP) < 0) {
|
||||||
|
Con_Printf ("Could not sample format of default output to two's "
|
||||||
|
"complement\n");
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample bits */
|
||||||
|
s = getenv ("QUAKE_SOUND_SAMPLEBITS");
|
||||||
|
if (s)
|
||||||
|
shm->samplebits = atoi (s);
|
||||||
|
else if ((i = COM_CheckParm ("-sndbits")) != 0)
|
||||||
|
shm->samplebits = atoi (com_argv[i + 1]);
|
||||||
|
|
||||||
|
if (shm->samplebits != 16 && shm->samplebits != 8) {
|
||||||
|
alpv.param = AL_WORDSIZE;
|
||||||
|
|
||||||
|
if (alGetParams (AL_DEFAULT_OUTPUT, &alpv, 1) < 0) {
|
||||||
|
Con_Printf ("Could not get supported wordsize of default "
|
||||||
|
"output: %s\n", alGetErrorString (oserror ()));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alpv.value.i >= 16) {
|
||||||
|
shm->samplebits = 16;
|
||||||
|
} else {
|
||||||
|
if (alpv.value.i >= 8)
|
||||||
|
shm->samplebits = 8;
|
||||||
|
else {
|
||||||
|
Con_Printf ("Sound disabled since interface "
|
||||||
|
"doesn't even support 8 bit.");
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample rate */
|
||||||
|
s = getenv ("QUAKE_SOUND_SPEED");
|
||||||
|
if (s)
|
||||||
|
shm->speed = atoi (s);
|
||||||
|
else if ((i = COM_CheckParm ("-sndspeed")) != 0)
|
||||||
|
shm->speed = atoi (com_argv[i + 1]);
|
||||||
|
else {
|
||||||
|
alpv.param = AL_RATE;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof (tryrates) / sizeof (int); i++) {
|
||||||
|
alpv.value.ll = alDoubleToFixed (tryrates[i]);
|
||||||
|
|
||||||
|
if (alSetParams (AL_DEFAULT_OUTPUT, &alpv, 1) >= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= sizeof (tryrates) / sizeof (int)) {
|
||||||
|
Con_Printf ("Sound disabled since interface doesn't even "
|
||||||
|
"support a sample rate of %d\n", tryrates[i - 1]);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
shm->speed = tryrates[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* channels */
|
||||||
|
s = getenv ("QUAKE_SOUND_CHANNELS");
|
||||||
|
if (s)
|
||||||
|
shm->channels = atoi (s);
|
||||||
|
else if ((i = COM_CheckParm ("-sndmono")) != 0)
|
||||||
|
shm->channels = 1;
|
||||||
|
else if ((i = COM_CheckParm ("-sndstereo")) != 0)
|
||||||
|
shm->channels = 2;
|
||||||
|
else
|
||||||
|
shm->channels = 2;
|
||||||
|
|
||||||
|
/* set 'em */
|
||||||
|
|
||||||
|
/* channels */
|
||||||
|
while (shm->channels > 0) {
|
||||||
|
if (alSetChannels (alc, shm->channels) < 0) {
|
||||||
|
Con_Printf ("Unable to set number of channels to %d, trying half\n",
|
||||||
|
shm->channels);
|
||||||
|
shm->channels /= 2;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shm->channels <= 0) {
|
||||||
|
Con_Printf ("Sound disabled since interface doesn't even support 1 "
|
||||||
|
"channel\n");
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample rate */
|
||||||
|
alpv.param = AL_RATE;
|
||||||
|
alpv.value.ll = alDoubleToFixed (shm->speed);
|
||||||
|
|
||||||
|
if (alSetParams (AL_DEFAULT_OUTPUT, &alpv, 1) < 0) {
|
||||||
|
Con_Printf ("Could not set samplerate of default output to %d: %s\n",
|
||||||
|
shm->speed, alGetErrorString (oserror ()));
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set sizes of buffers relative to sizes of those for ** the 'standard'
|
||||||
|
frequency of 11025 ** ** use *huge* buffers since at least my indigo2
|
||||||
|
has enough ** to do to get sound on the way anyway */
|
||||||
|
bufsize = 32768 * (int) ((double) shm->speed / 11025.0);
|
||||||
|
|
||||||
|
dma_buffer = malloc (bufsize);
|
||||||
|
|
||||||
|
if (dma_buffer == NULL) {
|
||||||
|
Con_Printf ("Could not get %d bytes of memory for audio dma buffer\n",
|
||||||
|
bufsize);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
write_buffer = malloc (bufsize);
|
||||||
|
|
||||||
|
if (write_buffer == NULL) {
|
||||||
|
Con_Printf ("Could not get %d bytes of memory for audio write buffer\n",
|
||||||
|
bufsize);
|
||||||
|
free (dma_buffer);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample bits */
|
||||||
|
switch (shm->samplebits) {
|
||||||
|
case 24:
|
||||||
|
i = AL_SAMPLE_24;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
i = AL_SAMPLE_16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
i = AL_SAMPLE_8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alSetWidth (alc, i) < 0) {
|
||||||
|
Con_Printf ("Could not set wordsize of default output to %d: %s\n",
|
||||||
|
shm->samplebits, alGetErrorString (oserror ()));
|
||||||
|
free (write_buffer);
|
||||||
|
free (dma_buffer);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
alp = alOpenPort ("quakeforge", "w", alc);
|
||||||
|
|
||||||
|
if (!alp) {
|
||||||
|
Con_Printf ("Could not open sound port: %s\n",
|
||||||
|
alGetErrorString (oserror ()));
|
||||||
|
free (write_buffer);
|
||||||
|
free (dma_buffer);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
shm->soundalive = true;
|
||||||
|
shm->samples = bufsize / (shm->samplebits / 8);
|
||||||
|
shm->samplepos = 0;
|
||||||
|
shm->submission_chunk = 1;
|
||||||
|
shm->buffer = dma_buffer;
|
||||||
|
|
||||||
|
framecount = 0;
|
||||||
|
|
||||||
|
snd_inited = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SNDDMA_GetDMAPos (void)
|
||||||
|
{
|
||||||
|
/* Con_Printf("framecount: %d %d\n", (framecount * shm->channels) %
|
||||||
|
shm->samples, alGetFilled(alp)); */
|
||||||
|
shm->samplepos = ((framecount - alGetFilled (alp))
|
||||||
|
* shm->channels) % shm->samples;
|
||||||
|
return shm->samplepos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SNDDMA_Shutdown (void)
|
||||||
|
{
|
||||||
|
if (snd_inited) {
|
||||||
|
free (write_buffer);
|
||||||
|
free (dma_buffer);
|
||||||
|
alClosePort (alp);
|
||||||
|
alFreeConfig (alc);
|
||||||
|
snd_inited = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
SNDDMA_Submit
|
||||||
|
|
||||||
|
Send sound to device if buffer isn't really the dma buffer
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
SNDDMA_Submit (void)
|
||||||
|
{
|
||||||
|
int bsize;
|
||||||
|
int bytes, b;
|
||||||
|
unsigned char *p;
|
||||||
|
int idx;
|
||||||
|
int stop = paintedtime;
|
||||||
|
|
||||||
|
if (paintedtime < wbufp)
|
||||||
|
wbufp = 0; // reset
|
||||||
|
|
||||||
|
bsize = shm->channels * (shm->samplebits / 8);
|
||||||
|
bytes = (paintedtime - wbufp) * bsize;
|
||||||
|
|
||||||
|
if (!bytes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (bytes > bufsize) {
|
||||||
|
bytes = bufsize;
|
||||||
|
stop = wbufp + bytes / bsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = write_buffer;
|
||||||
|
idx = (wbufp * bsize) & (bufsize - 1);
|
||||||
|
|
||||||
|
for (b = bytes; b; b--) {
|
||||||
|
*p++ = dma_buffer[idx];
|
||||||
|
idx = (idx + 1) & (bufsize - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
wbufp = stop;
|
||||||
|
|
||||||
|
alWriteFrames (alp, write_buffer, bytes / bsize);
|
||||||
|
framecount += bytes / bsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end of file */
|
|
@ -55,13 +55,11 @@ ver_compare (const char *value, const char *reference)
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
valptr = value;
|
valptr = value;
|
||||||
while (*valptr && !isdigit (*valptr)) // Scan past any non-digit
|
while (*valptr && !isdigit ((int) *valptr)) // Scan past any non-digits
|
||||||
// chars
|
|
||||||
valptr++;
|
valptr++;
|
||||||
|
|
||||||
refptr = reference;
|
refptr = reference;
|
||||||
while (*refptr && !isdigit (*refptr)) // get past non-digits here
|
while (*refptr && !isdigit ((int) *refptr)) // get past non-digits
|
||||||
// too
|
|
||||||
refptr++;
|
refptr++;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -85,10 +83,10 @@ ver_compare (const char *value, const char *reference)
|
||||||
|
|
||||||
vl = rl = 0;
|
vl = rl = 0;
|
||||||
|
|
||||||
if (isdigit (*valptr))
|
if (isdigit ((int) *valptr))
|
||||||
vl = strtol (value, (char **) &value, 10);
|
vl = strtol (value, (char **) &value, 10);
|
||||||
|
|
||||||
if (isdigit (*refptr))
|
if (isdigit ((int) *refptr))
|
||||||
rl = strtol (reference, (char **) &reference, 10);
|
rl = strtol (reference, (char **) &reference, 10);
|
||||||
|
|
||||||
if (vl != rl)
|
if (vl != rl)
|
||||||
|
|
|
@ -31,13 +31,13 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include <string.h>
|
||||||
# include "winquake.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
#include <string.h>
|
#ifdef _WIN32
|
||||||
|
# include "winquake.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
@ -147,9 +147,11 @@ VID_SetPalette (unsigned char *palette)
|
||||||
b = pal[2];
|
b = pal[2];
|
||||||
pal += 3;
|
pal += 3;
|
||||||
|
|
||||||
// v = (255<<24) + (r<<16) + (g<<8) + (b<<0);
|
#ifdef WORDS_BIGENDIAN
|
||||||
// v = (255<<0) + (r<<8) + (g<<16) + (b<<24);
|
v = (255 << 0) + (r << 24) + (g << 16) + (b << 8);
|
||||||
|
#else
|
||||||
v = (255 << 24) + (r << 0) + (g << 8) + (b << 16);
|
v = (255 << 24) + (r << 0) + (g << 8) + (b << 16);
|
||||||
|
#endif
|
||||||
*table++ = v;
|
*table++ = v;
|
||||||
}
|
}
|
||||||
d_8to24table[255] = 0; // 255 is transparent
|
d_8to24table[255] = 0; // 255 is transparent
|
||||||
|
@ -275,9 +277,7 @@ Tdfx_Init8bitPalette (void)
|
||||||
GLubyte table[256][4];
|
GLubyte table[256][4];
|
||||||
QF_gl3DfxSetPaletteEXT qgl3DfxSetPaletteEXT = NULL;
|
QF_gl3DfxSetPaletteEXT qgl3DfxSetPaletteEXT = NULL;
|
||||||
|
|
||||||
if (!
|
if (!(qgl3DfxSetPaletteEXT = QFGL_ExtensionAddress ("gl3DfxSetPaletteEXT"))) {
|
||||||
(qgl3DfxSetPaletteEXT =
|
|
||||||
QFGL_ExtensionAddress ("gl3DfxSetPaletteEXT"))) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ VID_UnlockBuffer (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
D_BeginDirectRect (int x, int y, byte * pbitmap, int width, int height)
|
D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue