s_mix.c File Reference

Main control for any streaming sound output device. More...

#include "s_local.h"
#include "s_mix.h"
#include "s_main.h"
Include dependency graph for s_mix.c:

Go to the source code of this file.

Functions

static int S_AllocChannel (void)
 Searches a channel with no sample applied yet.
void S_FreeChannel (int c)
 Callback that is called when a channel finished playing.
void S_SpatializeChannel (const s_channel_t *ch)
 Set distance and stereo panning for the specified channel.
void S_PlaySample (const vec3_t origin, s_sample_t *sample, float atten, float relVolume)
 Validates the parms and queues the sound up.
void S_LoopSample (const vec3_t org, s_sample_t *sample, float volume, float attenuation)
 Adds a loop sample for e.g. ambient sounds.
void S_StartLocalSample (const char *name, float relVolume)
 Plays a sample without spatialization.

Detailed Description

Main control for any streaming sound output device.

Definition in file s_mix.c.


Function Documentation

static int S_AllocChannel ( void   )  [static]

Searches a channel with no sample applied yet.

Returns:
-1 if no free channel was found, otherwise the index of the channel

Definition at line 34 of file s_mix.c.

References s_env_s::channels, i, MAX_CHANNELS, s_env, and s_channel_s::sample.

Referenced by S_LoopSample(), and S_PlaySample().

void S_FreeChannel ( int  c  ) 

Callback that is called when a channel finished playing.

Parameters:
c The channel id

Definition at line 50 of file s_mix.c.

References s_env_s::channels, and s_env.

Referenced by S_Init().

void S_LoopSample ( const vec3_t  org,
s_sample_t sample,
float  volume,
float  attenuation 
)
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] origin if this is NULL, the sound will be dynamically sourced from the entity
[in] sample The soundfile to play
[in] atten Attenuation of sound to be played (for example, fireAttenuation or impactAttenuation from fireDef_s).
[in] relVolume Max mixer volume factor (0.0 - 1.0)
See also:
S_StartLocalSample
S_SetVolume

Definition at line 91 of file s_mix.c.

References s_channel_s::atten, s_env_s::channels, s_sample_s::chunk, CL_Milliseconds(), Com_DPrintf(), DEBUG_SOUND, i, 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 CL_ActorDoShoot(), CL_ActorDoThrow(), CL_ActorPlaySound(), CL_InvReload(), CL_ParseStartSoundPacket(), LE_AddProjectile(), LE_PlaySoundFileAndParticleForSurface(), LE_PlaySoundFileForContents(), LET_Projectile(), and S_StartLocalSample().

void S_SpatializeChannel ( const s_channel_t ch  ) 

Set distance and stereo panning for the specified channel.

Parameters:
[in] ch The channel to perform the spatialization for.

Definition at line 59 of file s_mix.c.

References s_channel_s::atten, s_env_s::channels, cl, DotProduct, int(), s_channel_s::org, s_env_s::right, s_env, snd_distance_scale, todeg, cvar_s::value, VectorNormalize(), and VectorSubtract.

Referenced by S_Frame(), S_LoopSample(), and S_PlaySample().

void S_StartLocalSample ( const char *  name,
float  relVolume 
)

Plays a sample without spatialization.

Parameters:
[in] name The sample name
[in] relVolume Max mixer volume factor (0.0 - 1.0)
See also:
S_PlaySample
S_LoadSample

Definition at line 181 of file s_mix.c.

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

Referenced by CL_ActorShootHidden(), CL_DoEndRound(), CL_ParseServerMessage(), Irc_AppendToBuffer(), Irc_Client_CmdPrivmsg(), MS_AddNewMessageSound(), S_Play_f(), SEQ_ExecuteSound(), and UI_PlaySound().


Generated by  doxygen 1.6.2