UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
s_main.h File Reference

Specifies sound API? More...

Go to the source code of this file.

Macros

#define SND_VOLUME_DEFAULT   1.0f
 
#define SND_VOLUME_WEAPONS   1.0f
 

Enumerations

enum  stdsound_t { SOUND_WATER_IN, SOUND_WATER_OUT, SOUND_WATER_MOVE, MAX_SOUNDIDS }
 These sounds are precached in S_LoadSamples. More...
 

Functions

void S_Init (void)
 
void S_Shutdown (void)
 
void S_Frame (void)
 
void S_Stop (void)
 Stop all channels. More...
 
void S_PlayStdSample (const stdsound_t sId, const vec3_t origin, float atten, float volume)
 plays one of the precached samples More...
 
void S_StartLocalSample (const char *s, float volume)
 Plays a sample without spatialization. More...
 
int S_LoadSampleIdx (const char *soundFile)
 Loads and registers a sound file for later use. More...
 
bool S_LoadAndPlaySample (const char *s, const vec3_t origin, float atten, float volume)
 does what the name implies in just one function to avoid exposing s_sample_t More...
 
void S_SetSampleRepeatRate (int sampleRepeatRate)
 Controls the repeat rate for the same sample. More...
 
void S_LoadSamples (void)
 Wrapper for S_PrecacheSamples to avoid exposing it via s_sample.h. More...
 

Detailed Description

Specifies sound API?

Definition in file s_main.h.

Macro Definition Documentation

#define SND_VOLUME_WEAPONS   1.0f

Enumeration Type Documentation

enum stdsound_t

These sounds are precached in S_LoadSamples.

Enumerator
SOUND_WATER_IN 
SOUND_WATER_OUT 
SOUND_WATER_MOVE 
MAX_SOUNDIDS 

Definition at line 34 of file s_main.h.

Function Documentation

bool S_LoadAndPlaySample ( const char *  s,
const vec3_t  origin,
float  attenuation,
float  volume 
)

does what the name implies in just one function to avoid exposing s_sample_t

Parameters
sname of the sample
originwhere to play it
attenuationhow to reduce volume by distance
volumewell, the volume

Definition at line 314 of file s_main.cpp.

References Q_strnull(), S_LoadSample(), and S_PlaySample().

Referenced by CL_ActorDoShoot(), CL_ActorDoThrow(), CL_ActorPlaySound(), CL_ActorShootHidden(), CL_Explode(), CL_InvReload(), CL_SoundEvent(), LE_AddProjectile(), LE_PlayFootStepSound(), LE_PlaySoundFileAndParticleForSurface(), and LET_Projectile().

int S_LoadSampleIdx ( const char *  soundFile)

Loads and registers a sound file for later use.

Parameters
[in]soundFileThe name of the soundfile, relative to the sounds dir
Returns
The index of the loaded sample or 0
See also
S_LoadSound

Definition at line 105 of file s_sample.cpp.

References s_sample_s::chunk, cl_soundSysPool, Com_HashKey(), Com_StripExtension(), hash, s_sample_s::hashNext, s_sample_s::index, s_env_s::initialized, MAX_QPATH, Mem_PoolAllocType, Mem_PoolStrDup, s_sample_s::name, name, s_env, S_FindByName(), S_LoadSampleChunk(), SAMPLE_HASH_SIZE, and sampleIndexLast.

Referenced by LE_AddAmbientSound(), and S_LoadSample().

void S_LoadSamples ( void  )

Wrapper for S_PrecacheSamples to avoid exposing it via s_sample.h.

Definition at line 359 of file s_main.cpp.

References S_PrecacheSamples().

Referenced by CL_InitAfter(), and S_Restart_f().

void S_PlayStdSample ( const stdsound_t  sId,
const vec3_t  origin,
float  attenuation,
float  volume 
)

plays one of the precached samples

Parameters
sIdID of the sample
originwhere to play it
attenuationhow to reduce volume by distance
volumewell, the volume

Definition at line 333 of file s_main.cpp.

References S_PlaySample().

Referenced by LE_PlaySoundFileForContents().

void S_SetSampleRepeatRate ( int  sampleRepeatRate)

Controls the repeat rate for the same sample.

Parameters
[in]sampleRepeatRatemilliseconds that must have passed to play the same sample again

Definition at line 352 of file s_main.cpp.

References s_env_s::sampleRepeatRate.

Referenced by GAME_GetImportData().

void S_Shutdown ( void  )
void S_StartLocalSample ( const char *  name,
float  relVolume 
)

Plays a sample without spatialization.

Parameters
[in]nameThe sample name
[in]relVolumeMax mixer volume factor (0.0 - 1.0)
See also
S_PlaySample
S_LoadSample

Definition at line 184 of file s_mix.cpp.

References Com_Printf(), s_env_s::initialized, s_env, S_LoadSample(), S_PlaySample(), and SOUND_ATTN_NORM.

Referenced by CL_DoEndRound(), GAME_AddChatMessage(), GAME_GetImportData(), Irc_AppendToBuffer(), Irc_Client_CmdPrivmsg(), S_Play_f(), SEQ_ExecuteSound(), and UI_PlaySound().

void S_Stop ( void  )

Stop all channels.

Definition at line 58 of file s_main.cpp.

References s_env_s::channels, s_env_s::initialized, OBJZERO, and S_MumbleUnlink().

Referenced by CL_Disconnect(), and S_Shutdown().