2010-11-28 19:07:07 +00:00
# include "quakedef.h"
/*
This is based on Jogi ' s OpenAL support .
Much of it is stripped , to try and get it clean / compliant .
2017-05-28 15:42:32 +00:00
Emscripten / WebAudio is buggy or limited .
This means we force distance models and use hacks to avoid bugs in browsers .
We also have no doppler with WebAudio .
2010-11-28 19:07:07 +00:00
*/
2019-12-10 14:50:47 +00:00
/*Bug list:
underwater cacaphoy
openal bug with reverb . either disable reverb or disable openal .
" build/openal-soft-1.19.1/Alc/filters/filter.c:25: BiquadFilter_setParams: Assertion `gain > 0.00001f' failed. " + SIGABRT
bug started with 1.19 .1 . Not fte ' s bug . either disable reverb or disable openal .
2020-06-12 23:29:58 +00:00
( happens when reverb properties are changed too fast )
2019-12-10 14:50:47 +00:00
AL_OUT_OF_MEMORY
shitty openal implementation with too - low limits on number of sources .
AL_INVALID_VALUE
shitty ( apple ) openal implementation with too - low limits on number of sources .
*/
2010-11-28 19:07:07 +00:00
# ifdef AVAIL_OPENAL
2014-08-25 07:35:41 +00:00
# ifdef FTE_TARGET_WEB
2015-08-10 18:28:23 +00:00
# include <emscripten/emscripten.h>
2015-08-07 17:49:49 +00:00
//emscripten provides an openal -> webaudio wrapper. its not the best, but does get the job done.
# define OPENAL_STATIC //our javascript port doesn't support dynamic linking (bss+data segments get too messy).
# define SDRVNAME "WebAudio" //IE doesn't support webaudio, resulting in noticable error messages about no openal, which is technically incorrect. So lets be clear about this.
2020-04-19 01:23:32 +00:00
# define SDRVNAMEDESC "WebAudio:"
2021-10-22 22:27:21 +00:00
# define QMIX_SDRVNAME "qmix" //IE doesn't support webaudio, resulting in noticable error messages about no openal, which is technically incorrect. So lets be clear about this.
# define QMIX_SDRVNAMEDESC "QMIX:"
2015-08-07 17:49:49 +00:00
# else
# define SDRVNAME "OpenAL"
2020-04-19 01:23:32 +00:00
# define SDRVNAMEDESC "OAL:"
2021-10-22 22:27:21 +00:00
# define QMIX_SDRVNAME "qmix"
# define QMIX_SDRVNAMEDESC "OALQ:"
2019-04-16 22:40:05 +00:00
# define USEEFX
2014-08-25 07:35:41 +00:00
# endif
2020-04-19 01:23:32 +00:00
# ifndef HAVE_MIXER
# undef SDRVNAMEDESC
# define SDRVNAMEDESC "" //remove the prefixes in user-visible desciptions when there's (probably) no other devices anyway
# endif
2014-08-25 07:35:41 +00:00
# ifdef OPENAL_STATIC
# include <AL/al.h> //output
2016-07-12 00:40:13 +00:00
# include <AL/alc.h> //context+input
2014-08-25 07:35:41 +00:00
# ifndef AL_API
# define AL_API
# endif
# ifndef AL_APIENTRY
# define AL_APIENTRY
# endif
2019-12-17 19:21:29 +00:00
# define palGetError alGetError
# define palSourcef alSourcef
# define palSourcei alSourcei
# define palSourcePlayv alSourcePlayv
# define palSourceStopv alSourceStopv
# define palSourcePlay alSourcePlay
# define palSourceStop alSourceStop
# define palDopplerFactor alDopplerFactor
# define palGenBuffers alGenBuffers
# define palIsBuffer alIsBuffer
# define palBufferData alBufferData
2021-10-22 22:27:21 +00:00
# define palBufferiv alBufferiv
2019-12-17 19:21:29 +00:00
# define palDeleteBuffers alDeleteBuffers
# define palListenerfv alListenerfv
# define palSourcefv alSourcefv
# define palGetString alGetString
# define palGenSources alGenSources
# define palIsSource alIsSource
# define palListenerf alListenerf
# define palDeleteBuffers alDeleteBuffers
# define palDeleteSources alDeleteSources
# define palSpeedOfSound alSpeedOfSound
# define palDistanceModel alDistanceModel
# define palGetSourcei alGetSourcei
2014-08-25 07:35:41 +00:00
# define palSourceQueueBuffers alSourceQueueBuffers
# define palSourceUnqueueBuffers alSourceUnqueueBuffers
2021-10-12 04:42:07 +00:00
# define palIsExtensionPresent alIsExtensionPresent
2014-08-25 07:35:41 +00:00
2019-12-17 19:21:29 +00:00
# define palcOpenDevice alcOpenDevice
# define palcCloseDevice alcCloseDevice
2014-08-25 07:35:41 +00:00
# define palcCreateContext alcCreateContext
# define palcDestroyContext alcDestroyContext
# define palcMakeContextCurrent alcMakeContextCurrent
# define palcProcessContext alcProcessContext
# define palcGetString alcGetString
2021-10-12 04:42:07 +00:00
# define palcGetIntegerv alcGetIntegerv
2014-08-25 07:35:41 +00:00
# define palcIsExtensionPresent alcIsExtensionPresent
2021-10-12 04:42:07 +00:00
# define palcGetProcAddress alcGetProcAddress
2014-08-25 07:35:41 +00:00
2016-07-12 00:40:13 +00:00
# define palGetProcAddress alGetProcAddress
2014-08-25 07:35:41 +00:00
# ifdef FTE_TARGET_WEB //emscripten sucks.
AL_API void ( AL_APIENTRY alSpeedOfSound ) ( ALfloat value ) { }
# endif
# else
2010-11-28 19:07:07 +00:00
# if defined(_WIN32)
# define AL_APIENTRY __cdecl
# else
# define AL_APIENTRY
# endif
# define AL_API
typedef int ALint ;
typedef unsigned int ALuint ;
typedef float ALfloat ;
typedef int ALenum ;
typedef char ALchar ;
typedef char ALboolean ;
typedef int ALsizei ;
typedef void ALvoid ;
2016-07-12 00:40:13 +00:00
typedef unsigned char ALubyte ;
2010-11-28 19:07:07 +00:00
2013-07-26 17:19:06 +00:00
static dllhandle_t * openallib ;
static qboolean openallib_tried ;
2010-11-28 19:07:07 +00:00
static AL_API ALenum ( AL_APIENTRY * palGetError ) ( void ) ;
static AL_API void ( AL_APIENTRY * palSourcef ) ( ALuint sid , ALenum param , ALfloat value ) ;
static AL_API void ( AL_APIENTRY * palSourcei ) ( ALuint sid , ALenum param , ALint value ) ;
static AL_API void ( AL_APIENTRY * palSourcePlayv ) ( ALsizei ns , const ALuint * sids ) ;
static AL_API void ( AL_APIENTRY * palSourceStopv ) ( ALsizei ns , const ALuint * sids ) ;
static AL_API void ( AL_APIENTRY * palSourcePlay ) ( ALuint sid ) ;
static AL_API void ( AL_APIENTRY * palSourceStop ) ( ALuint sid ) ;
static AL_API void ( AL_APIENTRY * palDopplerFactor ) ( ALfloat value ) ;
static AL_API void ( AL_APIENTRY * palGenBuffers ) ( ALsizei n , ALuint * buffers ) ;
static AL_API ALboolean ( AL_APIENTRY * palIsBuffer ) ( ALuint bid ) ;
static AL_API void ( AL_APIENTRY * palBufferData ) ( ALuint bid , ALenum format , const ALvoid * data , ALsizei size , ALsizei freq ) ;
2021-10-22 22:27:21 +00:00
static AL_API void ( AL_APIENTRY * palBufferiv ) ( ALuint buffer , ALenum param , const ALint * values ) ;
2010-11-28 19:07:07 +00:00
static AL_API void ( AL_APIENTRY * palDeleteBuffers ) ( ALsizei n , const ALuint * buffers ) ;
static AL_API void ( AL_APIENTRY * palListenerfv ) ( ALenum param , const ALfloat * values ) ;
static AL_API void ( AL_APIENTRY * palSourcefv ) ( ALuint sid , ALenum param , const ALfloat * values ) ;
static AL_API const ALchar * ( AL_APIENTRY * palGetString ) ( ALenum param ) ;
static AL_API void ( AL_APIENTRY * palGenSources ) ( ALsizei n , ALuint * sources ) ;
2019-12-10 14:50:47 +00:00
static AL_API ALboolean ( AL_APIENTRY * palIsSource ) ( ALuint sourceName ) ;
2010-11-28 19:07:07 +00:00
static AL_API void ( AL_APIENTRY * palListenerf ) ( ALenum param , ALfloat value ) ;
static AL_API void ( AL_APIENTRY * palDeleteBuffers ) ( ALsizei n , const ALuint * buffers ) ;
static AL_API void ( AL_APIENTRY * palDeleteSources ) ( ALsizei n , const ALuint * sources ) ;
static AL_API void ( AL_APIENTRY * palSpeedOfSound ) ( ALfloat value ) ;
static AL_API void ( AL_APIENTRY * palDistanceModel ) ( ALenum distanceModel ) ;
2013-07-26 17:19:06 +00:00
//needed for streaming
static AL_API void ( AL_APIENTRY * palGetSourcei ) ( ALuint source , ALenum pname , ALint * value ) ;
static AL_API void ( AL_APIENTRY * palSourceQueueBuffers ) ( ALuint source , ALsizei n , ALuint * buffers ) ;
static AL_API void ( AL_APIENTRY * palSourceUnqueueBuffers ) ( ALuint source , ALsizei n , ALuint * buffers ) ;
2010-11-28 19:07:07 +00:00
2016-07-12 00:40:13 +00:00
//for extensions like efx
2019-09-04 07:59:40 +00:00
static AL_API ALboolean ( AL_APIENTRY * palIsExtensionPresent ) ( const ALchar * fextame ) ;
2016-07-12 00:40:13 +00:00
static AL_API void * ( AL_APIENTRY * palGetProcAddress ) ( const ALchar * fname ) ;
2010-11-28 19:07:07 +00:00
# define AL_NONE 0
# define AL_FALSE 0
# define AL_TRUE 1
# define AL_SOURCE_RELATIVE 0x202
# define AL_PITCH 0x1003
# define AL_POSITION 0x1004
# define AL_VELOCITY 0x1006
# define AL_LOOPING 0x1007
# define AL_BUFFER 0x1009
# define AL_GAIN 0x100A
# define AL_ORIENTATION 0x100F
2016-07-12 00:40:13 +00:00
# define AL_SOURCE_STATE 0x1010
# define AL_PLAYING 0x1012
# define AL_BUFFERS_QUEUED 0x1015
# define AL_BUFFERS_PROCESSED 0x1016
2010-11-28 19:07:07 +00:00
# define AL_REFERENCE_DISTANCE 0x1020
# define AL_ROLLOFF_FACTOR 0x1021
# define AL_MAX_DISTANCE 0x1023
2016-07-12 00:40:13 +00:00
# define AL_SAMPLE_OFFSET 0x1025
# define AL_SOURCE_TYPE 0x1027
# define AL_STREAMING 0x1029
2010-11-28 19:07:07 +00:00
# define AL_FORMAT_MONO8 0x1100
# define AL_FORMAT_MONO16 0x1101
# define AL_FORMAT_STEREO8 0x1102
# define AL_FORMAT_STEREO16 0x1103
2010-11-29 03:42:15 +00:00
# define AL_INVALID_NAME 0xA001
# define AL_INVALID_ENUM 0xA002
# define AL_INVALID_VALUE 0xA003
# define AL_INVALID_OPERATION 0xA004
2010-11-28 19:07:07 +00:00
# define AL_OUT_OF_MEMORY 0xA005
# define AL_VENDOR 0xB001
# define AL_VERSION 0xB002
# define AL_RENDERER 0xB003
# define AL_EXTENSIONS 0xB004
# define AL_DISTANCE_MODEL 0xD000
# define AL_INVERSE_DISTANCE 0xD001
# define AL_INVERSE_DISTANCE_CLAMPED 0xD002
# define AL_LINEAR_DISTANCE 0xD003
# define AL_LINEAR_DISTANCE_CLAMPED 0xD004
# define AL_EXPONENT_DISTANCE 0xD005
# define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
# if defined(_WIN32)
# define ALC_APIENTRY __cdecl
# else
# define ALC_APIENTRY
# endif
# define ALC_API
typedef char ALCboolean ;
typedef char ALCchar ;
typedef int ALCint ;
2013-10-26 02:50:24 +00:00
typedef unsigned int ALCuint ;
2010-11-28 19:07:07 +00:00
typedef int ALCenum ;
2013-10-26 02:50:24 +00:00
typedef size_t ALCsizei ;
2010-11-28 19:07:07 +00:00
typedef struct ALCdevice_struct ALCdevice ;
typedef struct ALCcontext_struct ALCcontext ;
2013-10-26 02:50:24 +00:00
typedef void ALCvoid ;
2010-11-28 19:07:07 +00:00
static ALC_API ALCdevice * ( ALC_APIENTRY * palcOpenDevice ) ( const ALCchar * devicename ) ;
static ALC_API ALCboolean ( ALC_APIENTRY * palcCloseDevice ) ( ALCdevice * device ) ;
static ALC_API ALCcontext * ( ALC_APIENTRY * palcCreateContext ) ( ALCdevice * device , const ALCint * attrlist ) ;
static ALC_API void ( ALC_APIENTRY * palcDestroyContext ) ( ALCcontext * context ) ;
static ALC_API ALCboolean ( ALC_APIENTRY * palcMakeContextCurrent ) ( ALCcontext * context ) ;
static ALC_API void ( ALC_APIENTRY * palcProcessContext ) ( ALCcontext * context ) ;
static ALC_API const ALCchar * ( ALC_APIENTRY * palcGetString ) ( ALCdevice * device , ALCenum param ) ;
static ALC_API ALCboolean ( ALC_APIENTRY * palcIsExtensionPresent ) ( ALCdevice * device , const ALCchar * extname ) ;
2021-10-12 04:42:07 +00:00
static ALC_API void * ( ALC_APIENTRY * palcGetProcAddress ) ( ALCdevice * device , const ALCchar * funcname ) ;
2010-11-28 19:07:07 +00:00
# define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
# define ALC_DEVICE_SPECIFIER 0x1005
# define ALC_EXTENSIONS 0x1006
2013-10-26 02:50:24 +00:00
# define ALC_ALL_DEVICES_SPECIFIER 0x1013 //ALC_ENUMERATE_ALL_EXT
2010-11-28 19:07:07 +00:00
//#include "AL/alut.h"
//#include "AL/al.h"
//#include "AL/alext.h"
2016-02-15 06:01:17 +00:00
# if defined(VOICECHAT)
2014-08-25 07:35:41 +00:00
//capture-specific stuff
static ALC_API void ( ALC_APIENTRY * palcGetIntegerv ) ( ALCdevice * device , ALCenum param , ALCsizei size , ALCint * data ) ;
static ALC_API ALCdevice * ( ALC_APIENTRY * palcCaptureOpenDevice ) ( const ALCchar * devicename , ALCuint frequency , ALCenum format , ALCsizei buffersize ) ;
static ALC_API ALCboolean ( ALC_APIENTRY * palcCaptureCloseDevice ) ( ALCdevice * device ) ;
static ALC_API void ( ALC_APIENTRY * palcCaptureStart ) ( ALCdevice * device ) ;
static ALC_API void ( ALC_APIENTRY * palcCaptureStop ) ( ALCdevice * device ) ;
static ALC_API void ( ALC_APIENTRY * palcCaptureSamples ) ( ALCdevice * device , ALCvoid * buffer , ALCsizei samples ) ;
# define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
# define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
# define ALC_CAPTURE_SAMPLES 0x312
2016-02-15 06:01:17 +00:00
# endif
2014-08-25 07:35:41 +00:00
# endif
2013-07-26 17:19:06 +00:00
//efx
2014-08-25 07:35:41 +00:00
# ifdef USEEFX
2013-07-26 17:19:06 +00:00
# define AL_AUXILIARY_SEND_FILTER 0x20006
# define AL_FILTER_NULL 0x0000
# define AL_EFFECTSLOT_EFFECT 0x0001
# define AL_EFFECT_TYPE 0x8001
# define AL_EFFECT_REVERB 0x0001
# define AL_EFFECT_EAXREVERB 0x8000
2014-08-25 07:35:41 +00:00
# define AL_REVERB_DENSITY 0x0001
# define AL_REVERB_DIFFUSION 0x0002
# define AL_REVERB_GAIN 0x0003
# define AL_REVERB_GAINHF 0x0004
# define AL_REVERB_DECAY_TIME 0x0005
# define AL_REVERB_DECAY_HFRATIO 0x0006
# define AL_REVERB_REFLECTIONS_GAIN 0x0007
# define AL_REVERB_REFLECTIONS_DELAY 0x0008
# define AL_REVERB_LATE_REVERB_GAIN 0x0009
# define AL_REVERB_LATE_REVERB_DELAY 0x000A
# define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
# define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
# define AL_REVERB_DECAY_HFLIMIT 0x000D
/* EAX Reverb effect parameters */
# define AL_EAXREVERB_DENSITY 0x0001
# define AL_EAXREVERB_DIFFUSION 0x0002
# define AL_EAXREVERB_GAIN 0x0003
# define AL_EAXREVERB_GAINHF 0x0004
# define AL_EAXREVERB_GAINLF 0x0005
# define AL_EAXREVERB_DECAY_TIME 0x0006
# define AL_EAXREVERB_DECAY_HFRATIO 0x0007
# define AL_EAXREVERB_DECAY_LFRATIO 0x0008
# define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
# define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
# define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
# define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
# define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
# define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
# define AL_EAXREVERB_ECHO_TIME 0x000F
# define AL_EAXREVERB_ECHO_DEPTH 0x0010
# define AL_EAXREVERB_MODULATION_TIME 0x0011
# define AL_EAXREVERB_MODULATION_DEPTH 0x0012
# define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
# define AL_EAXREVERB_HFREFERENCE 0x0014
# define AL_EAXREVERB_LFREFERENCE 0x0015
# define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
2013-07-26 17:19:06 +00:00
# define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
static AL_API void ( AL_APIENTRY * palSource3i ) ( ALuint source , ALenum param , ALint value1 , ALint value2 , ALint value3 ) ;
static AL_API void ( AL_APIENTRY * palAuxiliaryEffectSloti ) ( ALuint effectslot , ALenum param , ALint iValue ) ;
static AL_API ALvoid ( AL_APIENTRY * palGenAuxiliaryEffectSlots ) ( ALsizei n , ALuint * effectslots ) ;
static AL_API ALvoid ( AL_APIENTRY * palDeleteAuxiliaryEffectSlots ) ( ALsizei n , const ALuint * effectslots ) ;
static AL_API ALvoid ( AL_APIENTRY * palDeleteEffects ) ( ALsizei n , const ALuint * effects ) ;
static AL_API ALvoid ( AL_APIENTRY * palGenEffects ) ( ALsizei n , ALuint * effects ) ;
2014-08-25 07:35:41 +00:00
static AL_API ALvoid ( AL_APIENTRY * palEffecti ) ( ALuint effect , ALenum param , ALint iValue ) ;
static AL_API ALvoid ( AL_APIENTRY * palEffectiv ) ( ALuint effect , ALenum param , const ALint * piValues ) ;
static AL_API ALvoid ( AL_APIENTRY * palEffectf ) ( ALuint effect , ALenum param , ALfloat flValue ) ;
2013-07-26 17:19:06 +00:00
static AL_API ALvoid ( AL_APIENTRY * palEffectfv ) ( ALuint effect , ALenum param , const ALfloat * pflValues ) ;
2014-08-25 07:35:41 +00:00
# endif
2010-11-28 19:07:07 +00:00
2019-09-04 07:59:40 +00:00
//AL_EXT_float32
# define AL_FORMAT_MONO_FLOAT32 0x10010
# define AL_FORMAT_STEREO_FLOAT32 0x10011
2021-10-12 04:42:07 +00:00
//AL_SOFT_source_spatialize
# define AL_SOURCE_SPATIALIZE_SOFT 0x1214
2021-10-22 22:27:21 +00:00
//AL_SOFT_loop_points
# define AL_LOOP_POINTS_SOFT 0x2015
2021-10-12 04:42:07 +00:00
//ALC_SOFT_HRTF
# define ALC_HRTF_SOFT 0x1992
# define ALC_DONT_CARE_SOFT 0x0002
# define ALC_HRTF_STATUS_SOFT 0x1993
# define ALC_HRTF_DISABLED_SOFT 0x0000
# define ALC_HRTF_ENABLED_SOFT 0x0001
# define ALC_HRTF_DENIED_SOFT 0x0002
# define ALC_HRTF_REQUIRED_SOFT 0x0003
# define ALC_HRTF_HEADPHONES_DETECTED_SOFT 0x0004
# define ALC_HRTF_UNSUPPORTED_FORMAT_SOFT 0x0005
# define ALC_NUM_HRTF_SPECIFIERS_SOFT 0x1994
# define ALC_HRTF_SPECIFIER_SOFT 0x1995
# define ALC_HRTF_ID_SOFT 0x1996
static const ALCchar * ( * palcGetStringiSOFT ) ( ALCdevice * device , ALCenum paramName , ALCsizei index ) ;
2015-08-07 17:49:49 +00:00
# define SOUNDVARS SDRVNAME" variables"
2010-11-28 19:07:07 +00:00
2019-12-10 14:50:47 +00:00
extern sfx_t * known_sfx ; //sfxindex = (sfx-known_sfx);
2010-11-28 19:07:07 +00:00
2019-02-01 08:29:14 +00:00
# ifdef USEEFX
2016-07-12 00:40:13 +00:00
static ALuint OpenAL_LoadEffect ( const struct reverbproperties_s * reverb ) ;
2019-02-01 08:29:14 +00:00
# endif
2016-07-12 00:40:13 +00:00
static void OpenAL_Shutdown ( soundcardinfo_t * sc ) ;
static void QDECL OnChangeALSettings ( cvar_t * var , char * value ) ;
2010-11-28 19:07:07 +00:00
/*
static void S_Init_f ( void ) ;
static void S_Info ( void ) ;
static void S_Shutdown_f ( void ) ;
*/
2021-10-22 22:27:21 +00:00
# ifdef FTE_TARGET_WEB
static cvar_t s_al_disable = CVARD ( " s_al_disable " , " 1 " , " 0: OpenAL works (generally as the highest priority). \n 1: OpenAL will be used only when a specific device is selected. \n 2: Don't allow ANY use of OpenAl. \n With OpenAL disabled, audio ouput will fall back to platform-specific output, avoiding miscilaneous third-party openal limitation bugs. " ) ;
# else
2019-12-16 17:36:00 +00:00
static cvar_t s_al_disable = CVARD ( " s_al_disable " , " 0 " , " 0: OpenAL works (generally as the highest priority). \n 1: OpenAL will be used only when a specific device is selected. \n 2: Don't allow ANY use of OpenAl. \n With OpenAL disabled, audio ouput will fall back to platform-specific output, avoiding miscilaneous third-party openal limitation bugs. " ) ;
2021-10-22 22:27:21 +00:00
# endif
2019-05-23 15:11:32 +00:00
static cvar_t s_al_debug = CVARD ( " s_al_debug " , " 0 " , " Enables periodic checks for OpenAL errors. " ) ;
2021-10-12 04:42:07 +00:00
static cvar_t s_al_hrtf = CVARD ( " s_al_hrtf " , " " , " Enables use of HRTF, and which HRTF table to use. \n empty: auto, depending on openal config to enable it. \n \0 : force off. \n 1: Use the default HRTF. " ) ;
2019-05-23 15:11:32 +00:00
static cvar_t s_al_use_reverb = CVARD ( " s_al_use_reverb " , " 1 " , " Controls whether reverb effects will be used. Set to 0 to block them. Reverb requires gamecode to configure the reverb properties, other than underwater. " ) ;
2019-07-19 02:13:19 +00:00
//static cvar_t s_al_max_distance = CVARFC("s_al_max_distance", "1000",0,OnChangeALSettings);
2019-05-23 15:11:32 +00:00
static cvar_t s_al_speedofsound = CVARFCD ( " s_al_speedofsound " , " 343.3 " , 0 , OnChangeALSettings , " Configures the speed of sound, in game units per second. This affects doppler. " ) ;
static cvar_t s_al_dopplerfactor = CVARFCD ( " s_al_dopplerfactor " , " 1.0 " , 0 , OnChangeALSettings , " Multiplies the strength of doppler effects. " ) ;
static cvar_t s_al_distancemodel = CVARFCD ( " s_al_distancemodel " , legacyval ( " 2 " , " 0 " ) , 0 , OnChangeALSettings , " Controls how sounds fade with distance. \n 0: Inverse (most realistic) \n 1: Inverse Clamped \n 2: Linear (Quake-like) \n 3: Linear Clamped \n 4: Exponential \n 5: Exponential Clamped \n 6: None " ) ;
//static cvar_t s_al_rolloff_factor = CVAR("s_al_rolloff_factor", "1");
static cvar_t s_al_reference_distance = CVARD ( " s_al_reference_distance " , " 120 " , " This is the distance at which the sound is audiable with standard volume in the inverse distance models. Nearer sounds will be louder than the original sample. " ) ;
static cvar_t s_al_velocityscale = CVARD ( " s_al_velocityscale " , " 1 " , " Rescales velocity values, before doppler can be calculated. " ) ;
2010-11-28 19:07:07 +00:00
static cvar_t s_al_static_listener = CVAR ( " s_al_static_listener " , " 0 " ) ; //cheat
2016-07-12 00:40:13 +00:00
extern cvar_t snd_doppler ;
2010-11-28 19:07:07 +00:00
2018-08-04 19:00:19 +00:00
enum distancemodel_e
{
DM_INVERSE = 0 ,
DM_INVERSE_CLAMPED = 1 ,
DM_LINEAR = 2 ,
DM_LINEAR_CLAMPED = 3 ,
DM_EXPONENT = 4 ,
DM_EXPONENT_CLAMPED = 5 ,
DM_NONE = 6
} ;
2013-07-26 17:19:06 +00:00
typedef struct
{
2021-10-22 22:27:21 +00:00
struct
{
ALuint handle ;
unsigned int queuesize ;
ALuint queue [ 64 ] ;
} qmix ;
2019-12-10 14:50:47 +00:00
struct
{
ALuint handle ;
qbyte allocated ; //there is no guarenteed-unused handle (and I don't want to have to keep spamming alIsSource).
2021-09-16 20:08:30 +00:00
qbyte queuesize ;
ALuint queue [ 3 ] ;
2019-12-10 14:50:47 +00:00
} * source ;
2017-01-13 00:39:50 +00:00
size_t max_sources ;
2010-11-28 19:07:07 +00:00
2019-12-10 14:50:47 +00:00
struct
{
ALuint buffer ;
qbyte allocated ; //again no guarentee.
} * sounds ;
size_t max_sounds ;
2013-07-26 17:19:06 +00:00
ALCdevice * OpenAL_Device ;
ALCcontext * OpenAL_Context ;
2021-10-12 04:42:07 +00:00
qboolean can_source_spatialise ;
2021-10-22 22:27:21 +00:00
qboolean can_looppoints ;
2010-11-28 19:07:07 +00:00
2016-07-12 00:40:13 +00:00
int ListenEnt ; //listener's entity number, so we don't get weird sound displacements
ALfloat ListenPos [ 3 ] ; //their origin.
ALfloat ListenVel [ 3 ] ; // Velocity of the listener.
ALfloat ListenOri [ 6 ] ; // Orientation of the listener. (first 3 elements are "at", second 3 are "up")
2021-10-22 22:27:21 +00:00
unsigned int listenerdirty ;
2010-11-28 19:07:07 +00:00
2019-09-04 07:59:40 +00:00
# ifdef MIXER_F32
qboolean canfloataudio ;
# endif
2013-07-26 17:19:06 +00:00
int cureffect ;
ALuint effectslot ; //the global reverb slot
2016-07-12 00:40:13 +00:00
size_t numeffecttypes ;
struct
{
ALuint effect ;
unsigned int modificationcount ; //so we know if reverb state needs to get rebuilt
} * effecttype ;
2013-07-26 17:19:06 +00:00
} oalinfo_t ;
2010-11-28 19:07:07 +00:00
static void PrintALError ( char * string )
{
ALenum err ;
char * text = NULL ;
if ( ! s_al_debug . value )
return ;
err = palGetError ( ) ;
switch ( err )
{
case 0 :
return ;
case AL_INVALID_NAME :
text = " invalid name " ;
break ;
case AL_INVALID_ENUM :
text = " invalid enum " ;
break ;
case AL_INVALID_VALUE :
text = " invalid value " ;
break ;
case AL_INVALID_OPERATION :
text = " invalid operation " ;
break ;
case AL_OUT_OF_MEMORY :
text = " out of memory " ;
break ;
default :
text = " unknown " ;
break ;
}
Con_Printf ( " OpenAL - %s: %x: %s \n " , string , err , text ) ;
}
2021-10-22 22:27:21 +00:00
static qboolean OpenAL_LoadCache ( oalinfo_t * oali , unsigned int * bufptr , sfxcache_t * sc , float volume , int loopstart )
2010-11-28 19:07:07 +00:00
{
unsigned int fmt ;
unsigned int size ;
2020-04-29 10:43:22 +00:00
switch ( sc - > format )
2010-11-28 19:07:07 +00:00
{
2015-04-21 04:12:00 +00:00
# ifdef FTE_TARGET_WEB
2020-04-29 10:43:22 +00:00
case QAF_BLOB :
2015-04-21 04:12:00 +00:00
palGenBuffers ( 1 , bufptr ) ;
emscriptenfte_al_loadaudiofile ( * bufptr , sc - > data , sc - > length ) ;
2019-12-10 14:50:47 +00:00
//alIsBuffer will report false until success or failure...
return true ; //but we do have a 'proper' reference to the buffer.
2015-04-21 04:12:00 +00:00
# endif
2020-04-29 10:43:22 +00:00
case QAF_S8 :
2010-11-28 19:07:07 +00:00
if ( sc - > numchannels = = 2 )
{
fmt = AL_FORMAT_STEREO8 ;
size = sc - > length * 2 ;
}
else
{
fmt = AL_FORMAT_MONO8 ;
size = sc - > length * 1 ;
}
break ;
2020-04-29 10:43:22 +00:00
case QAF_S16 :
2010-11-28 19:07:07 +00:00
if ( sc - > numchannels = = 2 )
{
fmt = AL_FORMAT_STEREO16 ;
size = sc - > length * 4 ;
}
else
{
fmt = AL_FORMAT_MONO16 ;
size = sc - > length * 2 ;
}
break ;
2019-09-04 07:59:40 +00:00
# ifdef MIXER_F32
2020-04-29 10:43:22 +00:00
case QAF_F32 :
2019-09-04 07:59:40 +00:00
if ( ! oali - > canfloataudio )
return false ;
if ( sc - > numchannels = = 2 )
{
fmt = AL_FORMAT_STEREO_FLOAT32 ;
size = sc - > length * 8 ;
}
else
{
fmt = AL_FORMAT_MONO_FLOAT32 ;
size = sc - > length * 4 ;
}
break ;
# endif
2010-11-28 19:07:07 +00:00
default :
2015-04-21 04:12:00 +00:00
return false ;
2010-11-28 19:07:07 +00:00
}
PrintALError ( " pre Buffer Data " ) ;
2013-07-26 17:19:06 +00:00
palGenBuffers ( 1 , bufptr ) ;
2010-11-28 19:07:07 +00:00
/*openal is inconsistant and supports only 8bit unsigned or 16bit signed*/
2016-07-12 00:40:13 +00:00
if ( ! sc - > data )
{
//buffer some silence.
short * tmp = malloc ( size ) ;
memset ( tmp , 0 , size ) ;
palBufferData ( * bufptr , fmt , tmp , size , sc - > speed ) ;
free ( tmp ) ;
}
else if ( volume ! = 1 )
2010-11-28 19:07:07 +00:00
{
2020-04-29 10:43:22 +00:00
switch ( sc - > format )
2010-11-28 19:07:07 +00:00
{
2020-04-29 12:25:24 +00:00
# ifdef FTE_TARGET_WEB
case QAF_BLOB :
break ; //unreachable
# endif
2020-04-29 10:43:22 +00:00
case QAF_S8 :
2014-03-30 08:55:06 +00:00
{
2020-04-29 10:43:22 +00:00
unsigned char * tmp = malloc ( size ) ;
char * src = sc - > data ;
int i ;
for ( i = 0 ; i < size ; i + + )
tmp [ i ] = src [ i ] * volume + 128 ; //signed->unsigned
palBufferData ( * bufptr , fmt , tmp , size , sc - > speed ) ;
free ( tmp ) ;
2014-03-30 08:55:06 +00:00
}
2020-04-29 10:43:22 +00:00
break ;
case QAF_S16 :
2014-03-30 08:55:06 +00:00
{
2020-04-29 10:43:22 +00:00
short * tmp = malloc ( size ) ;
short * src = ( short * ) sc - > data ;
int i ;
for ( i = 0 ; i < ( size > > 1 ) ; i + + )
tmp [ i ] = bound ( - 32767 , src [ i ] * volume , 32767 ) ; //signed.
palBufferData ( * bufptr , fmt , tmp , size , sc - > speed ) ;
free ( tmp ) ;
2014-03-30 08:55:06 +00:00
}
2020-04-29 10:43:22 +00:00
break ;
2019-09-04 07:59:40 +00:00
# ifdef MIXER_F32
2020-04-29 10:43:22 +00:00
case QAF_F32 :
2019-09-04 07:59:40 +00:00
{
2020-04-29 10:43:22 +00:00
float * tmp = malloc ( size ) ;
float * src = ( float * ) sc - > data ;
int i ;
for ( i = 0 ; i < ( size > > 2 ) ; i + + )
tmp [ i ] = src [ i ] * volume ; //signed. oversaturation isn't my problem
palBufferData ( * bufptr , fmt , tmp , size , sc - > speed ) ;
free ( tmp ) ;
2019-09-04 07:59:40 +00:00
}
2020-04-29 10:43:22 +00:00
break ;
2019-09-04 07:59:40 +00:00
# endif
2020-04-29 10:43:22 +00:00
}
2010-11-28 19:07:07 +00:00
}
else
2014-03-30 08:55:06 +00:00
{
2020-04-29 10:43:22 +00:00
switch ( sc - > format )
2014-03-30 08:55:06 +00:00
{
2020-04-29 12:25:24 +00:00
# ifdef FTE_TARGET_WEB
case QAF_BLOB :
break ; //unreachable
# endif
2020-04-29 10:43:22 +00:00
case QAF_S8 :
2014-03-30 08:55:06 +00:00
{
2020-04-29 10:43:22 +00:00
unsigned char * tmp = malloc ( size ) ;
char * src = sc - > data ;
int i ;
for ( i = 0 ; i < size ; i + + )
{
tmp [ i ] = src [ i ] + 128 ;
}
palBufferData ( * bufptr , fmt , tmp , size , sc - > speed ) ;
free ( tmp ) ;
2014-03-30 08:55:06 +00:00
}
2020-04-29 10:43:22 +00:00
break ;
//case QAF_U8:
case QAF_S16 :
//case QAF_S32:
# ifdef MIXER_F32
case QAF_F32 :
2015-04-21 04:12:00 +00:00
# endif
2020-04-29 10:43:22 +00:00
palBufferData ( * bufptr , fmt , sc - > data , size , sc - > speed ) ;
break ;
2015-04-21 04:12:00 +00:00
}
2014-03-30 08:55:06 +00:00
}
2010-11-28 19:07:07 +00:00
2021-10-22 22:27:21 +00:00
if ( oali - > can_looppoints & & loopstart > 0 )
{
ALint points [ 2 ] = { loopstart , sc - > length } ;
palBufferiv ( * bufptr , AL_LOOP_POINTS_SOFT , points ) ;
}
2010-11-28 19:07:07 +00:00
//FIXME: we need to handle oal-oom error codes
PrintALError ( " Buffer Data " ) ;
2015-04-21 04:12:00 +00:00
return true ;
2010-11-28 19:07:07 +00:00
}
2017-09-20 11:27:13 +00:00
static void QDECL OpenAL_CvarInit ( void )
2010-11-28 19:07:07 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cvar_Register ( & s_al_disable , SOUNDVARS ) ;
2010-11-28 19:07:07 +00:00
Cvar_Register ( & s_al_debug , SOUNDVARS ) ;
2021-10-12 04:42:07 +00:00
Cvar_Register ( & s_al_hrtf , SOUNDVARS ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & s_al_use_reverb , SOUNDVARS ) ;
2019-07-19 02:13:19 +00:00
// Cvar_Register(&s_al_max_distance, SOUNDVARS);
2010-11-28 19:07:07 +00:00
Cvar_Register ( & s_al_dopplerfactor , SOUNDVARS ) ;
Cvar_Register ( & s_al_distancemodel , SOUNDVARS ) ;
Cvar_Register ( & s_al_reference_distance , SOUNDVARS ) ;
2019-05-23 15:11:32 +00:00
// Cvar_Register(&s_al_rolloff_factor, SOUNDVARS);
2010-11-28 19:07:07 +00:00
Cvar_Register ( & s_al_velocityscale , SOUNDVARS ) ;
Cvar_Register ( & s_al_static_listener , SOUNDVARS ) ;
Cvar_Register ( & s_al_speedofsound , SOUNDVARS ) ;
}
2016-07-12 00:40:13 +00:00
static void OpenAL_ListenerUpdate ( soundcardinfo_t * sc , int entnum , vec3_t origin , vec3_t forward , vec3_t right , vec3_t up , vec3_t velocity )
2010-11-28 19:07:07 +00:00
{
2013-07-26 17:19:06 +00:00
oalinfo_t * oali = sc - > handle ;
2021-10-22 22:27:21 +00:00
vec3_t vel ;
2013-07-26 17:19:06 +00:00
2016-07-26 11:47:59 +00:00
if ( snd_doppler . modified )
{
snd_doppler . modified = false ;
OnChangeALSettings ( NULL , NULL ) ;
}
2021-10-22 22:27:21 +00:00
if ( ! VectorCompare ( origin , oali - > ListenPos ) )
{
VectorCopy ( origin , oali - > ListenPos ) ;
oali - > listenerdirty | = 1 ;
}
VectorScale ( velocity , s_al_velocityscale . value / 35.0 , vel ) ;
if ( ! VectorCompare ( vel , oali - > ListenVel ) )
{
VectorCopy ( vel , oali - > ListenVel ) ;
oali - > listenerdirty | = 2 ;
}
2010-11-28 19:07:07 +00:00
2016-07-12 00:40:13 +00:00
oali - > ListenEnt = entnum ;
2021-10-22 22:27:21 +00:00
if ( ! VectorCompare ( forward , oali - > ListenOri ) | | ! VectorCompare ( up , oali - > ListenOri + 3 ) )
{
oali - > ListenOri [ 0 ] = forward [ 0 ] ;
oali - > ListenOri [ 1 ] = forward [ 1 ] ;
oali - > ListenOri [ 2 ] = forward [ 2 ] ;
oali - > ListenOri [ 3 ] = up [ 0 ] ;
oali - > ListenOri [ 4 ] = up [ 1 ] ;
oali - > ListenOri [ 5 ] = up [ 2 ] ;
oali - > listenerdirty | = 4 ;
}
2010-12-05 02:46:07 +00:00
2010-11-28 19:07:07 +00:00
if ( ! s_al_static_listener . value )
{
2021-10-22 22:27:21 +00:00
//I'm using listenerdirty flags because emscripten's openal stuff seems to be wasting massive amounts of time on these.
// palListenerf(AL_GAIN, 1);
if ( oali - > listenerdirty & 1 )
palListenerfv ( AL_POSITION , oali - > ListenPos ) ;
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
# ifndef FTE_TARGET_WEB //webaudio sucks.
2021-10-22 22:27:21 +00:00
if ( oali - > listenerdirty & 2 )
palListenerfv ( AL_VELOCITY , oali - > ListenVel ) ;
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
# endif
2021-10-22 22:27:21 +00:00
if ( oali - > listenerdirty & 4 )
palListenerfv ( AL_ORIENTATION , oali - > ListenOri ) ;
oali - > listenerdirty = 0 ;
2010-11-28 19:07:07 +00:00
}
}
2010-12-05 02:46:07 +00:00
2016-07-12 00:40:13 +00:00
static qboolean OpenAL_ReclaimASource ( soundcardinfo_t * sc )
{
oalinfo_t * oali = sc - > handle ;
ALuint src ;
ALuint buf ;
int i ;
int success = 0 ;
for ( i = 0 ; i < sc - > total_chans ; i + + )
{
// channel_t *chan = &sc->channel[i];
2019-12-10 14:50:47 +00:00
src = oali - > source [ i ] . handle ;
if ( oali - > source [ i ] . allocated )
2016-07-12 00:40:13 +00:00
{
palGetSourcei ( src , AL_SOURCE_STATE , & buf ) ;
if ( buf ! = AL_PLAYING )
{
palDeleteSources ( 1 , & src ) ;
2021-09-16 20:08:30 +00:00
if ( oali - > source [ i ] . queuesize )
palDeleteBuffers ( oali - > source [ i ] . queuesize , oali - > source [ i ] . queue ) ;
oali - > source [ i ] . queuesize = 0 ;
2019-12-10 14:50:47 +00:00
oali - > source [ i ] . handle = 0 ;
oali - > source [ i ] . allocated = false ;
2016-07-12 00:40:13 +00:00
success + + ;
}
}
}
if ( ! success )
{
2021-11-14 00:34:59 +00:00
int furthest = - 1 ;
float dist , bdist = - 1 ;
vec3_t d ;
for ( i = DYNAMIC_FIRST ; i < sc - > total_chans ; i + + )
{
2019-12-10 14:50:47 +00:00
if ( oali - > source [ i ] . allocated )
2016-07-12 00:40:13 +00:00
{
2021-11-14 00:34:59 +00:00
VectorSubtract ( sc - > channel [ i ] . origin , oali - > ListenPos , d ) ;
dist = DotProduct ( d , d ) ;
if ( dist > bdist )
{
bdist = dist ;
furthest = i ;
}
2016-07-12 00:40:13 +00:00
}
}
2021-11-14 00:34:59 +00:00
if ( furthest > = 0 )
{
i = furthest ;
palDeleteSources ( 1 , & oali - > source [ i ] . handle ) ;
if ( oali - > source [ i ] . queuesize )
palDeleteBuffers ( oali - > source [ i ] . queuesize , oali - > source [ i ] . queue ) ;
oali - > source [ i ] . queuesize = 0 ;
oali - > source [ i ] . handle = 0 ;
oali - > source [ i ] . allocated = false ;
success + + ;
}
2016-07-12 00:40:13 +00:00
}
return success ;
}
2019-03-23 07:06:37 +00:00
//for querying sound offsets (for various hacks).
static ssamplepos_t OpenAL_GetChannelPos ( soundcardinfo_t * sc , channel_t * chan )
{
ALint spos = 0 ;
oalinfo_t * oali = sc - > handle ;
int chnum = chan - sc - > channel ;
ALuint src ;
2019-12-10 14:50:47 +00:00
src = oali - > source [ chnum ] . handle ;
if ( ! oali - > source [ chnum ] . allocated )
2019-03-23 07:06:37 +00:00
return ( ssamplepos_t ) ( ~ ( usamplepos_t ) 0 ) > > 1 ; //not actually playing...
2019-12-10 14:50:47 +00:00
//alcMakeContextCurrent
2019-03-23 07:06:37 +00:00
palGetSourcei ( src , AL_SAMPLE_OFFSET , & spos ) ;
2019-12-10 14:50:47 +00:00
return spos ; //FIXME: result is probably going to be wrong when streaming
2019-03-23 07:06:37 +00:00
}
2013-10-26 02:50:24 +00:00
//schanged says the sample has changed, otherwise its merely moved around a little, maybe changed in volume, but nothing that will restart it.
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
static void OpenAL_ChannelUpdate ( soundcardinfo_t * sc , channel_t * chan , chanupdatereason_t schanged )
2010-12-05 02:46:07 +00:00
{
2013-07-26 17:19:06 +00:00
oalinfo_t * oali = sc - > handle ;
2010-12-05 02:46:07 +00:00
ALuint src ;
sfx_t * sfx = chan - > sfx ;
2014-03-30 08:55:06 +00:00
float pitch , cvolume ;
2013-07-26 17:19:06 +00:00
int chnum = chan - sc - > channel ;
ALuint buf ;
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 stream ;
qboolean srcrel ;
2021-09-16 20:08:30 +00:00
ALuint processed ;
2013-07-26 17:19:06 +00:00
2017-01-13 00:39:50 +00:00
if ( chnum > = oali - > max_sources )
2019-12-10 14:50:47 +00:00
Z_ReallocElements ( ( void * * ) & oali - > source , & oali - > max_sources , chnum + 1 + 64 , sizeof ( * oali - > source ) ) ;
2010-12-05 02:46:07 +00:00
2016-07-12 00:40:13 +00:00
//alcMakeContextCurrent
2019-12-10 14:50:47 +00:00
if ( ! oali - > source [ chnum ] . allocated )
2010-12-05 02:46:07 +00:00
{
2013-07-26 17:19:06 +00:00
//not currently playing. be prepared to create one
2010-12-05 02:46:07 +00:00
if ( ! sfx | | chan - > master_vol = = 0 )
return ;
2019-12-10 14:50:47 +00:00
palGetError ( ) ; //gah this is so shite
2010-12-05 02:46:07 +00:00
palGenSources ( 1 , & src ) ;
2019-12-10 14:50:47 +00:00
if ( palGetError ( ) | | ! palIsSource ( src ) )
{ //can't just test for invalid, and failure leaving src unchanged could refer to a different sound.
//try to kill some pther sound
2016-07-12 00:40:13 +00:00
if ( OpenAL_ReclaimASource ( sc ) )
2019-12-10 14:50:47 +00:00
{ //okay, we killed one. hopefully we can start a new one now.
2016-07-12 00:40:13 +00:00
palGenSources ( 1 , & src ) ;
2019-12-10 14:50:47 +00:00
if ( palGetError ( ) | | ! palIsSource ( src ) )
{
PrintALError ( " alGenSources " ) ;
return ;
}
2016-07-12 00:40:13 +00:00
}
2019-12-10 14:50:47 +00:00
else return ;
2013-07-26 17:19:06 +00:00
}
2019-12-10 14:50:47 +00:00
oali - > source [ chnum ] . handle = src ;
oali - > source [ chnum ] . allocated = true ;
2021-10-22 22:27:21 +00:00
oali - > source [ chnum ] . queuesize = 0 ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
schanged | = CUR_EVERYTHING ; //should normally be true anyway, but hey
2010-12-05 02:46:07 +00:00
}
2020-03-25 21:29:30 +00:00
else
src = oali - > source [ chnum ] . handle ;
2010-12-05 02:46:07 +00:00
PrintALError ( " pre start sound " ) ;
2020-03-25 21:29:30 +00:00
if ( schanged & CUR_SOUNDCHANGE )
2021-09-16 20:08:30 +00:00
{
2010-12-05 02:46:07 +00:00
palSourceStop ( src ) ;
2021-09-16 20:08:30 +00:00
palSourcei ( src , AL_BUFFER , 0 ) ;
if ( oali - > source [ chnum ] . queuesize )
palDeleteBuffers ( oali - > source [ chnum ] . queuesize , oali - > source [ chnum ] . queue ) ;
oali - > source [ chnum ] . queuesize = 0 ;
2010-12-05 02:46:07 +00:00
2021-09-16 20:08:30 +00:00
}
else if ( oali - > source [ chnum ] . queuesize )
2013-07-26 17:19:06 +00:00
{
2021-09-16 20:08:30 +00:00
//reclaim any queued buffers
palGetSourcei ( src , AL_BUFFERS_PROCESSED , & processed ) ;
if ( processed )
2013-07-26 17:19:06 +00:00
{
2021-09-16 20:08:30 +00:00
palSourceUnqueueBuffers ( src , processed , oali - > source [ chnum ] . queue ) ;
palDeleteBuffers ( processed , oali - > source [ chnum ] . queue ) ;
oali - > source [ chnum ] . queuesize - = processed ;
memmove ( oali - > source [ chnum ] . queue , oali - > source [ chnum ] . queue + processed , oali - > source [ chnum ] . queuesize * sizeof ( * oali - > source [ chnum ] . queue ) ) ;
2015-04-21 04:12:00 +00:00
}
2020-03-25 21:29:30 +00:00
}
2021-09-16 20:08:30 +00:00
if ( ! schanged & & sfx ) //if we don't figure out when they've finished, they'll not get replaced properly.
2020-03-25 21:29:30 +00:00
{
palGetSourcei ( src , AL_SOURCE_STATE , & buf ) ;
if ( buf ! = AL_PLAYING )
2015-04-21 04:12:00 +00:00
{
2020-03-25 21:29:30 +00:00
schanged | = CUR_EVERYTHING ;
if ( sfx - > loopstart ! = - 1 )
chan - > pos = sfx - > loopstart < < PITCHSHIFT ;
else if ( chan - > flags & CF_FORCELOOP )
chan - > pos = 0 ;
else
sfx = chan - > sfx = NULL ;
2013-07-26 17:19:06 +00:00
}
}
2010-12-05 02:46:07 +00:00
/*just wanted to stop it?*/
2020-02-11 23:08:11 +00:00
if ( ! sfx )
2010-12-05 02:46:07 +00:00
{
2014-08-25 07:35:41 +00:00
# ifdef FTE_TARGET_WEB
2020-03-25 21:29:30 +00:00
//emscripten's webaudio wrapper spams error messages after alDeleteSources has been called, if the context isn't also killed.
if ( ! schanged )
palSourceStop ( src ) ;
2014-08-25 07:35:41 +00:00
# else
2020-03-25 21:29:30 +00:00
palDeleteSources ( 1 , & src ) ;
2021-09-16 20:08:30 +00:00
if ( oali - > source [ chnum ] . queuesize )
palDeleteBuffers ( oali - > source [ chnum ] . queuesize , oali - > source [ chnum ] . queue ) ;
oali - > source [ chnum ] . queuesize = 0 ;
2020-03-25 21:29:30 +00:00
oali - > source [ chnum ] . handle = 0 ;
oali - > source [ chnum ] . allocated = false ;
2014-08-25 07:35:41 +00:00
# endif
2010-12-05 02:46:07 +00:00
return ;
}
2014-03-30 08:55:06 +00:00
cvolume = chan - > master_vol / 255.0f ;
2018-10-17 00:43:04 +00:00
if ( ! ( chan - > flags & CF_CL_ABSVOLUME ) )
2014-03-30 08:55:06 +00:00
cvolume * = volume . value * voicevolumemod ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
else
cvolume * = mastervolume . value ;
2014-03-30 08:55:06 +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
//openal doesn't support loopstart (entire sample loops or not at all), so if we're meant to skip the first half then we need to stream it.
2021-10-22 22:27:21 +00:00
//FIXME: AL_SOFT_loop_points
stream = sfx - > decoder . decodedata | | ( sfx - > loopstart > 0 & & ! oali - > can_looppoints ) ;
srcrel = ( chan - > flags & CF_NOSPACIALISE ) | | ( chan - > entnum & & chan - > entnum = = oali - > ListenEnt ) | | ! chan - > dist_mult ;
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
2021-10-05 05:05:43 +00:00
if ( ( schanged & CUR_SOUNDCHANGE ) | | stream )
2010-12-05 02:46:07 +00:00
{
2019-12-10 14:50:47 +00:00
int sndnum = sfx - known_sfx ;
int buf ;
if ( sndnum > = oali - > max_sounds )
Z_ReallocElements ( ( void * * ) & oali - > sounds , & oali - > max_sounds , sndnum + 1 + 64 , sizeof ( * oali - > sounds ) ) ;
buf = oali - > sounds [ sndnum ] . buffer ;
if ( ! oali - > sounds [ sndnum ] . allocated | | stream )
2010-12-05 02:46:07 +00:00
{
2018-09-23 19:35:24 +00:00
if ( ! S_LoadSound ( sfx , false ) )
2013-07-26 17:19:06 +00:00
return ; //can't load it
2015-02-02 08:01:53 +00:00
if ( sfx - > loadstate ! = SLS_LOADED )
2015-04-21 04:12:00 +00:00
{
if ( sfx - > loadstate = = SLS_LOADING )
2019-12-10 14:50:47 +00:00
{ //kill the source so that it gets regenerated again soonish
2015-04-21 04:12:00 +00:00
palDeleteSources ( 1 , & src ) ;
2019-12-10 14:50:47 +00:00
oali - > source [ chnum ] . handle = 0 ;
oali - > source [ chnum ] . allocated = false ;
2015-04-21 04:12:00 +00:00
}
2015-02-02 08:01:53 +00:00
return ; //not available yet
2015-04-21 04:12:00 +00:00
}
2021-09-16 20:08:30 +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
if ( stream )
2013-07-26 17:19:06 +00:00
{
int offset ;
2015-04-21 04:12:00 +00:00
sfxcache_t sbuf , * sc ;
2021-09-16 20:08:30 +00:00
while ( oali - > source [ chnum ] . queuesize < countof ( oali - > source [ chnum ] . queue ) )
2015-04-21 04:12:00 +00:00
{ //decode periodically instead of all at the start.
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
int tryduration = snd_speed * 0.5 ;
ssamplepos_t pos = chan - > pos > > PITCHSHIFT ;
if ( sfx - > decoder . decodedata )
sc = sfx - > decoder . decodedata ( sfx , & sbuf , pos , tryduration ) ;
else
{
sc = sfx - > decoder . buf ;
if ( pos > = sc - > length )
sc = NULL ;
}
2015-08-02 19:08:36 +00:00
if ( sc )
{
memcpy ( & sbuf , sc , sizeof ( sbuf ) ) ;
//hack up the sound to offset it correctly
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
if ( pos < sbuf . soundoffset | | pos > sbuf . soundoffset + sbuf . length )
sbuf . length = 0 ; //didn't contain the requested samples... the decoder is struggling.
else
{
offset = pos - sbuf . soundoffset ;
2020-04-29 10:43:22 +00:00
sbuf . data + = offset * QAF_BYTES ( sc - > format ) * sc - > numchannels ;
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
sbuf . length - = offset ;
}
2015-08-02 19:08:36 +00:00
sbuf . soundoffset = 0 ;
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
if ( sbuf . length > tryduration )
sbuf . length = tryduration ; //don't bother queuing more than 3*0.5 secs
if ( sbuf . length )
{
//build a buffer with it and queue it up.
//buffer will be purged later on when its unqueued
2021-10-22 22:27:21 +00:00
if ( OpenAL_LoadCache ( oali , & buf , & sbuf , max ( 1 , cvolume ) , 0 ) )
2021-09-16 20:08:30 +00:00
{
2020-03-25 21:29:30 +00:00
palSourceQueueBuffers ( src , 1 , & buf ) ;
2021-09-16 20:08:30 +00:00
oali - > source [ chnum ] . queue [ oali - > source [ chnum ] . queuesize + + ] = buf ;
}
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
}
else
{ //decoder isn't ready yet, but didn't signal an error/eof. queue a little silence, because that's better than constant micro stutters
sfxcache_t silence ;
silence . speed = snd_speed ;
2020-04-29 10:43:22 +00:00
silence . format = QAF_S16 ;
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
silence . numchannels = 1 ;
2016-07-12 00:40:13 +00:00
silence . data = NULL ;
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
silence . length = 0.1 * silence . speed ;
silence . soundoffset = 0 ;
2021-10-22 22:27:21 +00:00
if ( OpenAL_LoadCache ( oali , & buf , & silence , 1 , 0 ) )
2021-09-16 20:08:30 +00:00
{
2020-03-25 21:29:30 +00:00
palSourceQueueBuffers ( src , 1 , & buf ) ;
2021-09-16 20:08:30 +00:00
oali - > source [ chnum ] . queue [ oali - > source [ chnum ] . queuesize + + ] = buf ;
}
2016-07-12 00:40:13 +00:00
}
2015-08-02 19:08:36 +00:00
//yay
chan - > pos + = sbuf . length < < PITCHSHIFT ;
palGetSourcei ( src , AL_SOURCE_STATE , & buf ) ;
if ( buf ! = AL_PLAYING )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
schanged = CUR_EVERYTHING ;
2015-08-02 19:08:36 +00:00
}
else
2014-03-30 10:43:05 +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
if ( sfx - > loopstart ! = - 1 )
chan - > pos = sfx - > loopstart < < PITCHSHIFT ;
else if ( chan - > flags & CF_FORCELOOP )
chan - > pos = 0 ;
else //we don't want to play anything more.
break ;
2021-09-16 20:08:30 +00:00
if ( ! oali - > source [ chnum ] . queuesize )
2020-02-26 00:37:52 +00:00
{ //queue 0.1 secs if we're starting/resetting a new stream this is to try to cover up discontinuities caused by packetloss or whatever
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
sfxcache_t silence ;
silence . speed = snd_speed ;
2020-04-29 10:43:22 +00:00
silence . format = QAF_S16 ;
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
silence . numchannels = 1 ;
silence . data = NULL ;
silence . length = 0.1 * silence . speed ;
silence . soundoffset = 0 ;
2021-10-22 22:27:21 +00:00
if ( OpenAL_LoadCache ( oali , & buf , & silence , 1 , 0 ) )
2021-09-16 20:08:30 +00:00
{
2020-03-25 21:29:30 +00:00
palSourceQueueBuffers ( src , 1 , & buf ) ;
2021-09-16 20:08:30 +00:00
oali - > source [ chnum ] . queue [ oali - > source [ chnum ] . queuesize + + ] = buf ;
2021-10-22 22:27:21 +00:00
if ( oali - > can_source_spatialise ) //force spacialisation as desired, if supported (this solves browsers forcing stereo on mono files which should mean static audio is full volume...)
palSourcei ( src , AL_SOURCE_SPATIALIZE_SOFT , ! srcrel ) ;
2021-09-16 20:08:30 +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
}
}
}
2021-09-16 20:08:30 +00:00
if ( ! oali - > source [ chnum ] . queuesize )
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
{
palGetSourcei ( src , AL_SOURCE_STATE , & buf ) ;
if ( buf ! = AL_PLAYING )
{
chan - > sfx = NULL ;
if ( sfx - > decoder . ended )
2015-04-21 04:12:00 +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
if ( ! S_IsPlayingSomewhere ( sfx ) )
sfx - > decoder . ended ( sfx ) ;
2015-04-21 04:12:00 +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
return ;
2014-03-30 10:43:05 +00:00
}
2015-04-21 04:12:00 +00:00
}
2013-07-26 17:19:06 +00:00
}
else
2019-12-10 14:50:47 +00:00
{ //unstreamed
2015-04-21 04:12:00 +00:00
if ( ! sfx - > decoder . buf )
return ;
2021-10-22 22:27:21 +00:00
oali - > sounds [ sndnum ] . allocated = OpenAL_LoadCache ( oali , & buf , sfx - > decoder . buf , 1 , sfx - > loopstart ) ;
2019-12-10 14:50:47 +00:00
if ( ! oali - > sounds [ sndnum ] . allocated )
2015-04-21 04:12:00 +00:00
return ;
2019-12-10 14:50:47 +00:00
oali - > sounds [ sndnum ] . buffer = buf ;
2013-07-26 17:19:06 +00:00
}
2010-12-05 02:46:07 +00:00
}
2019-12-10 14:50:47 +00:00
if ( ! stream )
{
2015-04-21 04:12:00 +00:00
# ifdef FTE_TARGET_WEB
2019-12-10 14:50:47 +00:00
//loading an ogg is async, so we must wait until its valid.
//our javascript will hack the buffer so that its not valid until the browser has decoded it for us.
if ( ! palIsBuffer ( buf ) )
{ //same as the SLS_LOADING case above
palDeleteSources ( 1 , & src ) ;
oali - > source [ chnum ] . handle = 0 ;
oali - > source [ chnum ] . allocated = false ;
return ;
}
2015-04-21 04:12:00 +00:00
# endif
2019-12-10 14:50:47 +00:00
palSourcei ( src , AL_BUFFER , buf ) ;
2021-10-22 22:27:21 +00:00
if ( oali - > can_source_spatialise ) //force spacialisation as desired, if supported (this solves browsers forcing stereo on mono files which should mean static audio is full volume...)
palSourcei ( src , AL_SOURCE_SPATIALIZE_SOFT , ! srcrel ) ;
2019-12-10 14:50:47 +00:00
}
2010-12-05 02:46:07 +00:00
}
2014-03-30 08:55:06 +00:00
palSourcef ( src , AL_GAIN , min ( cvolume , 1 ) ) ; //openal only supports a max volume of 1. anything above is an error and will be clamped.
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
if ( srcrel )
2015-08-02 11:36:46 +00:00
{
2013-07-26 17:19:06 +00:00
palSourcefv ( src , AL_POSITION , vec3_origin ) ;
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
# ifndef FTE_TARGET_WEB //webaudio sucks.
2015-08-02 11:36:46 +00:00
palSourcefv ( src , AL_VELOCITY , vec3_origin ) ;
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
# endif
2015-08-02 11:36:46 +00:00
}
2013-07-26 17:19:06 +00:00
else
2015-08-02 11:36:46 +00:00
{
2013-07-26 17:19:06 +00:00
palSourcefv ( src , AL_POSITION , chan - > origin ) ;
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
# ifndef FTE_TARGET_WEB //webaudio sucks.
2016-07-12 00:40:13 +00:00
palSourcefv ( src , AL_VELOCITY , chan - > velocity ) ;
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
# endif
2015-08-02 11:36:46 +00:00
}
2010-12-05 02:46:07 +00:00
if ( schanged )
{
2022-05-05 23:28:33 +00:00
if ( schanged & CUR_OFFSET & & chan - > pos )
2016-07-12 00:40:13 +00:00
{ //complex update, but not restart. pos contains an offset, rather than an absolute time.
2019-11-25 04:20:56 +00:00
palSourcei ( src , AL_SAMPLE_OFFSET , ( chan - > pos > > PITCHSHIFT ) ) ;
2016-07-12 00:40:13 +00:00
}
2010-12-05 02:46:07 +00:00
pitch = ( float ) chan - > rate / ( 1 < < PITCHSHIFT ) ;
2021-07-30 11:40:37 +00:00
pitch = max ( 0.01 , pitch ) ; // OpenAL will clamp inside the implementation if need be, only min is important
2010-12-05 02:46:07 +00:00
palSourcef ( src , AL_PITCH , pitch ) ;
2014-08-25 07:35:41 +00:00
# ifdef USEEFX
2016-07-12 00:40:13 +00:00
if ( palSource3i )
{
if ( chan - > flags & CF_NOREVERB ) //don't do the underwater thing on static sounds. it sounds like arse with all those sources.
palSource3i ( src , AL_AUXILIARY_SEND_FILTER , 0 , 0 , AL_FILTER_NULL ) ;
else
palSource3i ( src , AL_AUXILIARY_SEND_FILTER , oali - > effectslot , 0 , AL_FILTER_NULL ) ;
}
2014-08-25 07:35:41 +00:00
# endif
2013-07-26 17:19:06 +00:00
2021-10-22 22:27:21 +00:00
palSourcei ( src , AL_LOOPING , ( ! stream & & ( ( chan - > flags & CF_FORCELOOP ) | | ( sfx - > loopstart > = 0 & & ! stream ) ) ) ? AL_TRUE : AL_FALSE ) ;
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
if ( srcrel )
2010-12-05 02:46:07 +00:00
{
palSourcei ( src , AL_SOURCE_RELATIVE , AL_TRUE ) ;
2013-07-26 17:19:06 +00:00
// palSourcef(src, AL_ROLLOFF_FACTOR, 0.0f);
2010-12-05 02:46:07 +00:00
}
else
{
palSourcei ( src , AL_SOURCE_RELATIVE , AL_FALSE ) ;
2013-07-26 17:19:06 +00:00
// palSourcef(src, AL_ROLLOFF_FACTOR, s_al_rolloff_factor.value*chan->dist_mult);
}
2014-12-09 14:39:54 +00:00
//this is disgustingly shit.
//logically we want to set the distance divisor to 1 and the rolloff factor to dist_mult.
//but openal clamps in an annoying order (probably to keep things signed in hardware) and webaudio refuses infinity, so we need to special case no attenuation to get around the issue
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
if ( srcrel )
2013-07-26 17:19:06 +00:00
{
2021-10-12 04:42:07 +00:00
#if 0 //def FTE_TARGET_WEB
2018-08-04 19:00:19 +00:00
switch ( DM_INVERSE ) //emscripten omits it, and this is webaudio's default too.
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
# else
2018-08-04 19:00:19 +00:00
switch ( ( enum distancemodel_e ) s_al_distancemodel . ival )
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
# endif
{
default :
2018-08-04 19:00:19 +00:00
case DM_INVERSE :
case DM_INVERSE_CLAMPED :
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
palSourcef ( src , AL_ROLLOFF_FACTOR , 0 ) ;
palSourcef ( src , AL_REFERENCE_DISTANCE , 1 ) ; //0 would be silent, or a division by 0
palSourcef ( src , AL_MAX_DISTANCE , 1 ) ; //only used for clamped mode
break ;
2018-08-04 19:00:19 +00:00
case DM_LINEAR :
case DM_LINEAR_CLAMPED :
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
palSourcef ( src , AL_ROLLOFF_FACTOR , 0 ) ;
palSourcef ( src , AL_REFERENCE_DISTANCE , 0 ) ; //doesn't matter when rolloff is 0
palSourcef ( src , AL_MAX_DISTANCE , 1 ) ; //doesn't matter, so long as its not a nan
break ;
}
2014-12-09 14:39:54 +00:00
}
else
{
2021-10-12 04:42:07 +00:00
#if 0 //def FTE_TARGET_WEB
2018-08-04 19:00:19 +00:00
switch ( DM_LINEAR ) //emscripten hardcodes it in a buggy kind of way.
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
# else
2018-08-04 19:00:19 +00:00
switch ( ( enum distancemodel_e ) s_al_distancemodel . ival )
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
# endif
2014-12-09 14:39:54 +00:00
{
default :
2018-08-04 19:00:19 +00:00
case DM_INVERSE :
case DM_INVERSE_CLAMPED :
2014-12-09 14:39:54 +00:00
palSourcef ( src , AL_ROLLOFF_FACTOR , s_al_reference_distance . value ) ;
palSourcef ( src , AL_REFERENCE_DISTANCE , 1 ) ;
palSourcef ( src , AL_MAX_DISTANCE , 1 / chan - > dist_mult ) ; //clamp to the maximum distance you'd normally be allowed to hear... this is probably going to be annoying.
break ;
2018-08-04 19:00:19 +00:00
case DM_LINEAR : //linear, mimic quake.
case DM_LINEAR_CLAMPED : //linear clamped to further than ref distance
2014-12-09 14:39:54 +00:00
palSourcef ( src , AL_ROLLOFF_FACTOR , 1 ) ;
2021-10-12 04:42:07 +00:00
#if 0 //def FTE_TARGET_WEB
2017-05-22 05:12:01 +00:00
//chrome complains about 0.
//with the expontential model, 0 results in division by zero, but we're not using that model and the maths for the linear model is fine with it.
//the web audio spec says 'The default value is 1. A RangeError exception must be thrown if this is set to a non-negative value.'
//which of course means that the PannerNode's constructor must throw an exception, which kinda prevents you ever creating one.
//it also says elsewhere 'If dref = 0, the value of the [exponential|inverse] model is taken to be 0, ...'
//which shows that the spec should read 'negative values' for rangeerrors (rather than non-positive). so chrome is being shit.
//unfortutely due to the nature of javascript and exceptions, this is fucking everything else up. thanks chrome!
palSourcef ( src , AL_REFERENCE_DISTANCE , 0.01 ) ;
# else
2014-12-09 14:39:54 +00:00
palSourcef ( src , AL_REFERENCE_DISTANCE , 0 ) ;
2017-05-22 05:12:01 +00:00
# endif
2014-12-09 14:39:54 +00:00
palSourcef ( src , AL_MAX_DISTANCE , 1 / chan - > dist_mult ) ;
break ;
}
2010-12-05 02:46:07 +00:00
}
/*and start it up again*/
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( schanged ! = CUR_UPDATE )
2017-12-03 03:03:02 +00:00
palSourcePlay ( src ) ;
2010-12-05 02:46:07 +00:00
}
2021-10-05 05:05:50 +00:00
PrintALError ( sfx ? sfx - > name : " post start sound " ) ;
2010-11-28 19:07:07 +00:00
}
/*
static void S_Info ( void )
{
if ( OpenAL_Device = = NULL )
return ;
Con_Printf ( " OpenAL Version : %s \n " , palGetString ( AL_VERSION ) ) ;
Con_Printf ( " OpenAL Vendor : %s \n " , palGetString ( AL_VENDOR ) ) ;
Con_Printf ( " OpenAL Renderer : %s \n " , palGetString ( AL_RENDERER ) ) ;
if ( palcIsExtensionPresent ( NULL , ( const ALCchar * ) " ALC_ENUMERATION_EXT " ) = = AL_TRUE )
{
Con_Printf ( " OpenAL Device : %s \n " , palcGetString ( OpenAL_Device , ALC_DEVICE_SPECIFIER ) ) ;
}
Con_Printf ( " OpenAL Default Device : %s \n " , palcGetString ( OpenAL_Device , ALC_DEFAULT_DEVICE_SPECIFIER ) ) ;
Con_Printf ( " OpenAL AL Extension : %s \n " , palGetString ( AL_EXTENSIONS ) ) ;
Con_Printf ( " OpenAL ALC Extension : %s \n " , palcGetString ( NULL , ALC_EXTENSIONS ) ) ;
}
*/
2013-07-26 17:19:06 +00:00
static qboolean OpenAL_InitLibrary ( void )
2010-11-28 19:07:07 +00:00
{
2014-08-25 07:35:41 +00:00
# ifdef OPENAL_STATIC
2019-12-16 17:36:00 +00:00
if ( s_al_disable . ival > 1 )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
return false ;
2014-08-25 07:35:41 +00:00
return true ;
# else
2013-07-26 17:19:06 +00:00
static dllfunction_t openalfuncs [ ] =
2010-11-28 19:07:07 +00:00
{
{ ( void * ) & palGetError , " alGetError " } ,
{ ( void * ) & palSourcef , " alSourcef " } ,
{ ( void * ) & palSourcei , " alSourcei " } ,
{ ( void * ) & palSourcePlayv , " alSourcePlayv " } ,
{ ( void * ) & palSourceStopv , " alSourceStopv " } ,
{ ( void * ) & palSourcePlay , " alSourcePlay " } ,
{ ( void * ) & palSourceStop , " alSourceStop " } ,
{ ( void * ) & palDopplerFactor , " alDopplerFactor " } ,
{ ( void * ) & palGenBuffers , " alGenBuffers " } ,
{ ( void * ) & palIsBuffer , " alIsBuffer " } ,
{ ( void * ) & palBufferData , " alBufferData " } ,
2021-10-22 22:27:21 +00:00
{ ( void * ) & palBufferiv , " alBufferiv " } ,
2010-11-28 19:07:07 +00:00
{ ( void * ) & palDeleteBuffers , " alDeleteBuffers " } ,
{ ( void * ) & palListenerfv , " alListenerfv " } ,
{ ( void * ) & palSourcefv , " alSourcefv " } ,
{ ( void * ) & palGetString , " alGetString " } ,
{ ( void * ) & palGenSources , " alGenSources " } ,
2019-12-10 14:50:47 +00:00
{ ( void * ) & palIsSource , " alIsSource " } ,
2010-11-28 19:07:07 +00:00
{ ( void * ) & palListenerf , " alListenerf " } ,
{ ( void * ) & palDeleteSources , " alDeleteSources " } ,
{ ( void * ) & palSpeedOfSound , " alSpeedOfSound " } ,
{ ( void * ) & palDistanceModel , " alDistanceModel " } ,
2019-09-04 07:59:40 +00:00
{ ( void * ) & palIsExtensionPresent , " alIsExtensionPresent " } ,
2013-07-26 17:19:06 +00:00
{ ( void * ) & palGetProcAddress , " alGetProcAddress " } ,
{ ( void * ) & palGetSourcei , " alGetSourcei " } ,
{ ( void * ) & palSourceQueueBuffers , " alSourceQueueBuffers " } ,
{ ( void * ) & palSourceUnqueueBuffers , " alSourceUnqueueBuffers " } ,
2010-11-28 19:07:07 +00:00
{ ( void * ) & palcOpenDevice , " alcOpenDevice " } ,
{ ( void * ) & palcCloseDevice , " alcCloseDevice " } ,
{ ( void * ) & palcCreateContext , " alcCreateContext " } ,
{ ( void * ) & palcDestroyContext , " alcDestroyContext " } ,
{ ( void * ) & palcMakeContextCurrent , " alcMakeContextCurrent " } ,
{ ( void * ) & palcProcessContext , " alcProcessContext " } ,
{ ( void * ) & palcGetString , " alcGetString " } ,
{ ( void * ) & palcIsExtensionPresent , " alcIsExtensionPresent " } ,
2021-10-12 04:42:07 +00:00
{ ( void * ) & palcGetProcAddress , " alcGetProcAddress " } ,
2010-11-28 19:07:07 +00:00
{ NULL }
} ;
2013-07-26 17:19:06 +00:00
2019-12-16 17:36:00 +00:00
if ( s_al_disable . ival > 1 )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
return false ;
2018-09-01 04:18:08 +00:00
if ( COM_CheckParm ( " -noopenal " ) )
return false ;
2013-07-26 17:19:06 +00:00
if ( ! openallib_tried )
{
openallib_tried = true ;
2015-05-14 03:06:58 +00:00
# ifdef _WIN32
2013-07-26 17:19:06 +00:00
openallib = Sys_LoadLibrary ( " OpenAL32 " , openalfuncs ) ;
2018-12-06 04:55:35 +00:00
if ( ! openallib )
openallib = Sys_LoadLibrary ( " soft_oal " , openalfuncs ) ;
2015-05-14 03:06:58 +00:00
# else
openallib = Sys_LoadLibrary ( " libopenal.so.1 " , openalfuncs ) ;
if ( ! openallib )
openallib = Sys_LoadLibrary ( " libopenal " , openalfuncs ) ;
# endif
2013-07-26 17:19:06 +00:00
}
return ! ! openallib ;
2014-08-25 07:35:41 +00:00
# endif
2013-07-26 17:19:06 +00:00
}
2021-10-22 22:27:21 +00:00
static qboolean OpenAL_Init ( soundcardinfo_t * sc , const char * devname , qboolean qmix )
2013-07-26 17:19:06 +00:00
{
2016-08-25 00:12:14 +00:00
oalinfo_t * oali ;
2013-07-26 17:19:06 +00:00
if ( ! OpenAL_InitLibrary ( ) )
2010-11-28 19:07:07 +00:00
{
2019-12-16 17:36:00 +00:00
if ( ! s_al_disable . ival )
{
if ( devname )
Con_Printf ( SDRVNAME " library is not installed \n " ) ;
else
Con_DPrintf ( SDRVNAME " library is not installed \n " ) ;
}
2010-11-28 19:07:07 +00:00
return false ;
}
2016-07-12 00:40:13 +00:00
if ( ! devname | | ! * devname )
2019-12-16 17:36:00 +00:00
{
2021-10-22 22:27:21 +00:00
if ( s_al_disable . ival & & ! qmix )
2019-12-16 17:36:00 +00:00
return false ; //no default device
2016-07-12 00:40:13 +00:00
devname = palcGetString ( NULL , ALC_DEFAULT_DEVICE_SPECIFIER ) ;
2019-12-16 17:36:00 +00:00
}
2016-07-12 00:40:13 +00:00
Q_snprintfz ( sc - > name , sizeof ( sc - > name ) , " %s " , devname ) ;
2021-10-22 22:27:21 +00:00
if ( qmix )
Con_TPrintf ( " Initiating " QMIX_SDRVNAME " : %s. \n " , devname ) ;
else
Con_TPrintf ( " Initiating " SDRVNAME " : %s. \n " , devname ) ;
2016-07-12 00:40:13 +00:00
2016-08-25 00:12:14 +00:00
oali = Z_Malloc ( sizeof ( oalinfo_t ) ) ;
sc - > handle = oali ;
2013-07-26 17:19:06 +00:00
oali - > OpenAL_Device = palcOpenDevice ( devname ) ;
if ( oali - > OpenAL_Device = = NULL )
2010-11-28 19:07:07 +00:00
PrintALError ( " Could not init a sound device \n " ) ;
2016-08-25 00:12:14 +00:00
else
2016-07-12 00:40:13 +00:00
{
2021-10-12 04:42:07 +00:00
size_t i = 0 ;
ALCint attrs [ 5 ] ;
2021-10-22 22:27:21 +00:00
palcGetStringiSOFT = ( ! qmix & & palcIsExtensionPresent ( oali - > OpenAL_Device , " ALC_SOFT_HRTF " ) ) ? palcGetProcAddress ( oali - > OpenAL_Device , " alcGetStringiSOFT " ) : NULL ;
2021-10-12 04:42:07 +00:00
if ( palcGetStringiSOFT )
{
if ( ! * s_al_hrtf . string )
{
attrs [ i + + ] = ALC_HRTF_SOFT ;
attrs [ i + + ] = ALC_DONT_CARE_SOFT ;
}
else if ( ! strcmp ( s_al_hrtf . string , " 0 " ) | | ! strcmp ( s_al_hrtf . string , " 1 " ) )
{ //explicitly switch it off or on(default)
attrs [ i + + ] = ALC_HRTF_SOFT ;
attrs [ i + + ] = ! strcmp ( s_al_hrtf . string , " 1 " ) ;
}
else
{ //we want an explicit hrtf
ALCint hrtf_count = 0 ;
ALCint idx ;
const ALCchar * hrtfname ;
attrs [ i + + ] = ALC_HRTF_SOFT ;
attrs [ i + + ] = true ;
palcGetIntegerv ( oali - > OpenAL_Device , ALC_NUM_HRTF_SPECIFIERS_SOFT , 1 , & hrtf_count ) ;
for ( idx = 0 ; idx < hrtf_count ; idx + + )
{
hrtfname = palcGetStringiSOFT ( oali - > OpenAL_Device , ALC_HRTF_SPECIFIER_SOFT , idx ) ;
if ( hrtfname & & ! strcmp ( hrtfname , s_al_hrtf . string ) )
break ;
}
if ( idx < hrtf_count )
{
attrs [ i + + ] = ALC_HRTF_ID_SOFT ;
attrs [ i + + ] = idx ;
}
else if ( hrtf_count )
{
Con_Printf ( " HRTF \" %s \" not known, available options are: \n " , s_al_hrtf . string ) ;
for ( idx = 0 ; idx < hrtf_count ; idx + + )
{
hrtfname = palcGetStringiSOFT ( oali - > OpenAL_Device , ALC_HRTF_SPECIFIER_SOFT , idx ) ;
if ( hrtfname )
Con_Printf ( " \t \" %s \" \n " , hrtfname ) ;
}
}
}
}
attrs [ i ] = 0 ; //EOL
oali - > OpenAL_Context = palcCreateContext ( oali - > OpenAL_Device , attrs ) ;
2016-08-25 00:12:14 +00:00
if ( ! oali - > OpenAL_Context )
PrintALError ( " Could not init a sound context \n " ) ;
else
{
palcMakeContextCurrent ( oali - > OpenAL_Context ) ;
// palcProcessContext(oali->OpenAL_Context);
2010-11-28 19:07:07 +00:00
2016-08-25 00:12:14 +00:00
//S_Info();
2010-11-28 19:07:07 +00:00
2016-08-25 00:12:14 +00:00
//fixme...
2017-01-13 00:39:50 +00:00
memset ( oali - > source , 0 , sizeof ( * oali - > source ) * oali - > max_sources ) ;
2016-08-25 00:12:14 +00:00
PrintALError ( " alGensources for normal sources " ) ;
2010-11-28 19:07:07 +00:00
2021-10-22 22:27:21 +00:00
palListenerf ( AL_GAIN , 1 ) ;
2016-08-25 00:12:14 +00:00
palListenerfv ( AL_POSITION , oali - > ListenPos ) ;
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
# ifndef FTE_TARGET_WEB //webaudio sucks.
2016-08-25 00:12:14 +00:00
palListenerfv ( AL_VELOCITY , oali - > ListenVel ) ;
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
# endif
2016-08-25 00:12:14 +00:00
palListenerfv ( AL_ORIENTATION , oali - > ListenOri ) ;
2010-11-28 19:07:07 +00:00
2021-10-12 04:42:07 +00:00
oali - > can_source_spatialise = palIsExtensionPresent ( " AL_SOFT_source_spatialize " ) ;
2021-10-22 22:27:21 +00:00
oali - > can_looppoints = palIsExtensionPresent ( " AL_SOFT_loop_points " ) ;
2021-10-12 04:42:07 +00:00
if ( palcGetStringiSOFT )
{
ALCint stat ;
palcGetIntegerv ( oali - > OpenAL_Device , ALC_HRTF_STATUS_SOFT , 1 , & stat ) ;
safeswitch ( stat )
{
case ALC_HRTF_DISABLED_SOFT : Con_Printf ( " AL_HRTF_STATUS: DISABLED. \n " ) ; break ;
case ALC_HRTF_ENABLED_SOFT : Con_Printf ( " AL_HRTF_STATUS: ENABLED. \n " ) ; break ;
case ALC_HRTF_DENIED_SOFT : Con_Printf ( " AL_HRTF_STATUS: DENIED. \n " ) ; break ;
case ALC_HRTF_REQUIRED_SOFT : Con_Printf ( " AL_HRTF_STATUS: REQUIRED. \n " ) ; break ;
case ALC_HRTF_HEADPHONES_DETECTED_SOFT : Con_Printf ( " AL_HRTF_STATUS: HEADPHONES_DETECTED. \n " ) ; break ;
case ALC_HRTF_UNSUPPORTED_FORMAT_SOFT : Con_Printf ( " AL_HRTF_STATUS: UNSUPPORTED_FORMAT. \n " ) ; break ;
safedefault : Con_Printf ( " AL_HRTF_STATUS: %#x. \n " , stat ) ; break ;
}
}
2016-08-25 00:12:14 +00:00
return true ;
}
palcCloseDevice ( oali - > OpenAL_Device ) ;
}
Z_Free ( oali ) ;
return false ;
2010-11-28 19:07:07 +00:00
}
2016-07-12 00:40:13 +00:00
//called when some al-specific cvar has changed that is linked to openal state.
static void QDECL OnChangeALSettings ( cvar_t * var , char * value )
2010-11-28 19:07:07 +00:00
{
2016-07-12 00:40:13 +00:00
soundcardinfo_t * sc ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
2010-11-28 19:07:07 +00:00
{
2016-07-12 00:40:13 +00:00
//we only want openal devices.
if ( sc - > Shutdown ! = OpenAL_Shutdown )
continue ;
//alcMakeContextCurrent
if ( palSpeedOfSound )
palSpeedOfSound ( s_al_speedofsound . value ) ;
if ( palDopplerFactor )
2016-07-26 11:47:59 +00:00
palDopplerFactor ( s_al_dopplerfactor . value * snd_doppler . value ) ;
2016-07-12 00:40:13 +00:00
if ( palDistanceModel )
{
2018-08-04 19:00:19 +00:00
switch ( ( enum distancemodel_e ) s_al_distancemodel . ival )
2016-07-12 00:40:13 +00:00
{
2018-08-04 19:00:19 +00:00
case DM_INVERSE :
2018-09-23 19:35:24 +00:00
//gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE) )
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_INVERSE_DISTANCE ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_INVERSE_CLAMPED : //openal's default mode
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
//istance = max(distance,AL_REFERENCE_DISTANCE);
//distance = min(distance,AL_MAX_DISTANCE);
2018-09-23 19:35:24 +00:00
//gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE) )
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_INVERSE_DISTANCE_CLAMPED ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_LINEAR : //most quake-like. linear
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
//distance = min(distance, AL_MAX_DISTANCE) // avoid negative gain
2018-09-23 19:35:24 +00:00
//gain = ( 1 - AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE - AL_REFERENCE_DISTANCE) )
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_LINEAR_DISTANCE ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_LINEAR_CLAMPED : //linear, with near stuff clamped to further away
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
//distance = max(distance, AL_REFERENCE_DISTANCE)
//distance = min(distance, AL_MAX_DISTANCE)
2018-09-23 19:35:24 +00:00
//gain = ( 1 - AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE - AL_REFERENCE_DISTANCE) )
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_LINEAR_DISTANCE_CLAMPED ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_EXPONENT :
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
//gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_EXPONENT_DISTANCE ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_EXPONENT_CLAMPED :
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
//distance = max(distance, AL_REFERENCE_DISTANCE)
//distance = min(distance, AL_MAX_DISTANCE)
//gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_EXPONENT_DISTANCE_CLAMPED ) ;
break ;
2018-08-04 19:00:19 +00:00
case DM_NONE :
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
//gain = 1
2016-07-12 00:40:13 +00:00
palDistanceModel ( AL_NONE ) ;
break ;
default :
2018-08-04 19:00:19 +00:00
Cvar_ForceSet ( & s_al_distancemodel , " 2 " ) ;
2016-07-12 00:40:13 +00:00
}
}
}
2010-11-28 19:07:07 +00:00
}
/*stub should not be called*/
2012-04-09 19:12:12 +00:00
static void * OpenAL_LockBuffer ( soundcardinfo_t * sc , unsigned int * sampidx )
2010-11-28 19:07:07 +00:00
{
//Con_Printf("OpenAL: LockBuffer\n");
return NULL ;
}
/*stub should not be called*/
static void OpenAL_UnlockBuffer ( soundcardinfo_t * sc , void * buffer )
{
//Con_Printf("OpenAL: UnlockBuffer\n");
}
/*stub should not be called*/
2011-02-02 00:41:01 +00:00
static void OpenAL_Submit ( soundcardinfo_t * sc , int start , int end )
2010-11-28 19:07:07 +00:00
{
//Con_Printf("OpenAL: Submit\n");
}
/*stub should not be called*/
static unsigned int OpenAL_GetDMAPos ( soundcardinfo_t * sc )
{
//Con_Printf("OpenAL: GetDMAPos\n");
return 0 ;
}
2019-02-01 08:29:14 +00:00
# ifdef USEEFX
2016-07-12 00:40:13 +00:00
static void OpenAL_SetReverb ( soundcardinfo_t * sc , size_t reverbeffect )
{
# ifdef USEEFX
oalinfo_t * oali = sc - > handle ;
if ( ! oali - > effectslot )
return ;
if ( reverbeffect > = numreverbproperties )
return ; //err... you're doing it wrong.
//alcMakeContextCurrent
if ( reverbeffect > = oali - > numeffecttypes )
{
void * n = BZ_Realloc ( oali - > effecttype , sizeof ( * oali - > effecttype ) * numreverbproperties ) ;
if ( ! n )
return ; //erk?
oali - > effecttype = n ;
memset ( oali - > effecttype + oali - > numeffecttypes , 0 , sizeof ( * oali - > effecttype ) * ( numreverbproperties - oali - > numeffecttypes ) ) ;
oali - > numeffecttypes = numreverbproperties ;
}
if ( oali - > effecttype [ reverbeffect ] . modificationcount ! = reverbproperties [ reverbeffect ] . modificationcount )
{ //the desired effect was modified
oali - > cureffect = ~ 0 ;
oali - > effecttype [ reverbeffect ] . modificationcount = reverbproperties [ reverbeffect ] . modificationcount ;
palDeleteEffects ( 1 , & oali - > effecttype [ reverbeffect ] . effect ) ;
oali - > effecttype [ reverbeffect ] . effect = OpenAL_LoadEffect ( & reverbproperties [ reverbeffect ] . props ) ;
}
else
{
//don't spam it
if ( oali - > cureffect = = reverbeffect )
return ;
}
oali - > cureffect = reverbeffect ;
PrintALError ( " preunderwater " ) ;
palAuxiliaryEffectSloti ( oali - > effectslot , AL_EFFECTSLOT_EFFECT , oali - > effecttype [ oali - > cureffect ] . effect ) ;
PrintALError ( " postunderwater " ) ;
//Con_Printf("OpenAL: SetUnderWater %i\n", underwater);
# endif
}
2019-02-01 08:29:14 +00:00
# endif
2016-07-12 00:40:13 +00:00
2010-11-28 19:07:07 +00:00
static void OpenAL_Shutdown ( soundcardinfo_t * sc )
{
2013-07-26 17:19:06 +00:00
oalinfo_t * oali = sc - > handle ;
2010-11-28 19:07:07 +00:00
int i ;
2016-07-12 00:40:13 +00:00
//alcMakeContextCurrent
2019-12-10 14:50:47 +00:00
for ( i = 0 ; i < oali - > max_sources ; i + + )
{
if ( oali - > source [ i ] . allocated )
{
palDeleteSources ( 1 , & oali - > source [ i ] . handle ) ;
oali - > source [ i ] . handle = 0 ;
oali - > source [ i ] . allocated = false ;
}
}
2010-11-28 19:07:07 +00:00
/*make sure the buffers are cleared from the sound effects*/
2019-12-10 14:50:47 +00:00
for ( i = 0 ; i < oali - > max_sounds ; i + + )
2010-11-28 19:07:07 +00:00
{
2019-12-10 14:50:47 +00:00
if ( oali - > sounds [ i ] . allocated )
2010-11-28 19:07:07 +00:00
{
2019-12-10 14:50:47 +00:00
palDeleteBuffers ( 1 , & oali - > sounds [ i ] . buffer ) ;
oali - > sounds [ i ] . allocated = false ;
2010-11-28 19:07:07 +00:00
}
}
2014-08-25 07:35:41 +00:00
# ifdef USEEFX
2016-07-12 00:40:13 +00:00
if ( palDeleteAuxiliaryEffectSlots )
{
palDeleteAuxiliaryEffectSlots ( 1 , & oali - > effectslot ) ;
for ( i = 0 ; i < oali - > numeffecttypes ; i + + )
{
if ( oali - > effecttype [ i ] . effect )
palDeleteEffects ( 1 , & oali - > effecttype [ i ] . effect ) ;
}
}
Z_Free ( oali - > effecttype ) ;
2014-08-25 07:35:41 +00:00
# endif
2013-07-26 17:19:06 +00:00
2016-12-21 15:48:52 +00:00
palcMakeContextCurrent ( NULL ) ;
2013-07-26 17:19:06 +00:00
palcDestroyContext ( oali - > OpenAL_Context ) ;
palcCloseDevice ( oali - > OpenAL_Device ) ;
2019-12-10 14:50:47 +00:00
Z_Free ( oali - > sounds ) ;
2017-01-24 10:27:39 +00:00
Z_Free ( oali - > source ) ;
2013-07-26 17:19:06 +00:00
Z_Free ( oali ) ;
2010-11-28 19:07:07 +00:00
}
2019-02-01 08:29:14 +00:00
# ifdef USEEFX
2016-07-12 00:40:13 +00:00
static ALuint OpenAL_LoadEffect ( const struct reverbproperties_s * reverb )
2013-07-26 17:19:06 +00:00
{
2014-08-25 07:35:41 +00:00
ALuint effect = 0 ;
# ifdef AL_EFFECT_EAXREVERB
2019-12-10 14:50:47 +00:00
palGetError ( ) ;
2013-07-26 17:19:06 +00:00
palGenEffects ( 1 , & effect ) ;
2016-07-12 00:40:13 +00:00
//try eax reverb for more settings
palEffecti ( effect , AL_EFFECT_TYPE , AL_EFFECT_EAXREVERB ) ;
if ( ! palGetError ( ) )
2013-07-26 17:19:06 +00:00
{
/* EAX Reverb is available. Set the EAX effect type then load the
* reverb properties . */
palEffectf ( effect , AL_EAXREVERB_DENSITY , reverb - > flDensity ) ;
palEffectf ( effect , AL_EAXREVERB_DIFFUSION , reverb - > flDiffusion ) ;
palEffectf ( effect , AL_EAXREVERB_GAIN , reverb - > flGain ) ;
palEffectf ( effect , AL_EAXREVERB_GAINHF , reverb - > flGainHF ) ;
palEffectf ( effect , AL_EAXREVERB_GAINLF , reverb - > flGainLF ) ;
palEffectf ( effect , AL_EAXREVERB_DECAY_TIME , reverb - > flDecayTime ) ;
palEffectf ( effect , AL_EAXREVERB_DECAY_HFRATIO , reverb - > flDecayHFRatio ) ;
palEffectf ( effect , AL_EAXREVERB_DECAY_LFRATIO , reverb - > flDecayLFRatio ) ;
palEffectf ( effect , AL_EAXREVERB_REFLECTIONS_GAIN , reverb - > flReflectionsGain ) ;
palEffectf ( effect , AL_EAXREVERB_REFLECTIONS_DELAY , reverb - > flReflectionsDelay ) ;
palEffectfv ( effect , AL_EAXREVERB_REFLECTIONS_PAN , reverb - > flReflectionsPan ) ;
palEffectf ( effect , AL_EAXREVERB_LATE_REVERB_GAIN , reverb - > flLateReverbGain ) ;
palEffectf ( effect , AL_EAXREVERB_LATE_REVERB_DELAY , reverb - > flLateReverbDelay ) ;
palEffectfv ( effect , AL_EAXREVERB_LATE_REVERB_PAN , reverb - > flLateReverbPan ) ;
palEffectf ( effect , AL_EAXREVERB_ECHO_TIME , reverb - > flEchoTime ) ;
palEffectf ( effect , AL_EAXREVERB_ECHO_DEPTH , reverb - > flEchoDepth ) ;
palEffectf ( effect , AL_EAXREVERB_MODULATION_TIME , reverb - > flModulationTime ) ;
palEffectf ( effect , AL_EAXREVERB_MODULATION_DEPTH , reverb - > flModulationDepth ) ;
palEffectf ( effect , AL_EAXREVERB_AIR_ABSORPTION_GAINHF , reverb - > flAirAbsorptionGainHF ) ;
palEffectf ( effect , AL_EAXREVERB_HFREFERENCE , reverb - > flHFReference ) ;
palEffectf ( effect , AL_EAXREVERB_LFREFERENCE , reverb - > flLFReference ) ;
palEffectf ( effect , AL_EAXREVERB_ROOM_ROLLOFF_FACTOR , reverb - > flRoomRolloffFactor ) ;
palEffecti ( effect , AL_EAXREVERB_DECAY_HFLIMIT , reverb - > iDecayHFLimit ) ;
}
else
2018-08-04 19:00:19 +00:00
# endif
2013-07-26 17:19:06 +00:00
{
2018-08-04 19:00:19 +00:00
# ifdef AL_EFFECT_REVERB
2013-07-26 17:19:06 +00:00
/* No EAX Reverb. Set the standard reverb effect type then load the
* available reverb properties . */
palEffecti ( effect , AL_EFFECT_TYPE , AL_EFFECT_REVERB ) ;
palEffectf ( effect , AL_REVERB_DENSITY , reverb - > flDensity ) ;
palEffectf ( effect , AL_REVERB_DIFFUSION , reverb - > flDiffusion ) ;
palEffectf ( effect , AL_REVERB_GAIN , reverb - > flGain ) ;
palEffectf ( effect , AL_REVERB_GAINHF , reverb - > flGainHF ) ;
palEffectf ( effect , AL_REVERB_DECAY_TIME , reverb - > flDecayTime ) ;
palEffectf ( effect , AL_REVERB_DECAY_HFRATIO , reverb - > flDecayHFRatio ) ;
palEffectf ( effect , AL_REVERB_REFLECTIONS_GAIN , reverb - > flReflectionsGain ) ;
palEffectf ( effect , AL_REVERB_REFLECTIONS_DELAY , reverb - > flReflectionsDelay ) ;
palEffectf ( effect , AL_REVERB_LATE_REVERB_GAIN , reverb - > flLateReverbGain ) ;
palEffectf ( effect , AL_REVERB_LATE_REVERB_DELAY , reverb - > flLateReverbDelay ) ;
palEffectf ( effect , AL_REVERB_AIR_ABSORPTION_GAINHF , reverb - > flAirAbsorptionGainHF ) ;
palEffectf ( effect , AL_REVERB_ROOM_ROLLOFF_FACTOR , reverb - > flRoomRolloffFactor ) ;
palEffecti ( effect , AL_REVERB_DECAY_HFLIMIT , reverb - > iDecayHFLimit ) ;
2014-08-25 07:35:41 +00:00
# endif
2018-08-04 19:00:19 +00:00
}
2013-07-26 17:19:06 +00:00
return effect ;
}
2019-02-01 08:29:14 +00:00
# endif
2010-11-28 19:07:07 +00:00
2021-10-22 22:27:21 +00:00
# ifdef HAVE_MIXER
# define CHUNKSAMPLES 1024
static void * OAQM_LockBuffer ( soundcardinfo_t * sc , unsigned int * sampidx )
{
oalinfo_t * oali = sc - > handle ;
if ( oali - > qmix . queuesize = = countof ( oali - > qmix . queue ) )
return NULL ; //not available yet.
return sc - > sn . buffer ;
}
static void OAQM_UnlockBuffer ( soundcardinfo_t * sc , void * buffer )
{
}
static void OAQM_Submit ( soundcardinfo_t * sc , int start , int end )
{
oalinfo_t * oali = sc - > handle ;
ALint buf ;
int framesize = sc - > sn . samplebytes * sc - > sn . numchannels ;
if ( end = = start )
return ;
if ( oali - > qmix . queuesize = = countof ( oali - > qmix . queue ) )
return ;
palGenBuffers ( 1 , & buf ) ;
switch ( sc - > sn . sampleformat )
{
case QSF_F32 :
palBufferData ( buf , ( sc - > sn . numchannels > 1 ) ? AL_FORMAT_STEREO_FLOAT32 : AL_FORMAT_MONO_FLOAT32 , sc - > sn . buffer , ( end - start ) * framesize , sc - > sn . speed ) ;
break ;
case QSF_S16 :
palBufferData ( buf , ( sc - > sn . numchannels > 1 ) ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16 , sc - > sn . buffer , ( end - start ) * framesize , sc - > sn . speed ) ;
break ;
case QSF_U8 :
palBufferData ( buf , ( sc - > sn . numchannels > 1 ) ? AL_FORMAT_STEREO8 : AL_FORMAT_MONO8 , sc - > sn . buffer , ( end - start ) * framesize , sc - > sn . speed ) ;
break ;
default :
break ;
}
palSourceQueueBuffers ( oali - > qmix . handle , 1 , & buf ) ;
oali - > qmix . queue [ oali - > qmix . queuesize + + ] = buf ;
sc - > snd_completed + = ( end - start ) ;
palGetSourcei ( oali - > qmix . handle , AL_SOURCE_STATE , & buf ) ;
if ( buf ! = AL_PLAYING )
palSourcePlay ( oali - > qmix . handle ) ;
}
/*stub should not be called*/
static unsigned int OAQM_GetDMAPos ( soundcardinfo_t * sc )
{
extern cvar_t _snd_mixahead ;
oalinfo_t * oali = sc - > handle ;
ALint src = oali - > qmix . handle ;
ALint processed = 0 ;
unsigned int avail ;
palGetSourcei ( src , AL_BUFFERS_PROCESSED , & processed ) ;
if ( processed )
{
palSourceUnqueueBuffers ( src , processed , oali - > qmix . queue ) ;
palDeleteBuffers ( processed , oali - > qmix . queue ) ;
oali - > qmix . queuesize - = processed ;
memmove ( oali - > qmix . queue , oali - > qmix . queue + processed , oali - > qmix . queuesize * sizeof ( * oali - > qmix . queue ) ) ;
}
avail = ( ( _snd_mixahead . value * sc - > sn . speed ) + CHUNKSAMPLES / 2 ) / CHUNKSAMPLES ; //how many buffers we want to try using.
avail = bound ( 2 , avail , countof ( oali - > qmix . queue ) ) ;
if ( oali - > qmix . queuesize > avail )
avail = 0 ;
else
avail = avail - oali - > qmix . queuesize ;
avail * = CHUNKSAMPLES ;
sc - > sn . samplepos = ( sc - > snd_completed + avail ) ;
sc - > sn . samplepos * = sc - > sn . numchannels ;
return sc - > sn . samplepos ;
}
static qboolean QDECL OpenAL_Enumerate_QMix ( void ( QDECL * callback ) ( const char * driver , const char * devicecode , const char * readabledevice ) )
{
const char * devnames ;
if ( ! OpenAL_InitLibrary ( ) )
return true ; //enumerate nothing if al is disabled
devnames = palcGetString ( NULL , ALC_ALL_DEVICES_SPECIFIER ) ;
if ( ! devnames )
devnames = palcGetString ( NULL , ALC_DEVICE_SPECIFIER ) ;
while ( * devnames )
{
callback ( QMIX_SDRVNAME , devnames , va ( QMIX_SDRVNAMEDESC " %s " , devnames ) ) ;
devnames + = strlen ( devnames ) + 1 ;
}
return true ;
}
# endif
static qboolean QDECL OpenAL_Enumerate ( void ( QDECL * callback ) ( const char * driver , const char * devicecode , const char * readabledevice ) )
{
const char * devnames ;
if ( ! OpenAL_InitLibrary ( ) )
return true ; //enumerate nothing if al is disabled
devnames = palcGetString ( NULL , ALC_ALL_DEVICES_SPECIFIER ) ;
if ( ! devnames )
devnames = palcGetString ( NULL , ALC_DEVICE_SPECIFIER ) ;
while ( * devnames )
{
callback ( SDRVNAME , devnames , va ( SDRVNAMEDESC " %s " , devnames ) ) ;
devnames + = strlen ( devnames ) + 1 ;
}
return true ;
}
static qboolean QDECL OpenAL_InitCard2 ( soundcardinfo_t * sc , const char * devname , qboolean qmix )
2010-11-28 19:07:07 +00:00
{
2013-07-26 17:19:06 +00:00
oalinfo_t * oali ;
2010-11-28 19:07:07 +00:00
2016-07-12 00:40:13 +00:00
soundcardinfo_t * old ;
// extern soundcardinfo_t *sndcardinfo;
//
for ( old = sndcardinfo ; old ; old = old - > next )
{
if ( old - > Shutdown = = OpenAL_Shutdown )
{
//in theory, we could relax this by using alcMakeContextCurrent lots, but we'd also need to do something about the per-sound audio buffer handle hack
Con_Printf ( CON_ERROR SDRVNAME " : only a single device may be active at once \n " ) ;
return false ;
}
}
2010-12-05 02:46:07 +00:00
2010-11-28 19:07:07 +00:00
2021-10-22 22:27:21 +00:00
if ( OpenAL_Init ( sc , devname , qmix ) = = false )
2010-11-28 19:07:07 +00:00
return false ;
2013-07-26 17:19:06 +00:00
oali = sc - > handle ;
2021-10-12 04:42:07 +00:00
Con_DPrintf ( " AL_VERSION: %s \n " , palGetString ( AL_VERSION ) ) ;
Con_DPrintf ( " AL_RENDERER: %s \n " , palGetString ( AL_RENDERER ) ) ;
Con_DPrintf ( " AL_VENDOR: %s \n " , palGetString ( AL_VENDOR ) ) ;
2020-08-13 08:39:48 +00:00
Con_DPrintf ( " AL_EXTENSIONS: %s \n " , palGetString ( AL_EXTENSIONS ) ) ;
Con_DPrintf ( " ALC_EXTENSIONS: %s \n " , palcGetString ( oali - > OpenAL_Device , ALC_EXTENSIONS ) ) ;
2010-11-28 19:07:07 +00:00
2019-09-04 07:59:40 +00:00
# ifdef MIXER_F32
oali - > canfloataudio = palIsExtensionPresent ( " AL_EXT_float32 " ) ;
# endif
2010-11-28 19:07:07 +00:00
sc - > inactive_sound = true ;
2021-10-22 22:27:21 +00:00
sc - > Shutdown = OpenAL_Shutdown ;
2021-11-04 17:54:24 +00:00
# ifdef HAVE_MIXER
2021-10-22 22:27:21 +00:00
if ( qmix )
{
sc - > Lock = OAQM_LockBuffer ;
sc - > Unlock = OAQM_UnlockBuffer ;
sc - > GetDMAPos = OAQM_GetDMAPos ;
sc - > Submit = OAQM_Submit ;
sc - > sn . numchannels = bound ( 1 , sc - > sn . numchannels , 2 ) ;
sc - > sn . samples = CHUNKSAMPLES * sc - > sn . numchannels ;
# ifdef MIXER_F32
if ( sc - > sn . samplebytes = = 4 & & oali - > canfloataudio )
{
sc - > sn . sampleformat = QSF_F32 ;
sc - > sn . samplebytes = 4 ;
}
else
# endif
if ( sc - > sn . samplebytes > 1 )
{
sc - > sn . sampleformat = QSF_S16 ;
sc - > sn . samplebytes = 2 ;
}
else
{
sc - > sn . sampleformat = QSF_U8 ;
sc - > sn . samplebytes = 1 ;
}
// sc->sn.speed = 11025;
sc - > sn . buffer = malloc ( sc - > sn . samples * sc - > sn . samplebytes ) ;
sc - > samplequeue = - 1 ;
oali - > qmix . handle = 0 ;
oali - > qmix . queuesize = 0 ;
palGenSources ( 1 , & oali - > qmix . handle ) ;
palSourcef ( oali - > qmix . handle , AL_GAIN , 1 ) ;
palSourcei ( oali - > qmix . handle , AL_SOURCE_RELATIVE , AL_TRUE ) ;
//palSourcePlay(oali->qmix.handle);
}
else
2021-11-04 17:54:24 +00:00
# endif
2021-10-22 22:27:21 +00:00
{
# ifdef USEEFX
sc - > SetEnvironmentReverb = OpenAL_SetReverb ;
# endif
sc - > ChannelUpdate = OpenAL_ChannelUpdate ;
sc - > ListenerUpdate = OpenAL_ListenerUpdate ;
sc - > GetChannelPos = OpenAL_GetChannelPos ;
//these are stubs for our software mixer, and are not used with hardware mixing.
sc - > Lock = OpenAL_LockBuffer ;
sc - > Unlock = OpenAL_UnlockBuffer ;
sc - > Submit = OpenAL_Submit ;
sc - > GetDMAPos = OpenAL_GetDMAPos ;
sc - > selfpainting = true ;
sc - > sn . sampleformat = QSF_EXTERNALMIXER ;
2010-11-28 19:07:07 +00:00
2021-10-22 22:27:21 +00:00
OnChangeALSettings ( NULL , NULL ) ;
2013-07-26 17:19:06 +00:00
2014-08-25 07:35:41 +00:00
# ifdef USEEFX
2021-10-22 22:27:21 +00:00
PrintALError ( " preeffects " ) ;
palSource3i = palGetProcAddress ( " alSource3i " ) ;
palAuxiliaryEffectSloti = palGetProcAddress ( " alAuxiliaryEffectSloti " ) ;
palGenAuxiliaryEffectSlots = palGetProcAddress ( " alGenAuxiliaryEffectSlots " ) ;
palDeleteAuxiliaryEffectSlots = palGetProcAddress ( " alDeleteAuxiliaryEffectSlots " ) ;
palDeleteEffects = palGetProcAddress ( " alDeleteEffects " ) ;
palGenEffects = palGetProcAddress ( " alGenEffects " ) ;
palEffecti = palGetProcAddress ( " alEffecti " ) ;
palEffectiv = palGetProcAddress ( " alEffectiv " ) ;
palEffectf = palGetProcAddress ( " alEffectf " ) ;
palEffectfv = palGetProcAddress ( " alEffectfv " ) ;
if ( palGenAuxiliaryEffectSlots & & s_al_use_reverb . ival )
palGenAuxiliaryEffectSlots ( 1 , & oali - > effectslot ) ;
oali - > cureffect = ~ 0 ;
PrintALError ( " posteffects " ) ;
2014-08-25 07:35:41 +00:00
# endif
2021-10-22 22:27:21 +00:00
}
2010-11-28 19:07:07 +00:00
return true ;
}
2021-10-22 22:27:21 +00:00
static qboolean QDECL OpenAL_InitCard ( soundcardinfo_t * sc , const char * devname )
2013-07-26 17:19:06 +00:00
{
2021-10-22 22:27:21 +00:00
return OpenAL_InitCard2 ( sc , devname , false ) ;
2013-07-26 17:19:06 +00:00
}
sounddriver_t OPENAL_Output =
{
2013-10-26 02:50:24 +00:00
SDRVNAME ,
2013-07-26 17:19:06 +00:00
OpenAL_InitCard ,
2017-09-20 11:27:13 +00:00
OpenAL_Enumerate ,
OpenAL_CvarInit
2013-07-26 17:19:06 +00:00
} ;
2021-10-22 22:27:21 +00:00
# ifdef HAVE_MIXER
static qboolean QDECL OpenAL_InitCard_QMix ( soundcardinfo_t * sc , const char * devname )
{
return OpenAL_InitCard2 ( sc , devname , true ) ;
}
sounddriver_t OPENAL_Output_Lame =
{
QMIX_SDRVNAME ,
OpenAL_InitCard_QMix ,
OpenAL_Enumerate_QMix ,
NULL
} ;
# endif
2010-11-28 19:07:07 +00:00
2013-10-26 02:50:24 +00:00
# if defined(VOICECHAT)
2018-10-11 10:31:23 +00:00
static qboolean OpenAL_InitCapture ( void )
2013-10-26 02:50:24 +00:00
{
if ( ! OpenAL_InitLibrary ( ) )
return false ;
//is there really much point checking for the name when the functions should exist or not regardless?
//if its not really supported, I would trust the open+enumerate operations to reliably fail. the functions are exported as actual symbols after all, not some hidden driver feature.
//it doesn't really matter if the default driver supports it, so long as one does, I guess.
//if (!palcIsExtensionPresent(NULL, "ALC_EXT_capture"))
// return false;
if ( ! palcCaptureOpenDevice )
{
palcGetIntegerv = Sys_GetAddressForName ( openallib , " alcGetIntegerv " ) ;
palcCaptureOpenDevice = Sys_GetAddressForName ( openallib , " alcCaptureOpenDevice " ) ;
palcCaptureStart = Sys_GetAddressForName ( openallib , " alcCaptureStart " ) ;
palcCaptureSamples = Sys_GetAddressForName ( openallib , " alcCaptureSamples " ) ;
palcCaptureStop = Sys_GetAddressForName ( openallib , " alcCaptureStop " ) ;
palcCaptureCloseDevice = Sys_GetAddressForName ( openallib , " alcCaptureCloseDevice " ) ;
}
return palcGetIntegerv & & palcCaptureOpenDevice & & palcCaptureStart & & palcCaptureSamples & & palcCaptureStop & & palcCaptureCloseDevice ;
}
2018-10-11 10:31:23 +00:00
static qboolean QDECL OPENAL_Capture_Enumerate ( void ( QDECL * callback ) ( const char * drivername , const char * devicecode , const char * readablename ) )
2013-10-26 02:50:24 +00:00
{
const char * devnames ;
if ( ! OpenAL_InitCapture ( ) )
return true ; //enumerate nothing if al is disabled
devnames = palcGetString ( NULL , ALC_CAPTURE_DEVICE_SPECIFIER ) ;
while ( * devnames )
{
2020-04-19 01:23:32 +00:00
callback ( SDRVNAME , devnames , va ( SDRVNAMEDESC " %s " , devnames ) ) ;
2013-10-26 02:50:24 +00:00
devnames + = strlen ( devnames ) + 1 ;
}
return true ;
}
//fte's capture api specifies mono 16.
2018-10-11 10:31:23 +00:00
static void * QDECL OPENAL_Capture_Init ( int samplerate , const char * device )
2013-10-26 02:50:24 +00:00
{
2014-08-25 07:35:41 +00:00
# ifndef OPENAL_STATIC
2013-10-26 02:50:24 +00:00
if ( ! device ) //no default devices please, too buggy for that.
return NULL ;
2014-08-25 07:35:41 +00:00
# endif
2013-10-26 02:50:24 +00:00
if ( ! OpenAL_InitCapture ( ) )
return NULL ; //enumerate nothing if al is disabled
if ( ! device | | ! * device )
2019-12-16 17:36:00 +00:00
{
if ( s_al_disable . ival )
return NULL ; //no default device
2013-10-26 02:50:24 +00:00
device = palcGetString ( NULL , ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER ) ;
2019-12-16 17:36:00 +00:00
}
2013-10-26 02:50:24 +00:00
return palcCaptureOpenDevice ( device , samplerate , AL_FORMAT_MONO16 , 0.5 * samplerate ) ;
}
2018-10-11 10:31:23 +00:00
static void QDECL OPENAL_Capture_Start ( void * ctx )
2013-10-26 02:50:24 +00:00
{
ALCdevice * device = ctx ;
palcCaptureStart ( device ) ;
}
2018-10-11 10:31:23 +00:00
static unsigned int QDECL OPENAL_Capture_Update ( void * ctx , unsigned char * buffer , unsigned int minbytes , unsigned int maxbytes )
2013-10-26 02:50:24 +00:00
{
# define samplesize sizeof(short)
ALCdevice * device = ctx ;
int avail = 0 ;
palcGetIntegerv ( device , ALC_CAPTURE_SAMPLES , sizeof ( ALint ) , & avail ) ;
if ( avail * samplesize < minbytes )
return 0 ; //don't bother grabbing it if its below the threshold.
palcCaptureSamples ( device , ( ALCvoid * ) buffer , avail ) ;
return avail * samplesize ;
}
2018-10-11 10:31:23 +00:00
static void QDECL OPENAL_Capture_Stop ( void * ctx )
2013-10-26 02:50:24 +00:00
{
ALCdevice * device = ctx ;
palcCaptureStop ( device ) ;
}
2018-10-11 10:31:23 +00:00
static void QDECL OPENAL_Capture_Shutdown ( void * ctx )
2013-10-26 02:50:24 +00:00
{
ALCdevice * device = ctx ;
palcCaptureCloseDevice ( device ) ;
}
snd_capture_driver_t OPENAL_Capture =
{
1 ,
SDRVNAME ,
OPENAL_Capture_Enumerate ,
OPENAL_Capture_Init ,
OPENAL_Capture_Start ,
OPENAL_Capture_Update ,
OPENAL_Capture_Stop ,
OPENAL_Capture_Shutdown
} ;
# endif
2010-11-28 19:07:07 +00:00
# endif