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 mastervolume;
49 extern cvar_t bgmvolume;
51 extern cvar_t snd_initialized;
52 extern cvar_t snd_staticvolume;
53 extern cvar_t snd_mutewhenidle;
56 // ====================================================================
58 // ====================================================================
61 void S_Terminate (void);
63 void S_Startup (void);
64 void S_Shutdown (void);
65 void S_UnloadAllSounds_f (void);
67 void S_Update(const matrix4x4_t *listenermatrix);
68 void S_ExtraUpdate (void);
70 sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean serversound);
71 float S_SoundLength(const char *name);
72 void S_ClearUsed (void);
73 void S_PurgeUnused (void);
74 qboolean S_IsSoundPrecached (const sfx_t *sfx);
76 // S_StartSound returns the channel index, or -1 if an error occurred
77 int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
78 int S_StartSound_StartPosition (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float startposition);
79 qboolean S_LocalSound (const char *s);
81 void S_StaticSound (sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
82 void S_StopSound (int entnum, int entchannel);
83 void S_StopAllSounds (void);
84 void S_PauseGameSounds (qboolean toggle);
86 void S_StopChannel (unsigned int channel_ind, qboolean lockmutex);
87 qboolean S_SetChannelFlag (unsigned int ch_ind, unsigned int flag, qboolean value);
88 void S_SetChannelVolume (unsigned int ch_ind, float fvol);
89 float S_GetChannelPosition (unsigned int ch_ind);
90 float S_GetEntChannelPosition(int entnum, int entchannel);
92 void S_BlockSound (void);
93 void S_UnblockSound (void);
95 int S_GetSoundRate (void);
96 int S_GetSoundChannels (void);