Commit Graph

28 Commits

Author SHA1 Message Date
Ozkan Sezer f86f1595f3 minor error messages / whitespace tidy-up & small stuff. 2022-04-22 17:50:02 +03:00
Eric Wasylishen 35631f4b02 snd_dma.c: raise MAX_SFX to 1024, for the upcoming arcadim mod.
Uses only 36k extra of hunk memory, less for 32-bit builds, so shouldn't have any negative effects.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1266 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-12-22 06:22:29 +00:00
Ozkan Sezer b9032b7815 copyright years, general tidy-up, remove unused d_ifacea.h.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1059 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 08:55:46 +00:00
Eric Wasylishen 931d4e9396 sfx lowpass filter patch
cvar changes:

The "sndspeed" cvar / "-sndspeed" command-line option now control whether the low-pass filter is applied. If it's set to 11025 you get the low-pass filter, otherwise it's not used.

New "snd_mixspeed" cvar (and the "-mixspeed" command-line option); these default to 44100 and just control the sample rate we request from SDL. Not archived.

New “snd_filterquality” cvar, value can be 1-5. Not archived. The “5” setting closely matches the Windows resampler, and the “1” setting closely matches the OS X resampler. The default depends on the OS, “5” is used on windows builds, otherwise “1”, because I wanted the sfx to sound the same as they do with 0.85.9 on each platform. TODO is checking if a setting other than 1 sounds closer to the system resampler on linux (though it probably depends on the distro).

The lowpass filter is only used for sndspeed=11025 and snd_mixspeed=44100, though these are the defaults.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@952 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-05 05:40:34 +00:00
Ozkan Sezer 7b589b31a6 updated snd bits from uhexen2. added signed 8 bit format support
to the mixer.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@688 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-06-25 12:50:09 +00:00
Ozkan Sezer 5c87f99ad5 removed the SNDDMA_GetSamples() call from snd_dma.c:GetSoundtime() for solaris
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@677 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-05-30 09:00:12 +00:00
Ozkan Sezer eb09523d00 changed some of the Cvar_Set[Value] calls to their *Quick variants in the
source files where the vars are defined.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@576 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-29 21:21:11 +00:00
Ozkan Sezer e2a17c9bcf * gl_screen.c: removed oldscreensize, oldfov, oldsbarscale, oldsbaralpha.
use the callbacks for scr_fov, scr_viewsize, scr_conwidth & scr_conscale
changes by simply setting vid.recalc_refdef to 1: now that Cvar_Set()
doesn't do anything when there is no change, this has the same effect.
* snd_dma.c: removed oldvol, set a callback to sfxvol in order to call
SND_InitScaletable() upon every volume change.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@567 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-28 22:40:15 +00:00
Ozkan Sezer 1928f2e1b8 * first shot at cvar flag system and cvar layer clean-ups :
- removed the archive and server members of cvar_t structure
  which are now represented by the CVAR_ARCHIVE, CVAR_NOTIFY
  and CVAR_SERVERINFO flags.
- added new Cvar_SetROM and Cvar_SetValueROM functions to 
  set vars marked as CVAR_ROM (read-only vars) programaticaly
- added Cvar_SetCallback() as a new function to assign (or
  remove) a callback function to a cvar.
- changed Cvar_RegisterVariable() to only accept a var pointer
  as in original quake
- moved notification handling from Cvar_Set() to callbacks.
- changed Cvar_Set() so that it doesn't reallocate the var's
  string buffer if nothing is changed, nor does it run the
  var's callback.
- changed the 'registered' and 'cmdline' cvars to be read-only
  so that the users can't change it using the console.  (and
  with 'registered' flagged as CVAR_ROM, the 'static_registered'
  thing is no longer required)
- added comment that sending cmdline upon CCREQ_RULE_INFO is
  evil...
- more to follow later.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@566 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-28 22:01:33 +00:00
Ozkan Sezer fb2f45126e changed many strcpy and strncpy into q_strlcpy
and strcat and strncat into q_strlcat

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@560 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 13:15:31 +00:00
Steven 8155c525b7 Update sndspeed cvar when it is changed from the command line (from Sander). Note in-game changes of the sound cvars don't change sound playback settings or behaviour.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@489 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-09-20 22:45:52 +00:00
Ozkan Sezer 8a1b526e5d Sync music stuff with uHexen2: Removed S_FileExtension, replaced its use
by COM_FileGetExtension.  Adjusted all users because COM_FileGetExtension
doesn't include the leading dot for the extension, nor does it ever return
NULL.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@455 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-05-20 22:20:30 +00:00
Ozkan Sezer 250fa2b7ce check for arguments to several command line options. patch from Sander van Dijk.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@446 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-19 18:29:41 +00:00
Ozkan Sezer a85d8dcd6a made global host_parms a pointer, set in main(). adjusted places where
host_parms is used. made COM_Init() and Host_Init() to take no arguments.
made Sys_Init() to set host_parms->userdir: at present, it is set to
host_parms->basedir, to be changed properly when user directories are
implemented.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@443 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-19 16:41:45 +00:00
Ozkan Sezer dd4c96d3c2 * snd_mp3.c: removed useless rudimentary info checks.
* updated copyright years for several sound related sources.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@405 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-30 21:34:12 +00:00
Ozkan Sezer 945262b863 min/max macros: renamed them to q_min and q_max, moved them common.h.
removed the inline versions which only handled integers.  moved CLAMP
macro to common.h.  Adjusted all places for the renamed macros.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@386 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-10 10:35:40 +00:00
Ozkan Sezer cbb7eb0428 Backported external music files support using decoder libraries and the
new raw samples interface from Hammer of Thyrion (uhexen2) :
- bgmusic.c, bgmusic.h: New BGM interface for background music handling.
  Handles streaming music as raw sound samples.
