diff --git a/libs/audio/targets/Makefile.am b/libs/audio/targets/Makefile.am index 4e6abd3f1..2e6ecdb1f 100644 --- a/libs/audio/targets/Makefile.am +++ b/libs/audio/targets/Makefile.am @@ -9,33 +9,34 @@ sound_ASM= snd_mixa.S # # ... Audio targets # +common_sound_files= snd_common.c snd_dma.c snd_mem.c snd_mix.c if SNDTYPE_SDL -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sdl.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_sdl.c $(sound_ASM) endif if SNDTYPE_ALSA_0_5 -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_alsa_0_5.c $(sound_ASM) endif if SNDTYPE_ALSA_0_9 -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_9.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_alsa_0_9.c $(sound_ASM) endif # No idea what this is. it's in configure.in though... #if SNDTYPE_MME -#libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_mme.c $(sound_ASM) +#libQFsound_la_SOURCES= $(common_sound_files) snd_mme.c $(sound_ASM) #endif if SNDTYPE_OSS -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_oss.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_oss.c $(sound_ASM) endif if SNDTYPE_SGI -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sgi.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_sgi.c $(sound_ASM) endif if SNDTYPE_SUN -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sun.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_sun.c $(sound_ASM) endif if SNDTYPE_WIN32 -libQFsound_la_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_win.c $(sound_ASM) +libQFsound_la_SOURCES= $(common_sound_files) snd_win.c $(sound_ASM) endif if SNDTYPE_NULL -libQFsound_la_SOURCES= snd_null.c +libQFsound_la_SOURCES= snd_common.c snd_null.c endif LIBLIST = libQFsound.la @LIBRARY_SEARCH_PATH@ diff --git a/libs/audio/targets/snd_common.c b/libs/audio/targets/snd_common.c new file mode 100644 index 000000000..50a96e2f6 --- /dev/null +++ b/libs/audio/targets/snd_common.c @@ -0,0 +1,49 @@ +/* + snd_null.c + + include this instead of all the other snd_* files to have no sound + code whatsoever + + Copyright (C) 1996-1997 Id Software, Inc. + Copyright (C) 1999,2000 contributors of the QuakeForge project + Please see the file "AUTHORS" for a list of contributors + + 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$ +*/ + +#include "QF/qtypes.h" +#include "QF/sound.h" + +// ======================================================================= +// Various variables also defined in snd_dma.c +// FIXME - should be put in one place +// ======================================================================= +channel_t channels[MAX_CHANNELS]; +int total_channels; +volatile dma_t *shm = 0; +cvar_t *loadas8bit; +int paintedtime; // sample PAIRS +qboolean snd_initialized = false; + +cvar_t *bgmvolume; +cvar_t *volume; +cvar_t *snd_interp; + diff --git a/libs/audio/targets/snd_dma.c b/libs/audio/targets/snd_dma.c index fc40cc207..9a56da641 100644 --- a/libs/audio/targets/snd_dma.c +++ b/libs/audio/targets/snd_dma.c @@ -65,16 +65,16 @@ void S_StopAllSoundsC (void); // Internal sound data & structures // ======================================================================= -channel_t channels[MAX_CHANNELS]; -int total_channels; +extern channel_t channels[MAX_CHANNELS]; +extern int total_channels; extern double host_frametime; // From host.h int snd_blocked = 0; static qboolean snd_ambient = 1; -qboolean snd_initialized = false; +extern qboolean snd_initialized; // pointer should go away -volatile dma_t *shm = 0; +extern volatile dma_t *shm; volatile dma_t sn; vec3_t listener_origin; @@ -84,7 +84,7 @@ vec3_t listener_up; vec_t sound_nominal_clip_dist = 1000.0; int soundtime; // sample PAIRS -int paintedtime; // sample PAIRS +extern int paintedtime; // sample PAIRS #define MAX_SFX 512 @@ -98,8 +98,8 @@ int desired_bits = 16; int sound_started = 0; -cvar_t *bgmvolume; -cvar_t *volume; +extern cvar_t *bgmvolume; +extern cvar_t *volume; cvar_t *snd_device; cvar_t *snd_rate; @@ -107,12 +107,12 @@ cvar_t *snd_bits; cvar_t *snd_stereo; cvar_t *nosound; cvar_t *precache; -cvar_t *loadas8bit; +extern cvar_t *loadas8bit; cvar_t *ambient_level; cvar_t *ambient_fade; cvar_t *snd_noextraupdate; cvar_t *snd_show; -cvar_t *snd_interp; +extern cvar_t *snd_interp; cvar_t *snd_phasesep; cvar_t *snd_volumesep; cvar_t *_snd_mixahead; diff --git a/libs/audio/targets/snd_null.c b/libs/audio/targets/snd_null.c index 7ac898d05..179e6ea83 100644 --- a/libs/audio/targets/snd_null.c +++ b/libs/audio/targets/snd_null.c @@ -36,16 +36,16 @@ // Various variables also defined in snd_dma.c // FIXME - should be put in one place // ======================================================================= -channel_t channels[MAX_CHANNELS]; -int total_channels; -volatile dma_t *shm = 0; -cvar_t *loadas8bit; -int paintedtime; // sample PAIRS -qboolean snd_initialized = false; +extern channel_t channels[MAX_CHANNELS]; +extern int total_channels; +extern volatile dma_t *shm; +extern cvar_t *loadas8bit; +extern int paintedtime; // sample PAIRS +extern qboolean snd_initialized; -cvar_t *bgmvolume; -cvar_t *volume; -cvar_t *snd_interp; +extern cvar_t *bgmvolume; +extern cvar_t *volume; +extern cvar_t *snd_interp; void