]> icculus.org git repositories - divverent/darkplaces.git/blob - sound.h
removed a piece of debugging code
[divverent/darkplaces.git] / sound.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
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.
8
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.
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20
21 #ifndef SOUND_H
22 #define SOUND_H
23
24 #include "matrixlib.h"
25
26
27 // ====================================================================
28 // Constants
29 // ====================================================================
30
31 #define DEFAULT_SOUND_PACKET_VOLUME 255
32 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
33
34 // Channel flags
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
40
41
42 // ====================================================================
43 // Types and variables
44 // ====================================================================
45
46 typedef struct sfx_s sfx_t;
47
48 extern cvar_t bgmvolume;
49 extern cvar_t volume;
50 extern cvar_t snd_initialized;
51 extern cvar_t snd_staticvolume;
52
53
54 // ====================================================================
55 // Functions
56 // ====================================================================
57
58 void S_Init (void);
59 void S_Terminate (void);
60
61 void S_Startup (void);
62 void S_Shutdown (void);
63
64 void S_Update(const matrix4x4_t *listenermatrix);
65 void S_ExtraUpdate (void);
66
67 sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean lock);
68 void S_ServerSounds (char serversound [][MAX_QPATH], unsigned int numsounds);
69 qboolean S_IsSoundPrecached (const sfx_t *sfx);
70
71 // S_StartSound returns the channel index, or -1 if an error occurred
72 int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
73 qboolean S_LocalSound (const char *s);
74
75 void S_StaticSound (sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
76 void S_StopSound (int entnum, int entchannel);
77 void S_StopAllSounds (void);
78 void S_PauseGameSounds (qboolean toggle);
79
80 void S_StopChannel (unsigned int channel_ind);
81 qboolean S_SetChannelFlag (unsigned int ch_ind, unsigned int flag, qboolean value);
82 void S_SetChannelVolume (unsigned int ch_ind, float fvol);
83
84
85 #endif