- bgmnull.c: BGM source for cases where the engine is configured for no
  sound.
- cl_main.c: Include bgmusic.h. Call BGM_Stop() and CDAudio_Stop() in
  CL_Disconnect().
- cd_sdl.c: Moved bgmvolume boundary checking to bgmusic.c upon value
  changes.
- gl_vidnt.c, gl_vidsdl.c, cl_parse.c: Include bgmusic.h. Add BGM_Pause()
  and BGM_Resume() calls along with CDAudio_ counterparts.
- cl_parse.c: Replace CDAudio_Play() call by the new BGM_PlayCDtrack()
  which first tries CDAudio_Play() and then streaming music if it fails.
- host.c: Include bgmusic.h. Call BGM_Update() just before S_Update()
  in Host_Frame(). In Host_Init(), call BGM_Init() after other audio init
  calls. In Host_Shutdown(), call BGM_Shutdown() before all other audio
  shutdown calls.
- snd_dma.c: Include snd_codec.h and bgmusic.h. Call S_CodecInit() from
  S_Init(). Call S_CodecShutdown() from S_Shutdown().
- snd_codec.c, snd_codec.h: New public codec interface for streaming
  music as raw samples. Adapted from quake2 and ioquake3 with changes.
  Individual codecs are responsible for handling any necessary byte swap
  operations.
- snd_codeci.h: New header for snd_codec internals.
- snd_wave.c, snd_wave.h: Codec for WAV format streaming music. Adapted
  from ioquake3 with changes.
- snd_vorbis.c, snd_vorbis.h: Codec for Ogg/Vorbis format streaming music.
- snd_mp3.c, snd_mp3.h: Codec for MP3 format streaming music using libmad.
  Adapted from the SoX project with changes.
- Makefile: Adjusted for the new sources. Added switches USE_CODEC_WAVE,
  USE_CODEC_MP3, USE_CODEC_VORBIS for enabling and disabling individual
  codecs.
- Windows makefiles and project files as well as other CodeBlocks project
  files will be updated shortly.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@374 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-05 19:50:43 +00:00
Ozkan Sezer f157f088d1 sync several sound-related files with uhexen2 a little: move
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: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@356 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-30 21:10:26 +00:00
Ozkan Sezer bcef8e85f0 backports from uhexen2 source, preparing for streaming music support:
* 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: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@355 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-30 17:11:28 +00:00
Ozkan Sezer b1585b3039 more fixes for deprecated conversion from string constant to char*:
handle the -safe command line switch using a new global safemode,
check for safemode in the related driver init functions and remove
the safeargvs & co from common.c and COM_InitArgv().


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@307 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-29 12:55:41 +00:00
Ozkan Sezer 906df3f650 const correctness changes.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@300 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-29 02:22:55 +00:00
Ozkan Sezer 236d7a62ce Under windows, run the game (windowed), go into a saved game,
press Esc to get the menu, minimize using the mouse on the
window's minimize icon and then restore and you'll have sound
all the same.  HOWEVER: If you minimize by pressing the icon
on the start bar, sound will be lost upon restoring. Or, if
you use alt-tab to get away from the game window the same will
happen. Or, if you run the game fullscreen and use alt-tab to
go to the desktop (alt-tab is the only way I know) you will
lose the sound again.  Here, we are probably are hitting an
SDL_APPACTIVE or SDL_APPINPUTFOCUS event more than once and
since the block counter goes > 1 we are not restoring properly.
For now, making snd_blocked to act as a boolean and not as a
counter fixes the issue.  Hmmm...

* main_sdl.c: Revert revision 238 change, no longer necessary.
* snd_dma.c: Make snd_blocked act as a boolean and not as a
counter.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@241 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-07-25 12:20:17 +00:00
Ozkan Sezer 5658a9e28d renamed the global channels to snd_channels. removed the global variable
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: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@181 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-03 17:25:24 +00:00
Ozkan Sezer 80a3a0df30 renamed cvar variable volume to sfxvolume in order to avoid shadowing.
(console name is still volume, no changes to that.)


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@180 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-03 16:38:22 +00:00
Ozkan Sezer c24d592580 host_cmd.c, console.c, gl_draw.c, image.c, gl_model.c, r_sprite.c, cl_parse.c,
gl_warp.c, host.c, gl_mesh.c, gl_sky.c, gl_texmgr.c, cvar.c, sv_main.c, cvar.h,
gl_screen.c, r_brush.c, gl_vidsdl.c, zone.c, cl_main.c, cmd.c, snd_dma.c,
snd_mem.c, common.c, sv_phys.c: Added explicit casts to eliminate -Wc++-compat
warnings.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@170 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-05-31 07:42:36 +00:00
Ozkan Sezer 68fc38c3a6 chase.c, cl_input.c, cl_parse.c, client.h, common.c, common.h, console.h,
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: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@21 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 12:01:07 +00:00
Ozkan Sezer 5f028f87a3 snd_dma.c: added SNDDMA_LockBuffer() as a new API, needed for, well, proper buffer
locking.  removed simsound. removed unused S_AmbientOff() and S_AmbientOn(). other
multiple cleanups and fixes.
snd_sdl.c: replaced the old broken implementation which used to cause LRU failures
with the one adapted from the uhexen2 project.
sound.h: added missing prototypes, including the new SNDDMA_LockBuffer().


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@6 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-15 23:45:06 +00:00
Ozkan Sezer db613ab35d initial import of SDL port of Fitzquake-0.85 / 20090510 sources.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@2 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-15 23:26:55 +00:00