UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
s_sample.h File Reference
#include "s_local.h"

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. More...
 
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. More...
 

Function Documentation

void S_FreeSamples ( void  )

Definition at line 139 of file s_sample.cpp.

References s_sample_s::hashNext, i, Mem_Free, OBJZERO, and SAMPLE_HASH_SIZE.

Referenced by S_Shutdown().

s_sample_t* S_GetSample ( const int  soundIdx)

Definition at line 132 of file s_sample.cpp.

References sampleIndexLast.

Referenced by S_Frame(), and 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 342 of file s_main.cpp.

References S_GetSample(), and S_LoadSampleIdx().

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

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_s::atten, s_env_s::channels, s_sample_s::chunk, CL_Milliseconds(), Com_DPrintf(), DEBUG_SOUND, s_env_s::initialized, s_sample_s::lastPlayed, s_sample_s::name, s_channel_s::org, S_AllocChannel(), s_env, S_SpatializeChannel(), s_channel_s::sample, s_env_s::sampleRepeatRate, snd_volume, cvar_s::value, and VectorCopy.

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

void S_PrecacheSamples ( void  )