2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
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
2005-06-14 04:52:10 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
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 the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// sound.h -- client sound i/o functions
# ifndef __SOUND__
# define __SOUND__
2011-07-06 01:40:40 +00:00
# define MAXSOUNDCHANNELS 8 //on a per device basis
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//pitch/rate changes require that we track stuff with subsample precision.
//this can result in some awkward overflows.
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
# define ssamplepos_t qintptr_t
# define usamplepos_t quintptr_t
2016-07-12 00:40:13 +00:00
# define PITCHSHIFT 6 /*max audio file length = ((1<<32)>>PITCHSHIFT)/KHZ*/
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2004-08-23 00:15:46 +00:00
struct sfx_s ;
typedef struct
{
int s [ MAXSOUNDCHANNELS ] ;
} portable_samplegroup_t ;
typedef struct {
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
struct sfxcache_s * ( QDECL * decodedata ) ( struct sfx_s * sfx , struct sfxcache_s * buf , ssamplepos_t start , int length ) ; //return true when done.
float ( QDECL * querydata ) ( struct sfx_s * sfx , struct sfxcache_s * buf , char * title , size_t titlesize ) ; //reports length + original format info without actually decoding anything.
void ( QDECL * ended ) ( struct sfx_s * sfx ) ; //sound stopped playing and is now silent (allow rewinding or something).
void ( QDECL * purge ) ( struct sfx_s * sfx ) ; //sound is being purged from memory. destroy everything.
2004-08-23 00:15:46 +00:00
void * buf ;
} sfxdecode_t ;
2015-04-14 23:12:17 +00:00
enum
{
SLS_NOTLOADED , //not tried to load it
SLS_LOADING , //loading it on a worker thread.
SLS_LOADED , //currently in memory and usable.
SLS_FAILED //already tried to load it. it won't work. not found, invalid format, etc
} ;
2004-08-23 00:15:46 +00:00
typedef struct sfx_s
{
char name [ MAX_OSPATH ] ;
2014-09-12 13:14:51 +00:00
sfxdecode_t decoder ;
2015-04-14 23:12:17 +00:00
int loadstate ; //no more super-spammy
2014-09-12 13:14:51 +00:00
qboolean touched : 1 ; //if the sound is still relevent
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
qboolean syspath : 1 ; //if the sound is still relevent
int loopstart ; //-1 or sample index to begin looping at once the sample ends
2014-09-12 13:14:51 +00:00
2010-03-14 14:35:56 +00:00
# ifdef AVAIL_OPENAL
unsigned int openal_buffer ;
# endif
2004-08-23 00:15:46 +00:00
} sfx_t ;
// !!! if this is changed, it much be changed in asm_i386.h too !!!
typedef struct sfxcache_s
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
usamplepos_t length ; //sample count
2012-02-27 12:23:15 +00:00
unsigned int speed ;
unsigned int width ;
unsigned int numchannels ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
usamplepos_t soundoffset ; //byte index into the sound
2012-02-27 12:23:15 +00:00
qbyte * data ; // variable sized
2004-08-23 00:15:46 +00:00
} sfxcache_t ;
typedef struct
{
2012-02-27 12:23:15 +00:00
int numchannels ; // this many samples per frame
2006-09-17 00:59:22 +00:00
int samples ; // mono samples in buffer (individual, non grouped)
2004-08-23 00:15:46 +00:00
int samplepos ; // in mono samples
2017-09-20 11:27:13 +00:00
int samplebytes ; // per channel (NOT per frame)
enum
{
QSF_INVALID , //not selected yet...
QSF_EXTERNALMIXER , //this sample format is totally irrelevant as this device uses some sort of external mixer.
QSF_U8 , //FIXME: more unsigned formats need changes to S_ClearBuffer
QSF_S8 , //signed 8bit format is actually quite rare.
QSF_S16 , //normal format
// QSF_X8_S24, //upper 8 bits unused. hopefully we don't need any packed thing
// QSF_S32, //lower 8 bits probably unused. this makes overflow detection messy.
QSF_F32 , //modern mixers can use SSE/SIMD stuff, and we can skip clamping so this can be quite nippy.
} sampleformat ;
2012-02-27 12:23:15 +00:00
int speed ; // this many frames per second
unsigned char * buffer ; // pointer to mixed pcm buffer (not directly used by mixer)
2004-08-23 00:15:46 +00:00
} dma_t ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//client and server
2018-10-17 00:43:04 +00:00
# define CF_SV_RELIABLE 1 // send reliably
# define CF_NET_SENTVELOCITY CF_SV_RELIABLE
2017-08-14 16:38:44 +00:00
# define CF_FORCELOOP 2 // forces looping. set on static sounds.
# define CF_NOSPACIALISE 4 // these sounds are played at a fixed volume in both speakers, but still gets quieter with distance.
//#define CF_PAUSED 8 // rate = 0. or something.
2018-10-17 00:43:04 +00:00
# define CF_CL_ABSVOLUME 16 // ignores volume cvar. this is ignored if received from the server because there's no practical way for the server to respect the client's preferences.
//#define CF_SV_RESERVED CF_CL_ABSVOLUME
2017-08-14 16:38:44 +00:00
# define CF_NOREVERB 32 // disables reverb on this channel, if possible.
# define CF_FOLLOW 64 // follows the owning entity (stops moving if we lose track)
//#define CF_RESERVEDN 128 // reserved for things that should be networked.
2015-07-27 08:21:34 +00:00
2018-10-17 00:43:04 +00:00
# define CF_SV_UNICAST 256 // serverside only. the sound is sent to msg_entity only.
# define CF_SV_SENDVELOCITY 512 // serverside hint that velocity is important
# define CF_CLI_AUTOSOUND 1024 // generated from q2 entities, which avoids breaking regular sounds, using it outside the sound system will probably break things.
# define CF_CLI_INACTIVE 2048 // try to play even when inactive
2019-02-24 08:32:45 +00:00
# ifdef Q3CLIENT
# define CF_CLI_NODUPES 4096 // block multiple identical sounds being started on the same entity within rapid succession. required by quake3.
# endif
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# define CF_NETWORKED (CF_NOSPACIALISE|CF_NOREVERB|CF_FORCELOOP|CF_FOLLOW /*|CF_RESERVEDN*/ )
2016-01-18 05:22:07 +00:00
2004-08-23 00:15:46 +00:00
typedef struct
{
sfx_t * sfx ; // sfx number
2013-05-31 01:16:07 +00:00
int vol [ MAXSOUNDCHANNELS ] ; // volume, .8 fixed point.
2016-07-12 00:40:13 +00:00
ssamplepos_t pos ; // sample position in sfx, <0 means delay sound start (shifted up by PITCHSHIFT)
int rate ; // fixed point rate scaling
2013-05-31 01:16:07 +00:00
int flags ; // cf_ flags
2004-08-23 00:15:46 +00:00
int entnum ; // to allow overriding a specific sound
2014-05-13 23:21:20 +00:00
int entchannel ; // to avoid overriding a specific sound too easily
2004-08-23 00:15:46 +00:00
vec3_t origin ; // origin of sound effect
2016-07-12 00:40:13 +00:00
vec3_t velocity ; // velocity of sound effect
2004-08-23 00:15:46 +00:00
vec_t dist_mult ; // distance multiplier (attenuation/clipK)
int master_vol ; // 0-255 master volume
2019-02-24 08:32:45 +00:00
# ifdef Q3CLIENT
unsigned int starttime ; // start time, to replicate q3's 50ms embargo on duped sounds.
# endif
2004-08-23 00:15:46 +00:00
} channel_t ;
struct soundcardinfo_s ;
typedef struct soundcardinfo_s soundcardinfo_t ;
2016-07-12 00:40:13 +00:00
extern struct sndreverbproperties_s
{
int modificationcount ;
struct reverbproperties_s
{ //note: this struct originally comes from openal's eaxreverb
//it is shared with gamecode
float flDensity ;
float flDiffusion ;
float flGain ;
float flGainHF ;
float flGainLF ;
float flDecayTime ;
float flDecayHFRatio ;
float flDecayLFRatio ;
float flReflectionsGain ;
float flReflectionsDelay ;
float flReflectionsPan [ 3 ] ;
float flLateReverbGain ;
float flLateReverbDelay ;
float flLateReverbPan [ 3 ] ;
float flEchoTime ;
float flEchoDepth ;
float flModulationTime ;
float flModulationDepth ;
float flAirAbsorptionGainHF ;
float flHFReference ;
float flLFReference ;
float flRoomRolloffFactor ;
int iDecayHFLimit ;
} props ;
} * reverbproperties ;
extern size_t numreverbproperties ;
//reverbproperties_s presets, from efx-presets.h
//mostly for testing
# define REVERB_PRESET_PSYCHOTIC \
{ 0.0625f , 0.5000f , 0.3162f , 0.8404f , 1.0000f , 7.5600f , 0.9100f , 1.0000f , 0.4864f , 0.0200f , { 0.0000f , 0.0000f , 0.0000f } , 2.4378f , 0.0300f , { 0.0000f , 0.0000f , 0.0000f } , 0.2500f , 0.0000f , 4.0000f , 1.0000f , 0.9943f , 5000.0000f , 250.0000f , 0.0000f , 0x0 }
//default reverb 1
# define REVERB_PRESET_UNDERWATER \
{ 0.3645f , 1.0000f , 0.3162f , 0.0100f , 1.0000f , 1.4900f , 0.1000f , 1.0000f , 0.5963f , 0.0070f , { 0.0000f , 0.0000f , 0.0000f } , 7.0795f , 0.0110f , { 0.0000f , 0.0000f , 0.0000f } , 0.2500f , 0.0000f , 1.1800f , 0.3480f , 0.9943f , 5000.0000f , 250.0000f , 0.0000f , 0x1 }
2004-08-23 00:15:46 +00:00
void S_Init ( void ) ;
void S_Startup ( void ) ;
2016-07-12 00:40:13 +00:00
void S_EnumerateDevices ( void ) ;
2013-08-21 07:14:39 +00:00
void S_Shutdown ( qboolean final ) ;
2014-05-13 23:21:20 +00:00
float S_GetSoundTime ( int entnum , int entchannel ) ;
2019-03-23 07:06:37 +00:00
float S_GetChannelLevel ( int entnum , int entchannel ) ;
2016-07-12 00:40:13 +00:00
void S_StartSound ( int entnum , int entchannel , sfx_t * sfx , vec3_t origin , vec3_t velocity , float fvol , float attenuation , float timeofs , float pitchadj , unsigned int flags ) ;
float S_UpdateSound ( int entnum , int entchannel , sfx_t * sfx , vec3_t origin , vec3_t velocity , float fvol , float attenuation , float timeofs , float pitchadj , unsigned int flags ) ;
2004-08-23 00:15:46 +00:00
void S_StaticSound ( sfx_t * sfx , vec3_t origin , float vol , float attenuation ) ;
void S_StopSound ( int entnum , int entchannel ) ;
void S_StopAllSounds ( qboolean clear ) ;
2016-07-12 00:40:13 +00:00
void S_UpdateListener ( int seat , int entnum , vec3_t origin , vec3_t forward , vec3_t right , vec3_t up , size_t reverbtype , vec3_t velocity ) ;
qboolean S_UpdateReverb ( size_t reverbtype , void * reverb , size_t reverbsize ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
void S_GetListenerInfo ( int seat , float * origin , float * forward , float * right , float * up ) ;
2010-11-06 23:05:29 +00:00
void S_Update ( void ) ;
2004-08-23 00:15:46 +00:00
void S_ExtraUpdate ( void ) ;
2012-02-27 12:23:15 +00:00
void S_MixerThread ( soundcardinfo_t * sc ) ;
void S_Purge ( qboolean retaintouched ) ;
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
void S_LockMixer ( void ) ;
void S_UnlockMixer ( void ) ;
2009-04-06 00:34:32 +00:00
qboolean S_HaveOutput ( void ) ;
void S_Music_Clear ( sfx_t * onlyifsample ) ;
void S_Music_Seek ( float time ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
qboolean S_GetMusicInfo ( int musicchannel , float * time , float * duration , char * title , size_t titlesize ) ;
2015-07-14 14:47:00 +00:00
qboolean S_Music_Playing ( int musicchannel ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
float Media_CrossFade ( int musicchanel , float vol , float time ) ; //queries the volume we're meant to be playing (checks for fade out). -1 for no more, otherwise returns vol.
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx_t * Media_NextTrack ( int musicchanel , float * time ) ; //queries the track we're meant to be playing now.
2009-04-06 00:34:32 +00:00
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx_t * S_FindName ( const char * name , qboolean create , qboolean syspath ) ;
sfx_t * S_PrecacheSound2 ( const char * sample , qboolean syspath ) ;
# define S_PrecacheSound(s) S_PrecacheSound2(s,false)
2004-08-23 00:15:46 +00:00
void S_TouchSound ( char * sample ) ;
2012-02-27 12:23:15 +00:00
void S_UntouchAll ( void ) ;
2004-08-23 00:15:46 +00:00
void S_ClearPrecache ( void ) ;
void S_BeginPrecaching ( void ) ;
void S_EndPrecaching ( void ) ;
void S_PaintChannels ( soundcardinfo_t * sc , int endtime ) ;
void S_InitPaintChannels ( soundcardinfo_t * sc ) ;
2016-02-10 23:23:43 +00:00
soundcardinfo_t * S_SetupDeviceSeat ( char * driver , char * device , int seat ) ;
2004-08-23 00:15:46 +00:00
void S_ShutdownCard ( soundcardinfo_t * sc ) ;
2007-08-06 21:13:15 +00:00
void S_DefaultSpeakerConfiguration ( soundcardinfo_t * sc ) ;
void S_ResetFailedLoad ( void ) ;
2011-12-05 15:23:40 +00:00
# ifdef PEXT2_VOICECHAT
void S_Voip_Parse ( void ) ;
# endif
2010-11-15 02:40:31 +00:00
# ifdef VOICECHAT
2013-09-06 22:57:44 +00:00
extern cvar_t snd_voip_showmeter ;
2010-11-20 22:01:16 +00:00
void S_Voip_Transmit ( unsigned char clc , sizebuf_t * buf ) ;
2010-11-16 02:03:47 +00:00
void S_Voip_MapChange ( void ) ;
2010-11-20 22:01:16 +00:00
int S_Voip_Loudness ( qboolean ignorevad ) ; //-1 for not capturing, otherwise between 0 and 100
2018-11-22 03:02:36 +00:00
int S_Voip_ClientLoudness ( unsigned int plno ) ;
2010-11-20 22:01:16 +00:00
qboolean S_Voip_Speaking ( unsigned int plno ) ;
2010-12-05 02:46:07 +00:00
void S_Voip_Ignore ( unsigned int plno , qboolean ignore ) ;
2010-11-20 22:01:16 +00:00
# else
# define S_Voip_Loudness() -1
# define S_Voip_Speaking(p) false
2010-12-05 02:56:31 +00:00
# define S_Voip_Ignore(p,s)
2010-11-15 02:40:31 +00:00
# endif
2004-08-23 00:15:46 +00:00
qboolean S_IsPlayingSomewhere ( sfx_t * s ) ;
2016-07-12 00:40:13 +00:00
//qboolean ResampleSfx (sfx_t *sfx, int inrate, int inchannels, int inwidth, int insamps, int inloopstart, qbyte *data);
2004-08-23 00:15:46 +00:00
// picks a channel based on priorities, empty slots, number of channels
channel_t * SND_PickChannel ( soundcardinfo_t * sc , int entnum , int entchannel ) ;
2006-06-04 01:43:52 +00:00
void SND_ResampleStream ( void * in , int inrate , int inwidth , int inchannels , int insamps , void * out , int outrate , int outwidth , int outchannels , int resampstyle ) ;
2005-06-18 23:52:42 +00:00
// restart entire sound subsystem (doesn't flush old sounds, so make sure that happens)
2015-12-28 17:41:39 +00:00
void S_DoRestart ( qboolean onlyifneeded ) ;
2004-08-23 00:15:46 +00:00
2005-10-07 02:05:22 +00:00
void S_Restart_f ( void ) ;
2004-08-23 00:15:46 +00:00
//plays streaming audio
2013-05-31 01:16:07 +00:00
void S_RawAudio ( int sourceid , qbyte * data , int speed , int samples , int channels , int width , float volume ) ;
2004-08-23 00:15:46 +00:00
void CLVC_Poll ( void ) ;
void SNDVC_MicInput ( qbyte * buffer , int samples , int freq , int width ) ;
2010-03-14 14:35:56 +00:00
2004-08-23 00:15:46 +00:00
// ====================================================================
// User-setable variables
// ====================================================================
2011-07-22 20:49:15 +00:00
# define MAX_DYNAMIC_CHANNELS 64 /*playing sounds (identical ones merge)*/
2010-11-06 23:05:29 +00:00
2004-08-23 00:15:46 +00:00
2010-11-06 23:05:29 +00:00
# define NUM_MUSICS 1
# define AMBIENT_FIRST 0
# define AMBIENT_STOP NUM_AMBIENTS
# define MUSIC_FIRST AMBIENT_STOP
# define MUSIC_STOP (MUSIC_FIRST + NUM_MUSICS)
# define DYNAMIC_FIRST MUSIC_STOP
# define DYNAMIC_STOP (DYNAMIC_FIRST + MAX_DYNAMIC_CHANNELS)
2004-08-23 00:15:46 +00:00
//
// Fake dma is a synchronous faking of the DMA progress used for
// isolating performance in the renderer. The fakedma_updates is
// number of times S_Update() is called per second.
//
extern int snd_speed ;
2019-07-19 02:13:19 +00:00
extern cvar_t snd_nominaldistance ;
2004-08-23 00:15:46 +00:00
extern cvar_t loadas8bit ;
extern cvar_t bgmvolume ;
extern cvar_t volume ;
extern cvar_t snd_capture ;
2010-11-20 22:01:16 +00:00
extern float voicevolumemod ;
2004-08-23 00:15:46 +00:00
extern qboolean snd_initialized ;
2013-04-07 08:59:05 +00:00
extern cvar_t snd_mixerthread ;
2004-08-23 00:15:46 +00:00
extern int snd_blocked ;
2014-03-30 08:55:06 +00:00
void S_LocalSound ( const char * s ) ;
2016-07-12 00:40:13 +00:00
void S_LocalSound2 ( const char * sound , int channel , float volume ) ;
2018-09-23 19:35:24 +00:00
qboolean S_LoadSound ( sfx_t * s , qboolean forcedecode ) ;
2004-08-23 00:15:46 +00:00
2018-09-23 19:35:24 +00:00
typedef qboolean ( QDECL * S_LoadSound_t ) ( sfx_t * s , qbyte * data , size_t datalen , int sndspeed , qboolean forcedecode ) ;
2019-09-04 07:59:40 +00:00
qboolean S_RegisterSoundInputPlugin ( void * module , S_LoadSound_t loadfnc ) ; //called to register additional sound input plugins
void S_UnregisterSoundInputModule ( void * module ) ;
2006-02-11 14:51:36 +00:00
2004-08-23 00:15:46 +00:00
void S_AmbientOff ( void ) ;
void S_AmbientOn ( void ) ;
2005-06-14 04:52:10 +00:00
//inititalisation functions.
2013-07-26 17:19:06 +00:00
typedef struct
{
const char * name ; //must be a single token, with no :
qboolean ( QDECL * InitCard ) ( soundcardinfo_t * sc , const char * cardname ) ; //NULL for default device.
qboolean ( QDECL * Enumerate ) ( void ( QDECL * callback ) ( const char * drivername , const char * devicecode , const char * readablename ) ) ;
2017-09-20 11:27:13 +00:00
void ( QDECL * RegisterCvars ) ( void ) ;
2013-07-26 17:19:06 +00:00
} sounddriver_t ;
2017-09-20 11:27:13 +00:00
/*typedef int (*sounddriver) (soundcardinfo_t *sc, int cardnum);
2010-03-14 14:35:56 +00:00
extern sounddriver pOPENAL_InitCard ;
2005-06-14 04:52:10 +00:00
extern sounddriver pDSOUND_InitCard ;
extern sounddriver pALSA_InitCard ;
2012-09-30 05:52:03 +00:00
extern sounddriver pSNDIO_InitCard ;
2005-06-14 04:52:10 +00:00
extern sounddriver pOSS_InitCard ;
extern sounddriver pSDL_InitCard ;
extern sounddriver pWAV_InitCard ;
2005-11-26 03:02:55 +00:00
extern sounddriver pAHI_InitCard ;
2017-09-20 11:27:13 +00:00
*/
2004-08-23 00:15:46 +00:00
struct soundcardinfo_s { //windows has one defined AFTER directsound
2005-06-14 04:52:10 +00:00
char name [ 256 ] ; //a description of the card.
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
char guid [ 256 ] ; //device name as detected (so input code can create sound devices without bugging out too much)
2005-06-14 04:52:10 +00:00
struct soundcardinfo_s * next ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int seat ;
2005-06-14 04:52:10 +00:00
//speaker orientations for spacialisation.
2010-11-06 23:05:29 +00:00
float dist [ MAXSOUNDCHANNELS ] ;
vec3_t speakerdir [ MAXSOUNDCHANNELS ] ;
2004-08-23 00:15:46 +00:00
2005-06-14 04:52:10 +00:00
//info on which sound effects are playing
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
//FIXME: use a linked list
2017-01-13 00:39:50 +00:00
channel_t * channel ;
2017-01-15 13:13:09 +00:00
size_t total_chans ;
size_t max_chans ;
2005-06-14 04:52:10 +00:00
2016-01-18 05:22:07 +00:00
float ambientlevels [ NUM_AMBIENTS ] ; //we use a float instead of the channel's int volume value to avoid framerate dependancies with slow transitions.
2005-06-14 04:52:10 +00:00
//mixer
volatile dma_t sn ; //why is this volatile?
qboolean inactive_sound ; //continue mixing for this card even when the window isn't active.
qboolean selfpainting ; //allow the sound code to call the right functions when it feels the need (not properly supported).
2012-02-27 12:23:15 +00:00
int paintedtime ; //used in the mixer as last-written pos (in frames)
2006-09-17 00:59:22 +00:00
int oldsamplepos ; //this is used to track buffer wraps
int buffers ; //used to keep track of how many buffer wraps for consistant sound
2011-01-29 19:53:38 +00:00
int samplequeue ; //this is the number of samples the device can enqueue. if set, DMAPos returns the write point (rather than hardware read point) (in samplepairs).
2005-06-14 04:52:10 +00:00
//callbacks
2012-09-30 05:52:03 +00:00
void * ( * Lock ) ( soundcardinfo_t * sc , unsigned int * startoffset ) ; //grab a pointer to the hardware ringbuffer or whatever. startoffset is the starting offset. you can set it to 0 and bump the start offset if you need.
void ( * Unlock ) ( soundcardinfo_t * sc , void * buffer ) ; //release the hardware ringbuffer memory
void ( * Submit ) ( soundcardinfo_t * sc , int start , int end ) ; //if the ringbuffer is emulated, this is where you should push it to the device.
void ( * Shutdown ) ( soundcardinfo_t * sc ) ; //kill the device
unsigned int ( * GetDMAPos ) ( soundcardinfo_t * sc ) ; //get the current point that the hardware is reading from (the return value should not wrap, at least not very often)
2016-07-12 00:40:13 +00:00
void ( * SetEnvironmentReverb ) ( soundcardinfo_t * sc , size_t reverb ) ; //if you have eax enabled, change the environment. fixme. generally this is a stub. optional.
2012-09-30 05:52:03 +00:00
void ( * Restore ) ( soundcardinfo_t * sc ) ; //called before lock/unlock/lock/unlock/submit. optional
void ( * ChannelUpdate ) ( soundcardinfo_t * sc , channel_t * channel , unsigned int schanged ) ; //properties of a sound effect changed. this is to notify hardware mixers. optional.
2016-07-12 00:40:13 +00:00
void ( * ListenerUpdate ) ( soundcardinfo_t * sc , int entnum , vec3_t origin , vec3_t forward , vec3_t right , vec3_t up , vec3_t velocity ) ; //player moved or something. this is to notify hardware mixers. optional.
2019-03-23 07:06:37 +00:00
ssamplepos_t ( * GetChannelPos ) ( soundcardinfo_t * sc , channel_t * channel ) ; //queries a hardware mixer's channel position (essentially returns channel->pos, except more up to date)
2012-09-30 05:52:03 +00:00
//driver-specific - if you need more stuff, you should just shove it in the handle pointer
2012-02-27 12:23:15 +00:00
void * thread ;
2005-06-14 04:52:10 +00:00
void * handle ;
2004-08-23 00:15:46 +00:00
int snd_sent ;
int snd_completed ;
int audio_fd ;
} ;
extern soundcardinfo_t * sndcardinfo ;
2010-11-20 22:01:16 +00:00
typedef struct
{
2013-09-06 22:57:44 +00:00
int apiver ;
char * drivername ;
qboolean ( QDECL * Enumerate ) ( void ( QDECL * callback ) ( const char * drivername , const char * devicecode , const char * readablename ) ) ;
2013-10-26 02:50:24 +00:00
void * ( QDECL * Init ) ( int samplerate , const char * device ) ; /*create a new context*/
2013-09-06 22:57:44 +00:00
void ( QDECL * Start ) ( void * ctx ) ; /*begin grabbing new data, old data is potentially flushed*/
unsigned int ( QDECL * Update ) ( void * ctx , unsigned char * buffer , unsigned int minbytes , unsigned int maxbytes ) ; /*grab the data into a different buffer*/
void ( QDECL * Stop ) ( void * ctx ) ; /*stop grabbing new data, old data may remain*/
void ( QDECL * Shutdown ) ( void * ctx ) ; /*destroy everything*/
2010-11-20 22:01:16 +00:00
} snd_capture_driver_t ;
2004-08-23 00:15:46 +00:00
# endif