UFO: Alien Invasion
Loading...
Searching...
No Matches
s_sample.h File Reference
#include "s_local.h"
Include dependency graph for s_sample.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void S_PrecacheSamples (void)
void S_FreeSamples (void)
s_sample_tS_LoadSample (const char *s)
 Loads and registers a sound file for later use.
s_sample_tS_GetSample (const int soundIdx)
void S_PlaySample (const vec3_t origin, s_sample_t *sample, float atten, float volume)
 Validates the parms and queues the sound up.

Function Documentation

◆ S_FreeSamples()

void S_FreeSamples ( void )

Definition at line 139 of file s_sample.cpp.

References s_sample_t::hashNext, i, Mem_Free, OBJZERO, SAMPLE_HASH_SIZE, sampleHash, and sampleIndex.

Referenced by S_Shutdown().

◆ S_GetSample()

s_sample_t * S_GetSample ( const int soundIdx)

Definition at line 132 of file s_sample.cpp.

References sampleIndex, and sampleIndexLast.

Referenced by S_Frame(), and S_LoadSample().

◆ S_LoadSample()

s_sample_t * S_LoadSample ( const char * soundFile)

Loads and registers a sound file for later use.

Parameters
[in]soundFileThe name of the soundfile, relative to the sounds dir

Definition at line 335 of file s_main.cpp.

References S_GetSample(), and S_LoadSampleIdx().

Referenced by S_LoadAndPlaySample(), S_PrecacheSamples(), and S_StartLocalSample().

◆ S_PlaySample()

void S_PlaySample ( const vec3_t origin,
s_sample_t * sample,
float atten,
float relVolume )

Validates the parms and queues the sound up.

Parameters
[in]originif this is nullptr, the sound will be dynamically sourced from the entity
[in]sampleThe soundfile to play
[in]attenAttenuation of sound to be played (for example, fireAttenuation or impactAttenuation from fireDef_s).
[in]relVolumeMax mixer volume factor (0.0 - 1.0)
See also
S_StartLocalSample
S_SetVolume

Definition at line 96 of file s_mix.cpp.

References s_channel_t::atten, s_sample_t::chunk, CL_Milliseconds(), Com_DPrintf(), DEBUG_SOUND, s_sample_t::lastPlayed, s_sample_t::name, s_channel_t::org, S_AllocChannel(), s_env, S_SpatializeChannel(), s_channel_t::sample, snd_volume, and VectorCopy.

Referenced by S_LoadAndPlaySample(), S_PlayStdSample(), and S_StartLocalSample().

◆ S_PrecacheSamples()

void S_PrecacheSamples ( void )
Note
Called at precache phase - only load these soundfiles once at startup or on sound restart
See also
S_Restart_f

Definition at line 163 of file s_sample.cpp.

References fireDef_t::bounceSound, csi, objDef_t::fd, fireDef_t::fireSound, fireDef_t::hitBodySound, i, fireDef_t::impactSound, INVSH_GetItemByIDX(), objDef_t::numFiredefs, objDef_t::numWeapons, s_env, S_LoadSample(), SOUND_WATER_IN, SOUND_WATER_MOVE, SOUND_WATER_OUT, and stdSoundPool.

Referenced by S_LoadSamples().