integer overflow as observed in the warpspasm mod depending on
the volume level. so, moved the left shifting to left/right
volume before the multiplication.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@401 af15c1b1-3010-417e-b628-4374ebc0bcbd
DEFAULT_SOUND_PACKET_VOLUME and DEFAULT_SOUND_PACKET_ATTENUATION
from sound.h to protocol.h. remove unused gamealive, soundalive
and splitbuffer members from the dma_t structure. make SNDDMA_Init()
to take a dma_t* parameter and make sn static to snd_dma.c. copy
over LordHavoc's S_StartSound skip calculation fixes from uhexen2.
make many functions/data static to their respective files. many
whitespace/formatting clean-ups.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@356 af15c1b1-3010-417e-b628-4374ebc0bcbd
* snd_mix.c: Increased PAINTBUFFER_SIZE from 512 to 2048.
* snd_mix.c: snd_vol is static now. it is calculated in S_PaintChannels and
only used in SND_PaintChannelFrom16. all its other uses are removed from
Snd_WriteLinearBlastStereo16, S_TransferStereo16, S_TransferPaintBuffer.
The way it was, the sound volume was applied to the whole final contents
of the paint buffer, but with this new quake2+ way we can add raw samples
to the paint buffer with its own volume, such as bgmvolume. However, this
makes the snd_scaletable to be recalculated everytime the sfxvolume is,
changed, therefore it is adjusted that way to incorporate sfxvolume.
* snd_mix.c: In S_PaintChannels, check against s_rawend and copy from the
streaming sound source if necessary.
* snd_dma.c: Added old_volume to detect sfxvolume changes. Made S_Update to
compare it to sfxvolume.value and call SND_InitScaletable() if it changed.
* snd_dma.c: Add new globals s_rawsamples and s_rawend. Reset s_rawend to 0
in S_ClearBuffer. Add new function S_RawSamples, adapted from quake2 with
its 8 bit stereo playback fixed.
* snd_dma.c (S_FileExtension): Add new function which returns the given
sound file's extension including the dot, or NULL.
* q_sound.h: Add new macro MAX_RAW_SAMPLES, defined as 8192. Add externs
for new globals s_rawsamples and s_rawend. Add prototype for the new
S_RawSamples and S_FileExtension functions.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@355 af15c1b1-3010-417e-b628-4374ebc0bcbd
sound_nominal_clip_dist and made it into a macro in snd_dma.c.
snd_dma.c: general whitespace and formatting cleanup.
(S_StaticSound): Explicitly cast vol to int when assigning it to ss->master_vol.
(S_UpdateAmbientSounds): changed the type of vol from float to int. used int
casts in its calculations. added explicit int casts when assigning values to
chan->master_vol.
(S_Update_): added explicit unsigned int casts in endtime calculations.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@181 af15c1b1-3010-417e-b628-4374ebc0bcbd
(DWORD): Deleted macro.
(S_TransferStereo16): Removed unnecessary pbuf pointer and used shm-> buffer
directly.
(S_TransferPaintBuffer): Removed unnecessary pbuf pointer and used shm-> buffer
directly. Removed the shadowing instance of snd_vol and used the global var.
(S_PaintChannels): Replaced Q_memset with memset.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@179 af15c1b1-3010-417e-b628-4374ebc0bcbd
gcc-4.1 and -O1 and higher From Kevin Shanahan (Tyrann). although the bug is
fixed in gcc, it is safer to have this workaround here.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@70 af15c1b1-3010-417e-b628-4374ebc0bcbd
cvar.h, draw.h, gl_draw.c, gl_fog.c, gl_mesh.c, gl_model.c, gl_model.h,
gl_rmain.c, gl_rmisc.c, gl_screen.c, gl_sky.c, gl_texmgr.c, glquake.h,
host.c, keys.c, keys.h, main.c, menu.c, menu.h, pr_cmds.c, quakedef.h,
r_alias.c, r_brush.c, r_part.c, r_sprite.c, r_world.c, sbar.c, sbar.h,
screen.h, snd_dma.c, snd_mem.c, snd_mix.c, sv_main.c, sys_sdl.c, vid.h,
view.h, world.c, world.h: Loads of warning fixes about missing function
prototypes, missing parens around &, missing braces leading to ambiguous
else statements and unused and uninitialized variables. There are still a
couple of unitialised variables here and there, but not much. The warnings
about strict aliasing violations need taking care of.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@21 af15c1b1-3010-417e-b628-4374ebc0bcbd