![]() |
DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
|
|
Go to the source code of this file.
Data Structures | |
| struct | channel_t |
| struct | listener_t |
| struct | portable_sampleframe_t |
| exported for capturevideo so ogg can see all channels More... | |
| struct | sfx_t |
| struct | snd_buffer_t |
| struct | snd_fetcher_t |
| struct | snd_format_t |
| struct | snd_ringbuffer_t |
| struct | speakerlayout_t |
Macros | |
| #define | SFXFLAG_FILEMISSING (1 << 0) |
| wasn't able to load the associated sound file | |
| #define | SFXFLAG_LEVELSOUND (1 << 1) |
| the sfx is part of the server or client precache list for this level | |
| #define | SFXFLAG_MENUSOUND (1 << 3) |
| not freed during level change (menu sounds, music, etc) | |
| #define | SFXFLAG_NONE 0 |
| #define | SFXFLAG_STREAMED (1 << 2) |
| informative only. You shouldn't need to know that | |
| #define | SND_CHANNELLAYOUT_ALSA 2 |
| #define | SND_CHANNELLAYOUT_AUTO 0 |
| #define | SND_CHANNELLAYOUT_STANDARD 1 |
| #define | SND_LISTENERS 8 |
| #define | STREAM_BUFFERSIZE 16384 |
| in sampleframes | |
Typedefs | |
| typedef void(* | snd_fetcher_freesfx_t) (struct sfx_s *sfx) |
| typedef void(* | snd_fetcher_getsamplesfloat_t) (channel_t *ch, struct sfx_s *sfx, int firstsampleframe, int numsampleframes, float *outsamplesfloat) |
| typedef void(* | snd_fetcher_stopchannel_t) (channel_t *ch) |
Functions | |
| qbool | S_LoadSound (struct sfx_s *sfx, qbool complain) |
| void | S_MixToBuffer (void *stream, unsigned int frames) |
| void | S_SetUnderwaterIntensity (void) |
| snd_ringbuffer_t * | Snd_CreateRingBuffer (const snd_format_t *format, unsigned int sampleframes, void *buffer) |
| If "buffer" is NULL, the function allocates one buffer of "sampleframes" sample frames itself (if "sampleframes" is 0, the function chooses the size). | |
| unsigned int | SndSys_GetSoundTime (void) |
| Returns the number of sample frames consumed since the sound started. | |
| qbool | SndSys_Init (snd_format_t *fmt) |
| Create "snd_renderbuffer", attempting to use the chosen sound format, but accepting if the driver wants to change it (e.g. | |
| qbool | SndSys_LockRenderBuffer (void) |
| Get the exclusive lock on "snd_renderbuffer". | |
| void | SndSys_SendKeyEvents (void) |
| if the sound system can generate events, send them | |
| void | SndSys_Shutdown (void) |
| Stop the sound card, delete "snd_renderbuffer" and free its other resources. | |
| void | SndSys_Submit (void) |
| Submit the contents of "snd_renderbuffer" to the sound card. | |
| void | SndSys_UnlockRenderBuffer (void) |
| Release the exclusive lock on "snd_renderbuffer". | |
Variables | |
| channel_t | channels [MAX_CHANNELS] |
| qbool | simsound |
| If simsound is true, the sound card is not initialized and no sound is submitted to it. | |
| bool | snd_blocked |
| When true, we submit silence to the audio device. | |
| cvar_t | snd_bufferlength |
| cvar_t | snd_channellayout |
| struct mempool_s * | snd_mempool |
| snd_ringbuffer_t * | snd_renderbuffer |
| cvar_t | snd_streaming |
| cvar_t | snd_streaming_length |
| qbool | snd_threaded |
| enables use of snd_usethreadedmixing, provided that no sound hacks are in effect (like timedemo) | |
| qbool | snd_usethreadedmixing |
| if true, the main thread does not mix sound, soundtime does not advance, and neither does snd_renderbuffer->endframe, instead the audio thread will call S_MixToBuffer as needed | |
| cvar_t | snd_waterfx |
| unsigned int | total_channels |
| #define SFXFLAG_FILEMISSING (1 << 0) |
wasn't able to load the associated sound file
Definition at line 60 of file snd_main.h.
Referenced by S_LoadSound().
| #define SFXFLAG_LEVELSOUND (1 << 1) |
the sfx is part of the server or client precache list for this level
Definition at line 61 of file snd_main.h.
Referenced by S_ClearUsed(), S_FreeSfx(), S_PrecacheSound(), and S_PurgeUnused().
| #define SFXFLAG_MENUSOUND (1 << 3) |
not freed during level change (menu sounds, music, etc)
Definition at line 63 of file snd_main.h.
Referenced by S_ClearUsed(), S_FreeSfx(), S_LocalSoundEx(), S_PrecacheSound(), S_PurgeUnused(), and S_SoundList_f().
| #define SFXFLAG_NONE 0 |
Definition at line 59 of file snd_main.h.
| #define SFXFLAG_STREAMED (1 << 2) |
informative only. You shouldn't need to know that
Definition at line 62 of file snd_main.h.
Referenced by OGG_LoadVorbisFile(), S_LoadWavFile(), S_SoundList_f(), and XMP_LoadModFile().
| #define SND_CHANNELLAYOUT_ALSA 2 |
Definition at line 136 of file snd_main.h.
Referenced by S_SetChannelLayout().
| #define SND_CHANNELLAYOUT_AUTO 0 |
Definition at line 134 of file snd_main.h.
Referenced by S_SetChannelLayout(), S_Startup(), and SndSys_Init().
| #define SND_CHANNELLAYOUT_STANDARD 1 |
Definition at line 135 of file snd_main.h.
Referenced by S_SetChannelLayout(), and SndSys_Init().
| #define SND_LISTENERS 8 |
Definition at line 84 of file snd_main.h.
Referenced by S_MixToBuffer(), S_UnderwaterFilter(), S_Update(), S_UpdateAmbientSounds(), and SND_Spatialize_WithSfx().
| #define STREAM_BUFFERSIZE 16384 |
in sampleframes
Definition at line 150 of file snd_main.h.
Definition at line 115 of file snd_main.h.
| typedef void(* snd_fetcher_getsamplesfloat_t) (channel_t *ch, struct sfx_s *sfx, int firstsampleframe, int numsampleframes, float *outsamplesfloat) |
Definition at line 113 of file snd_main.h.
Definition at line 114 of file snd_main.h.
References buffer, and format.
Referenced by S_MixToBuffer(), and S_PrecacheSound().
Definition at line 369 of file snd_mix.c.
References bound, CHANNELFLAG_FORCELOOP, CHANNELFLAG_PAUSED, channels, count, channel_t::flags, floor(), int(), min, channel_t::mixspeed, NULL, paintbuffer, PAINTBUFFER_SIZE, channel_t::position, channel_t::prologic_invert, S_ConvertPaintBuffer(), S_FETCHBUFFERSIZE, S_LoadSound(), S_SoftClipPaintBuffer(), S_StopChannel(), S_UnderwaterFilter(), portable_sampleframe_t::sample, channel_t::sfx, SND_LISTENERS, snd_renderbuffer, snd_speakerlayout, snd_usethreadedmixing, total_channels, and channel_t::volume.
Referenced by Buffer_Callback(), and S_PaintAndSubmit().
Definition at line 320 of file snd_mix.c.
References bound, cl, log(), max, min, snd_waterfx, target, and underwater.
Referenced by S_UpdateAmbientSounds().
| snd_ringbuffer_t * Snd_CreateRingBuffer | ( | const snd_format_t * | format, |
| unsigned int | sampleframes, | ||
| void * | buffer ) |
If "buffer" is NULL, the function allocates one buffer of "sampleframes" sample frames itself (if "sampleframes" is 0, the function chooses the size).
Definition at line 43 of file snd_mem.c.
References buffer, format, snd_ringbuffer_t::format, snd_ringbuffer_t::maxframes, Mem_Alloc, NULL, snd_ringbuffer_t::ring, and snd_mempool.
Referenced by S_Startup(), and SndSys_Init().
Returns the number of sample frames consumed since the sound started.
Definition at line 209 of file snd_sdl.c.
References sdlaudiotime.
Referenced by S_PaintAndSubmit().
| qbool SndSys_Init | ( | snd_format_t * | fmt | ) |
Create "snd_renderbuffer", attempting to use the chosen sound format, but accepting if the driver wants to change it (e.g.
7.1 to stereo or lowering the speed) Note: SDL automatically converts all formats, so this only fails if there is no audio
Definition at line 103 of file snd_sdl.c.
References audio_device, bound, Buffer_Callback(), ceil(), CeilPowerOf2(), snd_format_t::channels, Con_DPrint(), CON_ERROR, Con_Print(), Con_Printf(), Cvar_SetValueQuick(), NULL, sdlaudiotime, snd_bufferlength, snd_channellayout, SND_CHANNELLAYOUT_AUTO, SND_CHANNELLAYOUT_STANDARD, Snd_CreateRingBuffer(), snd_renderbuffer, snd_threaded, snd_format_t::speed, and snd_format_t::width.
Referenced by S_Startup().
Get the exclusive lock on "snd_renderbuffer".
Definition at line 222 of file snd_sdl.c.
References audio_device.
Referenced by S_PaintAndSubmit(), S_StopAllSounds(), and S_StopChannel().
if the sound system can generate events, send them
Definition at line 150 of file snd_null.c.
Stop the sound card, delete "snd_renderbuffer" and free its other resources.
Definition at line 174 of file snd_sdl.c.
References audio_device, Mem_Free, NULL, and snd_renderbuffer.
Referenced by S_Shutdown().
Submit the contents of "snd_renderbuffer" to the sound card.
Definition at line 196 of file snd_sdl.c.
Referenced by S_PaintAndSubmit().
Release the exclusive lock on "snd_renderbuffer".
Definition at line 236 of file snd_sdl.c.
References audio_device.
Referenced by S_PaintAndSubmit(), S_StopAllSounds(), and S_StopChannel().
|
extern |
Definition at line 128 of file snd_main.c.
Referenced by S_ClearUsed(), S_FreeSfx(), S_GetChannelPosition(), S_GetEntChannelPosition(), S_Init(), S_LocalSoundEx(), S_MixToBuffer(), S_PauseGameSounds(), S_Play_Common(), S_PlaySfxOnChannel(), S_SetChannelFlag(), S_SetChannelLayout(), S_SetChannelSpeed(), S_SetChannelVolume(), S_StartSound_StartPosition_Flags(), S_StaticSound(), S_StopAllSounds(), S_StopChannel(), S_StopSound(), S_Update(), S_UpdateAmbientSounds(), and SND_PickChannel().
|
extern |
If simsound is true, the sound card is not initialized and no sound is submitted to it.
More generally, all arch-dependent operations are skipped or emulated. Used for isolating performance in the renderer.
Definition at line 149 of file snd_main.c.
Referenced by S_Init(), S_PaintAndSubmit(), S_Shutdown(), S_Startup(), S_StopAllSounds(), and S_StopChannel().
|
extern |
When true, we submit silence to the audio device.
Definition at line 155 of file snd_main.c.
Referenced by Buffer_Callback(), S_PaintAndSubmit(), and S_Update().
|
extern |
Definition at line 248 of file snd_main.c.
Referenced by S_Init(), and SndSys_Init().
|
extern |
Definition at line 170 of file snd_main.c.
Referenced by S_Init(), S_SetChannelLayout(), S_Update(), and SndSys_Init().
|
extern |
Definition at line 144 of file snd_main.c.
Referenced by OGG_GetSamplesFloat(), OGG_LoadVorbisFile(), S_FindName(), S_Init(), S_LoadWavFile(), S_Terminate(), S_Update(), Snd_CreateRingBuffer(), XMP_GetSamplesFloat(), and XMP_LoadModFile().
|
extern |
Definition at line 131 of file snd_main.c.
Referenced by Buffer_Callback(), S_GetSoundChannels(), S_GetSoundRate(), S_GetSoundWidth(), S_LoadSound(), S_MixToBuffer(), S_PaintAndSubmit(), S_SetChannelLayout(), S_Shutdown(), S_SoftClipPaintBuffer(), S_SoundInfo_f(), S_StartSound_StartPosition_Flags(), S_Startup(), S_StaticSound(), S_StopAllSounds(), S_Update(), SndSys_Init(), and SndSys_Shutdown().
|
extern |
Definition at line 171 of file snd_main.c.
Referenced by OGG_LoadVorbisFile(), and S_Init().
|
extern |
Definition at line 172 of file snd_main.c.
Referenced by OGG_LoadVorbisFile(), and S_Init().
|
extern |
enables use of snd_usethreadedmixing, provided that no sound hacks are in effect (like timedemo)
Definition at line 136 of file snd_main.c.
Referenced by S_PaintAndSubmit(), and SndSys_Init().
|
extern |
if true, the main thread does not mix sound, soundtime does not advance, and neither does snd_renderbuffer->endframe, instead the audio thread will call S_MixToBuffer as needed
Definition at line 137 of file snd_main.c.
Referenced by Buffer_Callback(), S_MixToBuffer(), and S_PaintAndSubmit().
|
extern |
|
extern |
Definition at line 129 of file snd_main.c.
Referenced by S_FreeSfx(), S_GetEntChannelPosition(), S_Init(), S_MixToBuffer(), S_PauseGameSounds(), S_SetChannelFlag(), S_SoundInfo_f(), S_StaticSound(), S_StopAllSounds(), S_StopChannel(), and S_Update().