2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "matrixlib.h"
27 // ====================================================================
29 // ====================================================================
31 #define DEFAULT_SOUND_PACKET_VOLUME 255
32 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
35 #define CHANNELFLAG_NONE 0
36 #define CHANNELFLAG_FORCELOOP (1 << 0) // force looping even if the sound is not looped
37 #define CHANNELFLAG_LOCALSOUND (1 << 1) // INTERNAL USE. Not settable by S_SetChannelFlag
38 #define CHANNELFLAG_PAUSED (1 << 2)
39 #define CHANNELFLAG_FULLVOLUME (1 << 3) // isn't affected by the general volume
42 // ====================================================================
43 // Types and variables
44 // ====================================================================
46 typedef struct sfx_s sfx_t;
48 extern cvar_t bgmvolume;
50 extern cvar_t snd_initialized;
51 extern cvar_t snd_staticvolume;
52 extern cvar_t snd_mutewhenidle;
55 // ====================================================================
57 // ====================================================================
60 void S_Terminate (void);
62 void S_Startup (void);
63 void S_Shutdown (void);
64 void S_UnloadAllSounds_f (void);
66 void S_Update(const matrix4x4_t *listenermatrix);
67 void S_ExtraUpdate (void);
69 sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean serversound);
70 void S_ClearUsed (void);
71 void S_PurgeUnused (void);
72 qboolean S_IsSoundPrecached (const sfx_t *sfx);
74 // S_StartSound returns the channel index, or -1 if an error occurred
75 int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
76 qboolean S_LocalSound (const char *s);
78 void S_StaticSound (sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
79 void S_StopSound (int entnum, int entchannel);
80 void S_StopAllSounds (void);
81 void S_PauseGameSounds (qboolean toggle);
83 void S_StopChannel (unsigned int channel_ind, qboolean lockmutex);
84 qboolean S_SetChannelFlag (unsigned int ch_ind, unsigned int flag, qboolean value);
85 void S_SetChannelVolume (unsigned int ch_ind, float fvol);
86 float S_GetChannelPosition (unsigned int ch_ind);
88 void S_BlockSound (void);
89 void S_UnblockSound (void);
91 int S_GetSoundRate (void);
92 int S_GetSoundChannels (void);