summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/quakesound.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/progs/quake/quakesound.h')
-rw-r--r--apps/plugins/sdl/progs/quake/quakesound.h177
1 files changed, 177 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/quakesound.h b/apps/plugins/sdl/progs/quake/quakesound.h
new file mode 100644
index 0000000000..1ba08d3f6e
--- /dev/null
+++ b/apps/plugins/sdl/progs/quake/quakesound.h
@@ -0,0 +1,177 @@
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20// sound.h -- client sound i/o functions
21
22#ifndef __SOUND__
23#define __SOUND__
24
25#define DEFAULT_SOUND_PACKET_VOLUME 255
26#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
27
28// !!! if this is changed, it much be changed in asm_i386.h too !!!
29typedef struct
30{
31 int left;
32 int right;
33} portable_samplepair_t;
34
35typedef struct sfx_s
36{
37 char name[MAX_QPATH];
38 cache_user_t cache;
39} sfx_t;
40
41// !!! if this is changed, it much be changed in asm_i386.h too !!!
42typedef struct
43{
44 int length;
45 int loopstart;
46 int speed;
47 int width;
48 int stereo;
49 byte data[1]; // variable sized
50} sfxcache_t;
51
52typedef struct
53{
54 qboolean gamealive;
55 qboolean soundalive;
56 qboolean splitbuffer;
57 int channels;
58 int samples; // mono samples in buffer
59 int submission_chunk; // don't mix less than this #
60 int samplepos; // in mono samples
61 int samplebits;
62 int speed;
63 unsigned char *buffer;
64} dma_t;
65
66// !!! if this is changed, it much be changed in asm_i386.h too !!!
67typedef struct
68{
69 sfx_t *sfx; // sfx number
70 int leftvol; // 0-255 volume
71 int rightvol; // 0-255 volume
72 int end; // end time in global paintsamples
73 int pos; // sample position in sfx
74 int looping; // where to loop, -1 = no looping
75 int entnum; // to allow overriding a specific sound
76 int entchannel; //
77 vec3_t origin; // origin of sound effect
78 vec_t dist_mult; // distance multiplier (attenuation/clipK)
79 int master_vol; // 0-255 master volume
80} channel_t;
81
82typedef struct
83{
84 int rate;
85 int width;
86 int channels;
87 int loopstart;
88 int samples;
89 int dataofs; // chunk starts this many bytes from file start
90} wavinfo_t;
91
92void S_Init (void);
93void S_Startup (void);
94void S_Shutdown (void);
95void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
96void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
97void S_StopSound (int entnum, int entchannel);
98void S_StopAllSounds(qboolean clear);
99void S_ClearBuffer (void);
100void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
101void S_ExtraUpdate (void);
102
103sfx_t *S_PrecacheSound (char *sample);
104void S_TouchSound (char *sample);
105void S_ClearPrecache (void);
106void S_BeginPrecaching (void);
107void S_EndPrecaching (void);
108void S_PaintChannels(int endtime);
109void S_InitPaintChannels (void);
110
111// picks a channel based on priorities, empty slots, number of channels
112channel_t *SND_PickChannel(int entnum, int entchannel);
113
114// spatializes a channel
115void SND_Spatialize(channel_t *ch);
116
117// initializes cycling through a DMA buffer and returns information on it
118qboolean SNDDMA_Init(void);
119
120// gets the current DMA position
121int SNDDMA_GetDMAPos(void);
122
123// shutdown the DMA xfer.
124void SNDDMA_Shutdown(void);
125
126// ====================================================================
127// User-setable variables
128// ====================================================================
129
130#define MAX_CHANNELS 128
131#define MAX_DYNAMIC_CHANNELS 8
132
133
134extern channel_t channels[MAX_CHANNELS];
135// 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds
136// MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc
137// MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds
138
139extern int total_channels;
140
141//
142// Fake dma is a synchronous faking of the DMA progress used for
143// isolating performance in the renderer. The fakedma_updates is
144// number of times S_Update() is called per second.
145//
146
147extern qboolean fakedma;
148extern int fakedma_updates;
149extern int paintedtime;
150extern vec3_t listener_origin;
151extern vec3_t listener_forward;
152extern vec3_t listener_right;
153extern vec3_t listener_up;
154extern volatile dma_t *shm;
155extern volatile dma_t sn;
156extern vec_t sound_nominal_clip_dist;
157
158extern cvar_t loadas8bit;
159extern cvar_t bgmvolume;
160extern cvar_t volume;
161
162extern qboolean snd_initialized;
163
164extern int snd_blocked;
165
166void S_LocalSound (char *s);
167sfxcache_t *S_LoadSound (sfx_t *s);
168
169wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
170
171void SND_InitScaletable (void);
172void SNDDMA_Submit(void);
173
174void S_AmbientOff (void);
175void S_AmbientOn (void);
176
177#endif