︙ | | | ︙ | |
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
VARP(musicvol, 0, 128, 255);
bool nosound = false;
#define MAXCHAN 32
#define SOUNDFREQ 22050
struct soundloc {
vec loc;
bool inuse;
} soundlocs[MAXCHAN];
#ifdef USE_MIXER
# include "SDL_mixer.h"
# define MAXVOL MIX_MAX_VOLUME
Mix_Music *mod = NULL;
|
|
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
VARP(musicvol, 0, 128, 255);
bool nosound = false;
#define MAXCHAN 32
#define SOUNDFREQ 22050
struct soundloc {
OFVector3D loc;
bool inuse;
} soundlocs[MAXCHAN];
#ifdef USE_MIXER
# include "SDL_mixer.h"
# define MAXVOL MIX_MAX_VOLUME
Mix_Music *mod = NULL;
|
︙ | | | ︙ | |
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
FSOUND_Close();
#endif
};
VAR(stereo, 0, 1, 1);
void
updatechanvol(int chan, vec *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1->o);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
|
|
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
FSOUND_Close();
#endif
};
VAR(stereo, 0, 1, 1);
void
updatechanvol(int chan, OFVector3D *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1->o);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
|
︙ | | | ︙ | |
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#else
FSOUND_SetVolume(chan, vol);
FSOUND_SetPan(chan, pan);
#endif
};
void
newsoundloc(int chan, vec *loc)
{
assert(chan >= 0 && chan < MAXCHAN);
soundlocs[chan].loc = *loc;
soundlocs[chan].inuse = true;
};
void
|
|
|
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#else
FSOUND_SetVolume(chan, vol);
FSOUND_SetPan(chan, pan);
#endif
};
void
newsoundloc(int chan, OFVector3D *loc)
{
assert(chan >= 0 && chan < MAXCHAN);
soundlocs[chan].loc = *loc;
soundlocs[chan].inuse = true;
};
void
|
︙ | | | ︙ | |
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
addmsg(0, 2, SV_SOUND, n);
playsound(n);
};
int soundsatonce = 0, lastsoundmillis = 0;
void
playsound(int n, vec *loc)
{
if (nosound)
return;
if (!soundvol)
return;
if (lastmillis == lastsoundmillis)
soundsatonce++;
|
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
addmsg(0, 2, SV_SOUND, n);
playsound(n);
};
int soundsatonce = 0, lastsoundmillis = 0;
void
playsound(int n, OFVector3D *loc)
{
if (nosound)
return;
if (!soundvol)
return;
if (lastmillis == lastsoundmillis)
soundsatonce++;
|
︙ | | | ︙ | |