UFO: Alien Invasion
|
Main control for any streaming sound output device. More...
#include "../cl_shared.h"
#include "../cl_renderer.h"
#include "../cl_video.h"
#include "../battlescape/cl_camera.h"
#include "../battlescape/cl_localentity.h"
#include "../battlescape/cl_battlescape.h"
#include "s_mix.h"
#include "s_sample.h"
#include "s_main.h"
Go to the source code of this file.
Functions | |
static int | S_AllocChannel (void) |
Searches a channel with no sample applied yet. More... | |
void | S_FreeChannel (int c) |
Callback that is called when a channel finished playing. More... | |
void | S_SpatializeChannel (const s_channel_t *ch) |
Set distance and stereo panning for the specified channel. More... | |
void | S_PlaySample (const vec3_t origin, s_sample_t *sample, float atten, float relVolume) |
Validates the parms and queues the sound up. More... | |
void | S_LoopSample (const vec3_t org, s_sample_t *sample, float relVolume, float attenuation) |
Adds a loop sample for e.g. ambient sounds. More... | |
void | S_StartLocalSample (const char *name, float relVolume) |
Plays a sample without spatialization. More... | |
Main control for any streaming sound output device.
Definition in file s_mix.cpp.
Searches a channel with no sample applied yet.
-1
if no free channel was found, otherwise the index of the channel Definition at line 41 of file s_mix.cpp.
References s_env_s::channels, i, MAX_CHANNELS, s_env, and s_channel_s::sample.
Referenced by S_LoopSample(), and S_PlaySample().
void S_LoopSample | ( | const vec3_t | org, |
s_sample_t * | sample, | ||
float | relVolume, | ||
float | attenuation | ||
) |
Adds a loop sample for e.g. ambient sounds.
Definition at line 134 of file s_mix.cpp.
References s_channel_s::atten, s_env_s::channels, s_sample_s::chunk, CL_Milliseconds(), s_channel_s::count, i, s_sample_s::lastPlayed, MAX_CHANNELS, s_channel_s::org, S_AllocChannel(), s_env, S_SpatializeChannel(), s_channel_s::sample, snd_volume, cvar_s::value, VectorCopy, VectorLength(), VectorMix(), and VectorSubtract.
Referenced by S_Frame().
void S_PlaySample | ( | const vec3_t | origin, |
s_sample_t * | sample, | ||
float | atten, | ||
float | relVolume | ||
) |
Validates the parms and queues the sound up.
[in] | origin | if this is nullptr , 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) |
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_SpatializeChannel | ( | const s_channel_t * | ch | ) |
Set distance and stereo panning for the specified channel.
[in] | ch | The channel to perform the spatialization for. |
Definition at line 64 of file s_mix.cpp.
References s_channel_s::atten, clientBattleScape_s::cam, camera_s::camorg, 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.
[in] | name | The sample name |
[in] | relVolume | Max mixer volume factor (0.0 - 1.0) |
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().