Debian Codegraph @

engine/core/audio/soundmanager.i

raw
1 /***************************************************************************
2 * Copyright (C) 2005-2019 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 %module soundmanager
23 %{
24 #include "audio/soundmanager.h"
25 #include "audio/fife_openal.h"
26 %}
27
28 %include "model/metamodel/modelcoords.i"
29 %include "util/resource/resource.i"
30
31 namespace FIFE {
32
33 enum SoundDistanceModelType {
34 SD_DISTANCE_NONE,
35 SD_DISTANCE_INVERSE,
36 SD_DISTANCE_INVERSE_CLAMPED,
37 SD_DISTANCE_LINEAR,
38 SD_DISTANCE_LINEAR_CLAMPED,
39 SD_DISTANCE_EXPONENT,
40 SD_DISTANCE_EXPONENT_CLAMPED
41 };
42
43 enum SoundEffectPreset {
44 SE_PRESET_GENERIC,
45 SE_PRESET_PADDEDCELL,
46 SE_PRESET_ROOM,
47 SE_PRESET_BATHROOM,
48 SE_PRESET_LIVINGROOM,
49 SE_PRESET_STONEROOM,
50 SE_PRESET_AUDITORIUM,
51 SE_PRESET_CONCERTHALL,
52 SE_PRESET_CAVE,
53 SE_PRESET_ARENA,
54 SE_PRESET_HANGAR,
55 SE_PRESET_CARPETEDHALLWAY,
56 SE_PRESET_HALLWAY,
57 SE_PRESET_STONECORRIDOR,
58 SE_PRESET_ALLEY,
59 SE_PRESET_FOREST,
60 SE_PRESET_CITY,
61 SE_PRESET_MOUNTAINS,
62 SE_PRESET_QUARRY,
63 SE_PRESET_PLAIN,
64 SE_PRESET_PARKINGLOT,
65 SE_PRESET_SEWERPIPE,
66 SE_PRESET_UNDERWATER,
67 SE_PRESET_DRUGGED,
68 SE_PRESET_DIZZY,
69 SE_PRESET_PSYCHOTIC,
70 SE_PRESET_CASTLE_SMALLROOM,
71 SE_PRESET_CASTLE_SHORTPASSAGE,
72 SE_PRESET_CASTLE_MEDIUMROOM,
73 SE_PRESET_CASTLE_LARGEROOM,
74 SE_PRESET_CASTLE_LONGPASSAGE,
75 SE_PRESET_CASTLE_HALL,
76 SE_PRESET_CASTLE_CUPBOARD,
77 SE_PRESET_CASTLE_COURTYARD,
78 SE_PRESET_CASTLE_ALCOVE,
79 SE_PRESET_FACTORY_SMALLROOM,
80 SE_PRESET_FACTORY_SHORTPASSAGE,
81 SE_PRESET_FACTORY_MEDIUMROOM,
82 SE_PRESET_FACTORY_LARGEROOM,
83 SE_PRESET_FACTORY_LONGPASSAGE,
84 SE_PRESET_FACTORY_HALL,
85 SE_PRESET_FACTORY_CUPBOARD,
86 SE_PRESET_FACTORY_COURTYARD,
87 SE_PRESET_FACTORY_ALCOVE,
88 SE_PRESET_ICEPALACE_SMALLROOM,
89 SE_PRESET_ICEPALACE_SHORTPASSAGE,
90 SE_PRESET_ICEPALACE_MEDIUMROOM,
91 SE_PRESET_ICEPALACE_LARGEROOM,
92 SE_PRESET_ICEPALACE_LONGPASSAGE,
93 SE_PRESET_ICEPALACE_HALL,
94 SE_PRESET_ICEPALACE_CUPBOARD,
95 SE_PRESET_ICEPALACE_COURTYARD,
96 SE_PRESET_ICEPALACE_ALCOVE,
97 SE_PRESET_SPACESTATION_SMALLROOM,
98 SE_PRESET_SPACESTATION_SHORTPASSAGE,
99 SE_PRESET_SPACESTATION_MEDIUMROOM,
100 SE_PRESET_SPACESTATION_LARGEROOM,
101 SE_PRESET_SPACESTATION_LONGPASSAGE,
102 SE_PRESET_SPACESTATION_HALL,
103 SE_PRESET_SPACESTATION_CUPBOARD,
104 SE_PRESET_SPACESTATION_ALCOVE,
105 SE_PRESET_WOODEN_SMALLROOM,
106 SE_PRESET_WOODEN_SHORTPASSAGE,
107 SE_PRESET_WOODEN_MEDIUMROOM,
108 SE_PRESET_WOODEN_LARGEROOM,
109 SE_PRESET_WOODEN_LONGPASSAGE,
110 SE_PRESET_WOODEN_HALL,
111 SE_PRESET_WOODEN_CUPBOARD,
112 SE_PRESET_WOODEN_COURTYARD,
113 SE_PRESET_WOODEN_ALCOVE,
114 SE_PRESET_SPORT_EMPTYSTADIUM,
115 SE_PRESET_SPORT_SQUASHCOURT,
116 SE_PRESET_SPORT_SMALLSWIMMINGPOOL,
117 SE_PRESET_SPORT_LARGESWIMMINGPOOL,
118 SE_PRESET_SPORT_GYMNASIUM,
119 SE_PRESET_SPORT_FULLSTADIUM,
120 SE_PRESET_SPORT_STADIUMTANNOY,
121 SE_PRESET_PREFAB_WORKSHOP,
122 SE_PRESET_PREFAB_SCHOOLROOM,
123 SE_PRESET_PREFAB_PRACTISEROOM,
124 SE_PRESET_PREFAB_OUTHOUSE,
125 SE_PRESET_PREFAB_CARAVAN,
126 SE_PRESET_DOME_TOMB,
127 SE_PRESET_PIPE_SMALL,
128 SE_PRESET_DOME_SAINTPAULS,
129 SE_PRESET_PIPE_LONGTHIN,
130 SE_PRESET_PIPE_LARGE,
131 SE_PRESET_PIPE_RESONANT,
132 SE_PRESET_OUTDOORS_BACKYARD,
133 SE_PRESET_OUTDOORS_ROLLINGPLAINS,
134 SE_PRESET_OUTDOORS_DEEPCANYON,
135 SE_PRESET_OUTDOORS_CREEK,
136 SE_PRESET_OUTDOORS_VALLEY,
137 SE_PRESET_MOOD_HEAVEN,
138 SE_PRESET_MOOD_HELL,
139 SE_PRESET_MOOD_MEMORY,
140 SE_PRESET_DRIVING_COMMENTATOR,
141 SE_PRESET_DRIVING_PITGARAGE,
142 SE_PRESET_DRIVING_INCAR_RACER,
143 SE_PRESET_DRIVING_INCAR_SPORTS,
144 SE_PRESET_DRIVING_INCAR_LUXURY,
145 SE_PRESET_DRIVING_FULLGRANDSTAND,
146 SE_PRESET_DRIVING_EMPTYGRANDSTAND,
147 SE_PRESET_DRIVING_TUNNEL,
148 SE_PRESET_CITY_STREETS,
149 SE_PRESET_CITY_SUBWAY,
150 SE_PRESET_CITY_MUSEUM,
151 SE_PRESET_CITY_LIBRARY,
152 SE_PRESET_CITY_UNDERPASS,
153 SE_PRESET_CITY_ABANDONED,
154 SE_PRESET_DUSTYROOM,
155 SE_PRESET_CHAPEL,
156 SE_PRESET_SMALLWATERROOM
157 };
158
159 class SoundClip;
160 class SoundEffect;
161 class SoundFilter;
162
163 class SoundManager {
164 public:
165 void init();
166 bool isActive() const;
167
168 SoundEmitter* createEmitter();
169 SoundEmitter* createEmitter(const std::string& name);
170 void deleteEmitter(SoundEmitter* emitter);
171 SoundEmitter* getEmitter(uint32_t emitterId);
172 void releaseEmitter(uint32_t emitterId);
173
174 ALCcontext* getContext();
175
176 void setVolume(float vol);
177 float getVolume() const;
178 void mute();
179 void unmute();
180
181 void play();
182 void pause();
183 void stop();
184 void rewind();
185
186 void setDistanceModel(SoundDistanceModelType model);
187 SoundDistanceModelType getDistanceModel() const;
188 void setListenerPosition(const AudioSpaceCoordinate& position);
189 AudioSpaceCoordinate getListenerPosition() const;
190 void setListenerOrientation(const AudioSpaceCoordinate& orientation);
191 AudioSpaceCoordinate getListenerOrientation() const;
192 void setListenerVelocity(const AudioSpaceCoordinate& velocity);
193 AudioSpaceCoordinate getListenerVelocity() const;
194 void setDopplerFactor(float factor);
195 float getDopplerFactor() const;
196 void setListenerMaxDistance(float distance);
197 float getListenerMaxDistance() const;
198
199 SoundEffect* createSoundEffect(SoundEffectType type);
200 SoundEffect* createSoundEffectPreset(SoundEffectPreset type);
201 void deleteSoundEffect(SoundEffect* effect);
202 void enableSoundEffect(SoundEffect* effect);
203 void disableSoundEffect(SoundEffect* effect);
204 void addEmitterToSoundEffect(SoundEffect* effect, SoundEmitter* emitter);
205 void removeEmitterFromSoundEffect(SoundEffect* effect, SoundEmitter* emitter);
206 void addSoundFilterToSoundEffect(SoundEffect* effect, SoundFilter* filter);
207 void removeSoundFilterFromSoundEffect(SoundEffect* effect, SoundFilter* filter);
208
209 SoundFilter* createSoundFilter(SoundFilterType type);
210 void deleteSoundFilter(SoundFilter* filter);
211 void enableDirectSoundFilter(SoundFilter* filter);
212 void disableDirectSoundFilter(SoundFilter* filter);
213 void addEmitterToDirectSoundFilter(SoundFilter* filter, SoundEmitter* emitter);
214 void removeEmitterFromDirectSoundFilter(SoundFilter* filter, SoundEmitter* emitter);
215
216 void removeGroup(const std::string& group);
217 void removeAllGroups();
218 void play(const std::string& group);
219 void pause(const std::string& group);
220 void stop(const std::string& group);
221 void rewind(const std::string& group);
222 void setGain(const std::string& group, float gain);
223 void setMaxGain(const std::string& group, float gain);
224 void setMinGain(const std::string& group, float gain);
225 };
226 }