@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include "snd_codec.h"
# include "snd_codec.h"
# include "bgmusic.h"
# include "bgmusic.h"
# ifndef USE_FMOD
static void S_Play ( void ) ;
static void S_Play ( void ) ;
static void S_PlayVol ( void ) ;
static void S_PlayVol ( void ) ;
static void S_SoundList ( void ) ;
static void S_SoundList ( void ) ;
@ -43,7 +45,6 @@ channel_t snd_channels[MAX_CHANNELS];
int total_channels ;
int total_channels ;
static int snd_blocked = 0 ;
static int snd_blocked = 0 ;
static qboolean snd_initialized = false ;
static dma_t sn ;
static dma_t sn ;
volatile dma_t * shm = NULL ;
volatile dma_t * shm = NULL ;
@ -61,6 +62,7 @@ int paintedtime; // sample PAIRS
int s_rawend ;
int s_rawend ;
portable_samplepair_t s_rawsamples [ MAX_RAW_SAMPLES ] ;
portable_samplepair_t s_rawsamples [ MAX_RAW_SAMPLES ] ;
# endif / / USE_FMOD
# define MAX_SFX 1024
# define MAX_SFX 1024
static sfx_t * known_sfx = NULL ; / / hunk allocated [ MAX_SFX ]
static sfx_t * known_sfx = NULL ; / / hunk allocated [ MAX_SFX ]
@ -69,6 +71,7 @@ static int num_sfx;
static sfx_t * ambient_sfx [ NUM_AMBIENTS ] ;
static sfx_t * ambient_sfx [ NUM_AMBIENTS ] ;
static qboolean sound_started = false ;
static qboolean sound_started = false ;
static qboolean snd_initialized = false ;
cvar_t bgmvolume = { " bgmvolume " , " 1 " , CVAR_ARCHIVE } ;
cvar_t bgmvolume = { " bgmvolume " , " 1 " , CVAR_ARCHIVE } ;
cvar_t sfxvolume = { " volume " , " 0.7 " , CVAR_ARCHIVE } ;
cvar_t sfxvolume = { " volume " , " 0.7 " , CVAR_ARCHIVE } ;
@ -95,6 +98,7 @@ static cvar_t snd_noextraupdate = {"snd_noextraupdate", "0", CVAR_NONE};
static cvar_t snd_show = { " snd_show " , " 0 " , CVAR_NONE } ;
static cvar_t snd_show = { " snd_show " , " 0 " , CVAR_NONE } ;
static cvar_t _snd_mixahead = { " _snd_mixahead " , " 0.1 " , CVAR_ARCHIVE } ;
static cvar_t _snd_mixahead = { " _snd_mixahead " , " 0.1 " , CVAR_ARCHIVE } ;
# ifndef USE_FMOD
static void S_SoundInfo_f ( void )
static void S_SoundInfo_f ( void )
{
{
@ -153,6 +157,7 @@ void S_Startup (void)
}
}
}
}
# endif / / USE_FMOD
/*
/*
= = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = =
@ -188,11 +193,13 @@ void S_Init (void)
Con_Printf ( " \n Sound Initialization \n " ) ;
Con_Printf ( " \n Sound Initialization \n " ) ;
# ifndef USE_FMOD
Cmd_AddCommand ( " play " , S_Play ) ;
Cmd_AddCommand ( " play " , S_Play ) ;
Cmd_AddCommand ( " playvol " , S_PlayVol ) ;
Cmd_AddCommand ( " playvol " , S_PlayVol ) ;
Cmd_AddCommand ( " stopsound " , S_StopAllSoundsC ) ;
Cmd_AddCommand ( " stopsound " , S_StopAllSoundsC ) ;
Cmd_AddCommand ( " soundlist " , S_SoundList ) ;
Cmd_AddCommand ( " soundlist " , S_SoundList ) ;
Cmd_AddCommand ( " soundinfo " , S_SoundInfo_f ) ;
Cmd_AddCommand ( " soundinfo " , S_SoundInfo_f ) ;
# endif / / USE_FMOD
i = COM_CheckParm ( " -sndspeed " ) ;
i = COM_CheckParm ( " -sndspeed " ) ;
if ( i & & i < com_argc - 1 )
if ( i & & i < com_argc - 1 )
@ -212,10 +219,12 @@ void S_Init (void)
Con_Printf ( " loading all sounds as 8bit \n " ) ;
Con_Printf ( " loading all sounds as 8bit \n " ) ;
}
}
# ifndef USE_FMOD
Cvar_SetCallback ( & sfxvolume , SND_Callback_sfxvolume ) ;
Cvar_SetCallback ( & sfxvolume , SND_Callback_sfxvolume ) ;
Cvar_SetCallback ( & snd_filterquality , & SND_Callback_snd_filterquality ) ;
Cvar_SetCallback ( & snd_filterquality , & SND_Callback_snd_filterquality ) ;
SND_InitScaletable ( ) ;
SND_InitScaletable ( ) ;
# endif / / USE_FMOD
known_sfx = ( sfx_t * ) Hunk_AllocName ( MAX_SFX * sizeof ( sfx_t ) , " sfx_t " ) ;
known_sfx = ( sfx_t * ) Hunk_AllocName ( MAX_SFX * sizeof ( sfx_t ) , " sfx_t " ) ;
num_sfx = 0 ;
num_sfx = 0 ;
@ -238,6 +247,7 @@ void S_Init (void)
S_StopAllSounds ( true ) ;
S_StopAllSounds ( true ) ;
}
}
# ifndef USE_FMOD
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/ / Shutdown sound engine
/ / Shutdown sound engine
@ -1034,6 +1044,7 @@ static void S_SoundList (void)
Con_Printf ( " %i sounds, %i bytes \n " , num_sfx , total ) ; / / johnfitz - - added count
Con_Printf ( " %i sounds, %i bytes \n " , num_sfx , total ) ; / / johnfitz - - added count
}
}
# endif / / USE_FMOD
void S_LocalSound ( const char * name )
void S_LocalSound ( const char * name )
{
{
@ -1067,4 +1078,3 @@ void S_BeginPrecaching (void)
void S_EndPrecaching ( void )
void S_EndPrecaching ( void )
{
{
}
}