Debian Codegraph @

engine/core/audio/actionaudio.h

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 #ifndef FIFE_ACTIONAUDIO_H
23 #define FIFE_ACTIONAUDIO_H
24
25 // Standard C++ library includes
26
27 // Platform specific includes
28
29 // 3rd party library includes
30
31 // FIFE includes
32 // These includes are split up in two parts, separated by one empty line
33 // First block: files included from the FIFE root src directory
34 // Second block: files included from the same folder
35 #include "model/metamodel/modelcoords.h"
36
37 namespace FIFE {
38
39 /** The class for holding audio data per Action.
40 */
41 class ActionAudio {
42 public:
43
44 ActionAudio();
45 ~ActionAudio();
46
47 /** Sets the name of the sound file
48 */
49 void setSoundFileName(const std::string& name);
50
51 /** Return the name of the sound file
52 */
53 const std::string& getSoundFileName() const;
54
55 /** Sets the name of the group to which the emitter is added.
56 */
57 void setGroupName(const std::string& name);
58
59 /** Return the name of the group to which the emitter is added.
60 */
61 const std::string& getGroupName() const;
62
63 /** Sets the gain of the emitter
64 *
65 * @param gain The gain value. 0=silence ... 1.0=normal loudness.
66 */
67 void setGain(float gain);
68
69 /** Returns the gain of the emitter
70 *
71 * @return The gain value. 0=silence ... 1.0=normal loudness.
72 */
73 float getGain() const;
74
75 /** Sets the max. gain of the emitter
76 *
77 * @param gain The gain value. 0=silence ... 1.0=normal loudness.
78 */
79 void setMaxGain(float gain);
80
81 /** Returns the max. gain of the emitter
82 *
83 * @return The gain value. 0=silence ... 1.0=normal loudness.
84 */
85 float getMaxGain() const;
86
87 /** Sets the min. gain of the emitter
88 *
89 * @param gain The gain value. 0=silence ... 1.0=normal loudness.
90 */
91 void setMinGain(float gain);
92
93 /** Returns the min. gain of the emitter
94 *
95 * @return The gain value. 0=silence ... 1.0=normal loudness.
96 */
97 float getMinGain() const;
98
99 /** Sets the distance under which the volume for the SoundEmitter would normally drop by half (before
100 * being influenced by rolloff factor or max distance.
101 */
102 void setReferenceDistance(float distance);
103
104 /** Return the reference distance.
105 */
106 float getReferenceDistance() const;
107
108 /** Sets the max distance used with the Inverse Clamped Distance Model to set the distance where
109 * there will no longer be any attenuation of the source.
110 */
111 void setMaxDistance(float distance);
112
113 /** Return the max distance.
114 */
115 float getMaxDistance() const;
116
117 /** Sets the AL_ROLEOFF_FACTOR. Rolloff factor judges the strength of attenuation over distance.
118 *
119 * @param rolloff Rolloff factor. You'll need to do a lot of testing to find a value which suits your needs.
120 */
121 void setRolloff(float rolloff);
122
123 /** Return the AL_ROLEOFF_FACTOR. Rolloff factor judges the strength of attenuation over distance.
124 */
125 float getRolloff() const;
126
127 /** Sets pitch multiplier. Can only be positiv.
128 */
129 void setPitch(float pitch);
130
131 /** Return pitch multiplier. Can only be positiv.
132 */
133 float getPitch() const;
134
135 /** Sets inner angle of the sound cone, in degrees. Default 360
136 */
137 void setConeInnerAngle(float inner);
138
139 /** Return inner angle of the sound cone, in degrees.
140 */
141 float getConeInnerAngle() const;
142
143 /** Sets outer angle of the sound cone, in degrees. Default 360
144 */
145 void setConeOuterAngle(float outer);
146
147 /** Return outer angle of the sound cone, in degrees.
148 */
149 float getConeOuterAngle() const;
150
151 /** Sets the gain when outside the oriented cone.
152 */
153 void setConeOuterGain(float gain);
154
155 /** Return the gain when outside the oriented cone.
156 */
157 float getConeOuterGain() const;
158
159 /** Sets the velocity of the SoundEmitter in the virtual audio space.
160 */
161 void setVelocity(const AudioSpaceCoordinate& velocity);
162
163 /** Return the velocity of the SoundEmitter in the virtual audio space.
164 */
165 const AudioSpaceCoordinate& getVelocity() const;
166
167 /** Sets the playing mode
168 */
169 void setLooping(bool loop);
170
171 /** Return playing mode
172 */
173 bool isLooping() const;
174
175 /** Sets Positioning-Type
176 * Default is false
177 *
178 * @param relative If set to true, the emitters position will be interpreted relative to the listener object
179 *
180 */
181 void setRelativePositioning(bool relative);
182
183 /** Return Positioning-Type
184 */
185 bool isRelativePositioning() const;
186
187 /** Sets if the sound should use the instance direction
188 */
189 void setDirection(bool direction);
190
191 /** Return true if the Instance direction is used, false for undirected
192 */
193 bool isDirection() const;
194
195 private:
196 std::string m_name;
197 std::string m_group;
198 float m_volume;
199 float m_maxVolume;
200 float m_minVolume;
201 float m_refDistance;
202 float m_maxDistance;
203 float m_rolloff;
204 float m_pitch;
205 float m_coneInnerAngle;
206 float m_coneOuterAngle;
207 float m_coneOuterGain;
208 AudioSpaceCoordinate m_velocity;
209 bool m_looping;
210 bool m_positioning;
211 bool m_direction;
212
213 };
214 }
215
216 #endif