/
sound.h
119 lines (92 loc) · 3.39 KB
/
sound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
Copyright (c) 2017-2020 ByteBit
This file is part of BetterSpades.
BetterSpades is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BetterSpades is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BetterSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOUND_H
#define SOUND_H
#ifdef USE_SOUND
#if __APPLE__
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif
#endif
#define SOUND_SCALE 0.6F
#define SOUND_VOICES_MAX 256
#define SOUND_WORLD 0
#define SOUND_LOCAL 1
extern int sound_enabled;
struct Sound_source {
int openal_handle;
char active;
char local;
int stick_to_player;
};
struct Sound_wav {
int openal_buffer;
float min, max;
};
extern struct Sound_source sound_sources[SOUND_VOICES_MAX];
extern unsigned char sound_sources_free[SOUND_VOICES_MAX];
extern struct Sound_wav sound_footstep1;
extern struct Sound_wav sound_footstep2;
extern struct Sound_wav sound_footstep3;
extern struct Sound_wav sound_footstep4;
extern struct Sound_wav sound_wade1;
extern struct Sound_wav sound_wade2;
extern struct Sound_wav sound_wade3;
extern struct Sound_wav sound_wade4;
extern struct Sound_wav sound_jump;
extern struct Sound_wav sound_jump_water;
extern struct Sound_wav sound_land;
extern struct Sound_wav sound_land_water;
extern struct Sound_wav sound_hurt_fall;
extern struct Sound_wav sound_explode;
extern struct Sound_wav sound_explode_water;
extern struct Sound_wav sound_grenade_bounce;
extern struct Sound_wav sound_grenade_pin;
extern struct Sound_wav sound_pickup;
extern struct Sound_wav sound_horn;
extern struct Sound_wav sound_rifle_shoot;
extern struct Sound_wav sound_rifle_reload;
extern struct Sound_wav sound_smg_shoot;
extern struct Sound_wav sound_smg_reload;
extern struct Sound_wav sound_shotgun_shoot;
extern struct Sound_wav sound_shotgun_reload;
extern struct Sound_wav sound_shotgun_cock;
extern struct Sound_wav sound_hitground;
extern struct Sound_wav sound_hitplayer;
extern struct Sound_wav sound_build;
extern struct Sound_wav sound_spade_woosh;
extern struct Sound_wav sound_spade_whack;
extern struct Sound_wav sound_death;
extern struct Sound_wav sound_beep1;
extern struct Sound_wav sound_beep2;
extern struct Sound_wav sound_switch;
extern struct Sound_wav sound_empty;
extern struct Sound_wav sound_intro;
extern struct Sound_wav sound_debris;
extern struct Sound_wav sound_bounce;
extern struct Sound_wav sound_impact;
void sound_volume(float vol);
struct Sound_source* sound_create(struct Sound_source* s, int option, struct Sound_wav* w, float x, float y, float z);
struct Sound_source* sound_createEx(struct Sound_source* s, int option, struct Sound_wav* w, float x, float y, float z,
float vx, float vy, float vz);
void sound_velocity(struct Sound_source* s, float vx, float vy, float vz);
void sound_position(struct Sound_source* s, float x, float y, float z);
void sound_update();
void sound_load(struct Sound_wav* wav, char* name, float min, float max);
void sound_init(void);
#endif