|
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. | |
| 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 relVolume, float attenuation) |
| Adds a loop sample for e.g. ambient sounds. | |
| void | S_StartLocalSample (const char *name, float relVolume) |
| Plays a sample without spatialization. | |
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 i, MAX_CHANNELS, and s_env.
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_t::atten, s_sample_t::chunk, CL_Milliseconds(), s_channel_t::count, i, s_sample_t::lastPlayed, MAX_CHANNELS, s_channel_t::org, S_AllocChannel(), s_env, S_SpatializeChannel(), s_channel_t::sample, snd_volume, 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_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().
| 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_t::atten, cl, DotProduct, int(), s_channel_t::org, s_env, snd_distance_scale, todeg, 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(), name, 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(), UI_PlaySound(), and cgame_import_t::void().