Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
21 #include "client/sound/vorbis.h"
49 #define MAX_SFX (MAX_SOUNDS*2)
53 #define MAX_PLAYSOUNDS 128
75 Com_Printf(
"Sound system not started.\n");
114 Com_Printf(
"(%2db) %6i : %s\n", sc->
width * 8, size, sfx->
name) ;
116 if (sfx->
name[0] ==
'*')
117 Com_Printf(
" placeholder : %s\n", sfx->
name);
119 Com_Printf(
" not loaded : %s (%s)\n",
123 Com_Printf(
"Total resident: %i\n", total);
152 Com_Printf(
"Sound initialization disabled.\n");
156 Com_Printf(
"------- S_Init -------\n");
180 Com_EPrintf(
"Sound failed to initialize.\n");
205 Com_Printf(
"----------------------\n");
223 memset(sfx, 0,
sizeof(*sfx));
289 Com_DDDPrintf(
"%s: %d\n", __func__,
s_active);
318 if (hSfx < 1 || hSfx >
num_sfx) {
319 Com_Error(ERR_DROP,
"S_SfxForHandle: %d out of range", hSfx);
358 if (!FS_pathcmp(sfx->
name, name)) {
367 memcpy(sfx->
name, name, namelen + 1);
393 char buffer[MAX_QPATH];
405 len =
Q_strlcpy(buffer, name, MAX_QPATH);
406 }
else if (*name ==
'#') {
409 len =
Q_concat(buffer, MAX_QPATH,
"sound/", name, NULL);
415 if (len >= MAX_QPATH) {
416 Com_DPrintf(
"%s: oversize name\n", __func__);
422 Com_DPrintf(
"%s: empty name\n", __func__);
428 Com_DPrintf(
"%s: out of slots\n", __func__);
448 char buffer[MAX_QPATH];
452 if (entnum > 0 && entnum <= MAX_CLIENTS)
463 "players/", model,
"/", base + 1, NULL);
464 if (len >= MAX_QPATH) {
466 "players/",
"male",
"/", base + 1, NULL);
467 if (len >= MAX_QPATH)
478 "sound/player/male/", base + 1, NULL);
479 if (len < MAX_QPATH) {
481 sfx->
error = Q_ERR_SUCCESS;
498 if (sfx->
name[0] !=
'*')
506 for (i = 0; i <= MAX_CLIENTS; i++) {
509 for (j = 0; j < total; j++) {
587 Com_Error(ERR_DROP,
"S_PickChannel: entchannel < 0");
591 life_left = 0x7fffffff;
595 if (ch->
entnum == entnum && ch->
entchannel == entchannel && entchannel != 0) {
596 if (entchannel == 256 && ch->
sfx) {
600 first_to_die = ch_idx;
610 first_to_die = ch_idx;
614 if (first_to_die == -1)
622 memset(ch, 0,
sizeof(*ch));
636 void S_SpatializeOrigin(
const vec3_t
origin,
float master_vol,
float dist_mult,
int *left_vol,
int *right_vol)
640 vec_t lscale, rscale, scale;
644 *left_vol = *right_vol = 255;
661 if (
dma.channels == 1 || !dist_mult) {
666 rscale = 0.5 * (1.0 + dot);
667 lscale = 0.5 * (1.0 - dot);
673 scale = (1.0 - dist) * rscale;
674 *right_vol = (
int)(master_vol * scale);
678 scale = (1.0 - dist) * lscale;
679 *left_vol = (
int)(master_vol * scale);
766 Com_Printf(
"Issue %i\n", ps->
begin);
777 Com_Printf(
"S_IssuePlaysound: couldn't load %s\n", ps->
sfx->
name);
824 void S_StartSound(
const vec3_t
origin,
int entnum,
int entchannel, qhandle_t hSfx,
float vol,
float attenuation,
float timeofs)
839 if (sfx->
name[0] ==
'*') {
897 if (developer->integer && !(
snd.
flags & SND_POS))
898 CL_CheckEntityPresent(
snd.
entity,
"sound");
978 if (
s_ambient->integer == 2 && !ent->modelindex) {
983 sounds[i] = ent->sound;
999 static void S_AddLoopSounds(
void)
1002 int sounds[MAX_EDICTS];
1003 int left,
right, left_total, right_total;
1008 entity_state_t *ent;
1034 &left_total, &right_total);
1036 if (sounds[j] != sounds[i])
1047 right_total +=
right;
1050 if (left_total == 0 && right_total == 0)
1058 if (left_total > 255)
1060 if (right_total > 255)
1132 memset(ch, 0,
sizeof(*ch));
1137 memset(ch, 0,
sizeof(*ch));
1160 if (
s_show->integer > 1 || total) {
1161 Com_Printf(
"----(%i)---- painted: %i\n", total,
paintedtime);
1173 float volume = perceptual;
1181 volume = 0.003161f * expf(perceptual * 5.757f);
1184 volume = min(1.f, volume);
void OGG_RecoverState(void)
static void S_SoundInfo_f(void)
void AL_PlayChannel(channel_t *ch)
entity_state_t entityStates[MAX_PARSE_ENTITIES]
static sfx_t known_sfx[MAX_SFX]
int s_registration_sequence
qhandle_t S_RegisterSound(const char *name)
channel_t channels[MAX_CHANNELS]
void S_StopAllSounds(void)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
const char * Q_ErrorString(qerror_t error)
void Z_LeakTest(memtag_t tag)
static sfx_t * S_FindName(const char *name, size_t namelen)
void CL_GetEntitySoundOrigin(int ent, vec3_t org)
void S_InitScaletable(void)
static playsound_t * S_AllocPlaysound(void)
static cvar_t * s_swapstereo
static void S_FreeSound(sfx_t *sfx)
void Cmd_Deregister(const cmdreg_t *reg)
qhandle_t sound_precache[MAX_SOUNDS]
static void S_FreePlaysound(playsound_t *ps)
struct playsound_s * prev
static void S_SoundList_f(void)
size_t FS_NormalizePathBuffer(char *out, const char *in, size_t size)
void AL_StopChannel(channel_t *ch)
void Com_Error(error_type_t type, const char *fmt,...)
struct playsound_s * next
void S_IssuePlaysound(playsound_t *ps)
sfxcache_t * S_LoadSound(sfx_t *s)
void AL_DeleteSfx(sfx_t *s)
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
void Cmd_Register(const cmdreg_t *reg)
char model_name[MAX_QPATH]
clientinfo_t baseclientinfo
void S_StartLocalSound_(const char *sound)
static sfx_t * S_AllocSfx(void)
size_t Q_strlcpy(char *dst, const char *src, size_t size)
void Cvar_SetInteger(cvar_t *var, int value, from_t from)
clientinfo_t clientinfo[MAX_CLIENTS]
static cvar_t * s_auto_focus
channel_t * S_PickChannel(int entnum, int entchannel)
void S_ParseStartSound(void)
int DMA_DriftBeginofs(float timeofs)
void S_StartLocalSound(const char *sound)
playsound_t s_pendingplays
static sfx_t * S_RegisterSexedSound(int entnum, const char *base)
int Cvar_ClampInteger(cvar_t *var, int min, int max)
void S_EndRegistration(void)
void S_FreeAllSounds(void)
static void S_RegisterSexedSounds(void)
#define SOUND_LOOPATTENUATE
static const cmdreg_t c_sound[]
void AL_StopAllChannels(void)
float S_GetLinearVolume(float perceptual)
void DMA_ClearBuffer(void)
size_t Q_concat(char *dest, size_t size,...)
playsound_t s_playsounds[MAX_PLAYSOUNDS]
void Com_PageInMemory(void *buffer, size_t size)
static void s_auto_focus_changed(cvar_t *self)
sfx_t * S_SfxForHandle(qhandle_t hSfx)
CONST PIXELFORMATDESCRIPTOR int
void S_StartSound(const vec3_t origin, int entnum, int entchannel, qhandle_t hSfx, float vol, float attenuation, float timeofs)
void S_BeginRegistration(void)
void OGG_InitTrackList(void)
vec_t VectorNormalize(vec3_t v)
size_t FS_NormalizePath(char *out, const char *in)
int registration_sequence
void S_BuildSoundList(int *sounds)