From 227b43b11960c0dbcb6980d95cf4ac52bb52bbdc Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Mon, 15 Mar 2004 12:50:39 +0000 Subject: [PATCH] - Added sdl and solaris sound drivers to the build. - Don't ship CVS directories in the dist in docs directory. --- Makefile.am | 4 +-- configure.in | 71 +++++++++++++++++++++----------------------- docs/.gitignore | 2 ++ docs/Makefile.am | 3 ++ docs/ctf/.gitignore | 2 ++ docs/ctf/Makefile.am | 1 + src/Makefile.am | 26 +++++++++++++--- src/snd_dma.c | 2 ++ src/snd_loc.h | 2 ++ src/snd_sdl.c | 26 +++++++++++----- src/snd_solaris.c | 36 +++++++++++----------- 11 files changed, 106 insertions(+), 69 deletions(-) create mode 100644 docs/.gitignore create mode 100644 docs/Makefile.am create mode 100644 docs/ctf/.gitignore create mode 100644 docs/ctf/Makefile.am diff --git a/Makefile.am b/Makefile.am index 1a99d0c..97d7886 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,8 @@ # $Id$ -SUBDIRS = src data +SUBDIRS = src data docs EXTRA_DIST = quake2.dsp quake2.dsw quake2.mak \ quake2.spec \ HACKING NEWS THANKS TODO \ - baseq2 bsd docs irix null rhapsody solaris win32 + baseq2 bsd irix null rhapsody solaris win32 diff --git a/configure.in b/configure.in index a609632..8abde58 100644 --- a/configure.in +++ b/configure.in @@ -296,6 +296,11 @@ if test "x$enable_sdl" != xno; then HAVE_SDL=no) AC_SUBST(HAVE_SDL) fi +if test "x$HAVE_SDL" = xyes ; then + SNDDRIVERS="$SNDDRIVERS snd_sdl.la" + BUILD_SNDSDL="yes" +fi +AM_CONDITIONAL(BUILD_SNDSDL, test "x$BUILD_SNDSDL" = xyes) dnl ------------------------ dnl Check for MPG123 library @@ -320,6 +325,7 @@ dnl ------------------ dnl Check for ossaudio dnl ------------------ +HAVE_OSS="yes" OSS_CFLAGS="" OSS_LIBS="" AC_CHECK_LIB([ossaudio], [_oss_ioctl], [OSS_LIBS="-lossaudio"]) @@ -353,7 +359,7 @@ else if test "x$ac_cv_header_soundcard_h" = "xyes"; then fi fi AC_SUBST(HAVE_AFMT_S16_NE) -AM_CONDITIONAL(BUILD_OSS, test x = x) +AM_CONDITIONAL(BUILD_SNDOSS, test "x$HAVE_OSS" = xyes) SNDDRIVERS="$SNDDRIVERS snd_oss.la" dnl --------------- @@ -415,7 +421,7 @@ if test "x${ac_with_ao}" != xno ; then else HAVE_AO=disabled fi -AM_CONDITIONAL(BUILD_AO, test "x$HAVE_AO" = xyes) +AM_CONDITIONAL(BUILD_SNDAO, test "x$HAVE_AO" = xyes) dnl -------------- dnl Check for ALSA @@ -476,7 +482,24 @@ if test "x${ac_with_alsa}" != xno ; then else HAVE_ALSA=disabled fi -AM_CONDITIONAL(BUILD_ALSA, test "x$HAVE_ALSA" = xyes) +AM_CONDITIONAL(BUILD_SNDALSA, test "x$HAVE_ALSA" = xyes) + +dnl ----------------------- +dnl Check for Solaris audio +dnl ----------------------- + +SOLARIS_CFLAGS="" +SOLARIS_LIBS="" +AC_CHECK_HEADER([sys/audioio.h]) +HAVE_SOLARIS="$ac_cv_header_sys_audioio_h" +AC_SUBST(SOLARIS_CFLAGS) +AC_SUBST(SOLARIS_LIBS) +if test "x$HAVE_SOLARIS" = xyes ; then + SNDDRIVERS="$SNDDRIVERS snd_solaris.la" + BUILD_SNDSOLARIS="yes" +fi +AM_CONDITIONAL(BUILD_SNDSOLARIS, test "x$BUILD_SNDSOLARIS" = xyes) + dnl ------------------------------------------------------------- dnl Checks for typedefs, structures, and compiler characteristics @@ -648,35 +671,6 @@ case "${host}" in esac AM_CONDITIONAL(ASM_ARCH, test "$ASM_ARCH" = "yes") -dnl ------------------- -dnl Checks for SDL-only platforms -dnl ------------------- - -AC_MSG_CHECKING(if SDL sound can be used instead of native drivers) -case "${host}" in - *-sun-solaris*) - AC_MSG_RESULT(yes) - AC_MSG_WARN(Defaulting to SDL sound under Solaris due to temporary lack of native support.) - BUILD_SDLQUAKE2=yes - AC_DEFINE(BUILD_SDLQUAKE2, 1, [Define this if you want SDL sound instead of native drivers]) - ;; - i?86-*-*) - AC_MSG_RESULT(yes) - AC_MSG_CHECKING(if SDL sound will be used) - AC_ARG_ENABLE(sdlsound, - [ --enable-sdlsound enable SDL sound instead of native drivers ], - AC_MSG_RESULT(yes) - AC_DEFINE(BUILD_SDLQUAKE2, 1, [Define this if you want SDL sound instead of native drivers]) - BUILD_SDLQUAKE2=yes, - AC_MSG_RESULT(no) - ) - ;; - *) - AC_MSG_RESULT(no) - ;; -esac -AM_CONDITIONAL(BUILD_SDLQUAKE2, test "x$BUILD_SDLQUAKE2" = "xyes") - dnl --------------------------------------------------- dnl Check if the xatrix and rogue sources are available dnl --------------------------------------------------- @@ -790,6 +784,8 @@ AC_CONFIG_FILES([ data/Makefile data/pixmaps/Makefile data/baseq2/Makefile + docs/Makefile + docs/ctf/Makefile quake2.spec ]) AC_OUTPUT @@ -836,8 +832,8 @@ dnl AC_MSG_RESULT([ Framebuffer: ..... $HAVE_FB]) dnl AC_MSG_RESULT([ AAlib: ........... $HAVE_AA]) AC_MSG_RESULT([ Sound drivers: ..... ${SNDDRIVERS- none}]) -AC_MSG_RESULT([ OSS .............. yes]) -AC_MSG_RESULT([ ALSA ............. $HAVE_ALSA]) +AC_MSG_RESULT([ OSS: ............. $HAVE_OSS]) +AC_MSG_RESULT([ ALSA: ............ $HAVE_ALSA]) if test "x${ac_with_alsa}" = xyes ; then if test "x${HAVE_ALSA}" != xyes ; then AC_MSG_RESULT([ @@ -849,7 +845,7 @@ if test "x${ac_with_alsa}" = xyes ; then fi fi fi -AC_MSG_RESULT([ libao ............ $HAVE_AO]) +AC_MSG_RESULT([ libao: ........... $HAVE_AO]) if test "x${ac_with_ao}" = xyes ; then if test "x${HAVE_AO}" != xyes ; then AC_MSG_RESULT([ @@ -861,6 +857,7 @@ if test "x${ac_with_ao}" = xyes ; then fi fi fi +AC_MSG_RESULT([ solaris: ......... $HAVE_SOLARIS]) AC_MSG_RESULT([ Installation directories: @@ -872,8 +869,8 @@ AC_MSG_RESULT([ Type 'make' to compile Quake2Forge. Type 'make install' to install Quake2Forge. Game data needs to be -installed in the game data directory shown above, before the game -can be played. See the file README in the top directory of the source +installed in the game data directory shown above before the game can +be played. See the file README in the top directory of the source for more details. Happy fragging! diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..aebce3c --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = ctf + +EXTRA_DIST = README.* *.txt diff --git a/docs/ctf/.gitignore b/docs/ctf/.gitignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/docs/ctf/.gitignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/docs/ctf/Makefile.am b/docs/ctf/Makefile.am new file mode 100644 index 0000000..d70b0df --- /dev/null +++ b/docs/ctf/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = *.gif *.html diff --git a/src/Makefile.am b/src/Makefile.am index 8c1b782..95a55c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,8 @@ bin_PROGRAMS = quake2 pkglib_LTLIBRARIES = @VID_REFS@ @SNDDRIVERS@ EXTRA_LTLIBRARIES = ref_soft.la ref_softx.la ref_softsdl.la \ ref_glx.la ref_sdlgl.la ref_tdfx.la \ - snd_oss.la snd_alsa.la snd_ao.la + snd_oss.la snd_alsa.la snd_ao.la snd_sdl.la \ + snd_solaris.la # Common source files REF_GL_COMMON = q_sh.c q_shared.c q_glob.c qgl.c \ @@ -80,12 +81,13 @@ EXTRA_ref_softx_la_SOURCES = rw_x11.c EXTRA_quake2_SOURCES = snd_mixa.S cd_sdl.c snd_sdl.c snd_dma.c \ snd_mix.c snd_mem.c cd.c \ snd_oss.c snd_ao.c snd_alsa.c + snd_solaris.c quake2_CFLAGS = $(std_cflags) quake2_LDADD = @DL_LIBS@ @SYSTEM_LIBS@ -lm # oss sound driver -if BUILD_OSS +if BUILD_SNDOSS snd_oss_la_SOURCES = snd_oss.c snd_oss_la_CFLAGS = $(std_cflags) -fPIC @OSS_CFLAGS@ snd_oss_la_LIBADD = @OSS_LIBS@ @@ -93,7 +95,7 @@ snd_oss_la_LDFLAGS = $(module_ldflags) endif # alsa sound driver -if BUILD_ALSA +if BUILD_SNDALSA snd_alsa_la_SOURCES = snd_alsa.c snd_alsa_la_CFLAGS = $(std_cflags) -fPIC @ALSA_CFLAGS@ snd_alsa_la_LIBADD = @ALSA_LIBS@ @@ -101,13 +103,29 @@ snd_alsa_la_LDFLAGS = $(module_ldflags) endif # libao sound driver -if BUILD_AO +if BUILD_SNDAO snd_ao_la_SOURCES = snd_ao.c snd_ao_la_CFLAGS = $(std_cflags) -fPIC @AO_CFLAGS@ snd_ao_la_LIBADD = @AO_LIBS@ snd_ao_la_LDFLAGS = $(module_ldflags) endif +# sdl sound driver +if BUILD_SNDSDL +snd_sdl_la_SOURCES = snd_sdl.c +snd_sdl_la_CFLAGS = $(std_cflags) -fPIC @SDL_CFLAGS@ +snd_sdl_la_LIBADD = @SDL_LIBS@ +snd_sdl_la_LDFLAGS = $(module_ldflags) +endif + +# solaris sound driver +if BUILD_SNDSOLARIS +snd_solaris_la_SOURCES = snd_solaris.c +snd_solaris_la_CFLAGS = $(std_cflags) -fPIC +snd_solaris_la_LIBADD = @SOLARIS_LIBS@ +snd_solaris_la_LDFLAGS = $(module_ldflags) +endif + # ref_glx if BUILD_GLX ref_glx_la_SOURCES = $(REF_GL_COMMON) gl_glx.c diff --git a/src/snd_dma.c b/src/snd_dma.c index 145ab7d..2d1e510 100644 --- a/src/snd_dma.c +++ b/src/snd_dma.c @@ -201,7 +201,9 @@ void S_Init (void) si.speed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE); si.channels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE); si.device = Cvar_Get("snddevice", "/dev/dsp", CVAR_ARCHIVE); + si.s_khz = Cvar_Get("s_khz", "0", CVAR_ARCHIVE); si.Com_Printf = Com_Printf; + si.S_PaintChannels = S_PaintChannels; if (!SNDDMA_Init(&si)) return; diff --git a/src/snd_loc.h b/src/snd_loc.h index d0306f0..179dfd2 100644 --- a/src/snd_loc.h +++ b/src/snd_loc.h @@ -144,8 +144,10 @@ struct sndinfo { cvar_t * speed; cvar_t * channels; cvar_t * device; + cvar_t * s_khz; void (*Com_Printf)(char * fmt, ...); + void (*S_PaintChannels)(int); }; diff --git a/src/snd_sdl.c b/src/snd_sdl.c index 8fe0ed8..d68f543 100644 --- a/src/snd_sdl.c +++ b/src/snd_sdl.c @@ -25,6 +25,10 @@ $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "client.h" @@ -33,6 +37,8 @@ static int snd_inited; static dma_t *shm; +struct sndinfo * si; + static void paint_audio (void *unused, Uint8 * stream, int len) { @@ -40,15 +46,20 @@ paint_audio (void *unused, Uint8 * stream, int len) shm->buffer = stream; shm->samplepos += len / (shm->samplebits / 4); // Check for samplepos overflow? - S_PaintChannels (shm->samplepos); + si->S_PaintChannels (shm->samplepos); } } qboolean -SNDDMA_Init (void) +SNDDMA_Init (struct sndinfo * s) { SDL_AudioSpec desired, obtained; int desired_bits, freq; + + if (snd_inited) + return 1; + + snd_inited = 0; if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { @@ -61,12 +72,13 @@ SNDDMA_Init (void) return 0; } } + + si = s; - snd_inited = 0; - desired_bits = (Cvar_Get("sndbits", "16", CVAR_ARCHIVE))->value; + desired_bits = si->bits->value; /* Set up the desired format */ - freq = (Cvar_Get("s_khz", "0", CVAR_ARCHIVE))->value; + freq = si->s_khz->value; if (freq == 44) desired.freq = 44100; else if (freq == 22) @@ -88,7 +100,7 @@ SNDDMA_Init (void) Com_Printf ("Unknown number of audio bits: %d\n", desired_bits); return 0; } - desired.channels = (Cvar_Get("sndchannels", "2", CVAR_ARCHIVE))->value; + desired.channels = si->channels->value; if (desired.freq == 44100) desired.samples = 2048; @@ -133,7 +145,7 @@ SNDDMA_Init (void) SDL_PauseAudio (0); /* Fill the audio DMA information block */ - shm = &dma; + shm = si->dma; shm->samplebits = (obtained.format & 0xFF); shm->speed = obtained.freq; shm->channels = obtained.channels; diff --git a/src/snd_solaris.c b/src/snd_solaris.c index 5501478..56e2676 100644 --- a/src/snd_solaris.c +++ b/src/snd_solaris.c @@ -17,6 +17,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -40,16 +45,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int audio_fd = -1; static int snd_inited; -static cvar_t *sndbits; -static cvar_t *sndspeed; -static cvar_t *sndchannels; -static cvar_t *snddevice; - - static int tryrates[] = { 11025, 22051, 44100, 8000 }; #define QSND_NUM_CHUNKS 2 +static struct sndinfo * si; + /* ================== SNDDMA_Init @@ -59,7 +60,7 @@ Returns false if nothing is found. Returns true and fills in the "dma" structure with information for the mixer. ================== */ -qboolean SNDDMA_Init(void) +qboolean SNDDMA_Init(struct sndinfo * s) { int i; int samples; @@ -68,36 +69,33 @@ qboolean SNDDMA_Init(void) if (snd_inited) return 1; - if (!snddevice) { - sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE); - sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE); - sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE); - snddevice = Cvar_Get("snddevice", "/dev/audio", CVAR_ARCHIVE); - } + snd_inited = 0; + + si = s; // open /dev/audio if (audio_fd < 0) { - audio_fd = open(snddevice->string, O_WRONLY); + audio_fd = open(si->device->string, O_WRONLY); if (audio_fd < 0) { - Com_Printf("Could not open %s: %s\n", snddevice->string, strerror(errno)); + Com_Printf("Could not open %s: %s\n", si->device->string, strerror(errno)); return 0; } } // set sample bits & speed - if ((int)sndspeed->value > 0) { + if ((int)si->speed->value > 0) { AUDIO_INITINFO(&au_info); - au_info.play.precision = (int)sndbits->value; + au_info.play.precision = (int)si->bits->value; au_info.play.encoding = ( au_info.play.precision == 8 ? AUDIO_ENCODING_LINEAR8 : AUDIO_ENCODING_LINEAR ); - au_info.play.sample_rate = (int)sndspeed->value; + au_info.play.sample_rate = (int)si->speed->value; au_info.play.channels = (int)sndchannels->value; if (ioctl(audio_fd, AUDIO_SETINFO, &au_info) == -1) { @@ -108,7 +106,7 @@ qboolean SNDDMA_Init(void) for (i=0 ; ivalue; + au_info.play.precision = (int)si->bits->value; au_info.play.encoding = ( au_info.play.precision == 8 ? AUDIO_ENCODING_LINEAR8