Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AUD_I3DDevice.h « intern « audaspace « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 629b0997d4d5da1888a6e9a7859b3c4395d1c35f (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/*
 * $Id$
 *
 * ***** BEGIN LGPL LICENSE BLOCK *****
 *
 * Copyright 2009 Jörg Hermann Müller
 *
 * This file is part of AudaSpace.
 *
 * AudaSpace is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AudaSpace 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with AudaSpace.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ***** END LGPL LICENSE BLOCK *****
 */

#ifndef AUD_I3DDEVICE
#define AUD_I3DDEVICE

#include "AUD_Space.h"
#include "AUD_3DMath.h"

struct AUD_Handle;

/**
 * This class represents an output device for 3D sound.
 */
class AUD_I3DDevice
{
public:
	/**
	 * Retrieves the listener location.
	 * \return The listener location.
	 */
	virtual AUD_Vector3 getListenerLocation() const=0;

	/**
	 * Sets the listener location.
	 * \param location The new location.
	 */
	virtual void setListenerLocation(const AUD_Vector3& location)=0;

	/**
	 * Retrieves the listener velocity.
	 * \return The listener velocity.
	 */
	virtual AUD_Vector3 getListenerVelocity() const=0;

	/**
	 * Sets the listener velocity.
	 * \param velocity The new velocity.
	 */
	virtual void setListenerVelocity(const AUD_Vector3& velocity)=0;

	/**
	 * Retrieves the listener orientation.
	 * \return The listener orientation as quaternion.
	 */
	virtual AUD_Quaternion getListenerOrientation() const=0;

	/**
	 * Sets the listener orientation.
	 * \param orientation The new orientation as quaternion.
	 */
	virtual void setListenerOrientation(const AUD_Quaternion& orientation)=0;


	/**
	 * Retrieves the speed of sound.
	 * This value is needed for doppler effect calculation.
	 * \return The speed of sound.
	 */
	virtual float getSpeedOfSound() const=0;

	/**
	 * Sets the speed of sound.
	 * This value is needed for doppler effect calculation.
	 * \param speed The new speed of sound.
	 */
	virtual void setSpeedOfSound(float speed)=0;

	/**
	 * Retrieves the doppler factor.
	 * This value is a scaling factor for the velocity vectors of sources and
	 * listener which is used while calculating the doppler effect.
	 * \return The doppler factor.
	 */
	virtual float getDopplerFactor() const=0;

	/**
	 * Sets the doppler factor.
	 * This value is a scaling factor for the velocity vectors of sources and
	 * listener which is used while calculating the doppler effect.
	 * \param factor The new doppler factor.
	 */
	virtual void setDopplerFactor(float factor)=0;

	/**
	 * Retrieves the distance model.
	 * \return The distance model.
	 */
	virtual AUD_DistanceModel getDistanceModel() const=0;

	/**
	 * Sets the distance model.
	 * \param model distance model.
	 */
	virtual void setDistanceModel(AUD_DistanceModel model)=0;



	/**
	 * Retrieves the location of a source.
	 * \param handle The handle of the source.
	 * \return The location.
	 */
	virtual AUD_Vector3 getSourceLocation(AUD_Handle* handle)=0;

	/**
	 * Sets the location of a source.
	 * \param handle The handle of the source.
	 * \param location The new location.
	 * \return Whether the action succeeded.
	 */
	virtual bool setSourceLocation(AUD_Handle* handle, const AUD_Vector3& location)=0;

	/**
	 * Retrieves the velocity of a source.
	 * \param handle The handle of the source.
	 * \return The velocity.
	 */
	virtual AUD_Vector3 getSourceVelocity(AUD_Handle* handle)=0;

	/**
	 * Sets the velocity of a source.
	 * \param handle The handle of the source.
	 * \param velocity The new velocity.
	 * \return Whether the action succeeded.
	 */
	virtual bool setSourceVelocity(AUD_Handle* handle, const AUD_Vector3& velocity)=0;

	/**
	 * Retrieves the orientation of a source.
	 * \param handle The handle of the source.
	 * \return The orientation as quaternion.
	 */
	virtual AUD_Quaternion getSourceOrientation(AUD_Handle* handle)=0;

	/**
	 * Sets the orientation of a source.
	 * \param handle The handle of the source.
	 * \param orientation The new orientation as quaternion.
	 * \return Whether the action succeeded.
	 */
	virtual bool setSourceOrientation(AUD_Handle* handle, const AUD_Quaternion& orientation)=0;


	/**
	 * Checks whether the source location, velocity and orientation are relative
	 * to the listener.
	 * \param handle The handle of the source.
	 * \return Whether the source is relative.
	 */
	virtual bool isRelative(AUD_Handle* handle)=0;

	/**
	 * Sets whether the source location, velocity and orientation are relative
	 * to the listener.
	 * \param handle The handle of the source.
	 * \param relative Whether the source is relative.
	 * \return Whether the action succeeded.
	 */
	virtual bool setRelative(AUD_Handle* handle, bool relative)=0;

	/**
	 * Retrieves the maximum volume of a source.
	 * \param handle The handle of the source.
	 * \return The maximum volume.
	 */
	virtual float getVolumeMaximum(AUD_Handle* handle)=0;

	/**
	 * Sets the maximum volume of a source.
	 * \param handle The handle of the source.
	 * \param volume The new maximum volume.
	 * \return Whether the action succeeded.
	 */
	virtual bool setVolumeMaximum(AUD_Handle* handle, float volume)=0;

	/**
	 * Retrieves the minimum volume of a source.
	 * \param handle The handle of the source.
	 * \return The minimum volume.
	 */
	virtual float getVolumeMinimum(AUD_Handle* handle)=0;

	/**
	 * Sets the minimum volume of a source.
	 * \param handle The handle of the source.
	 * \param volume The new minimum volume.
	 * \return Whether the action succeeded.
	 */
	virtual bool setVolumeMinimum(AUD_Handle* handle, float volume)=0;

	/**
	 * Retrieves the maximum distance of a source.
	 * If a source is further away from the reader than this distance, the
	 * volume will automatically be set to 0.
	 * \param handle The handle of the source.
	 * \return The maximum distance.
	 */
	virtual float getDistanceMaximum(AUD_Handle* handle)=0;

	/**
	 * Sets the maximum distance of a source.
	 * If a source is further away from the reader than this distance, the
	 * volume will automatically be set to 0.
	 * \param handle The handle of the source.
	 * \param distance The new maximum distance.
	 * \return Whether the action succeeded.
	 */
	virtual bool setDistanceMaximum(AUD_Handle* handle, float distance)=0;

	/**
	 * Retrieves the reference distance of a source.
	 * \param handle The handle of the source.
	 * \return The reference distance.
	 */
	virtual float getDistanceReference(AUD_Handle* handle)=0;

	/**
	 * Sets the reference distance of a source.
	 * \param handle The handle of the source.
	 * \param distance The new reference distance.
	 * \return Whether the action succeeded.
	 */
	virtual bool setDistanceReference(AUD_Handle* handle, float distance)=0;

	/**
	 * Retrieves the attenuation of a source.
	 * \param handle The handle of the source.
	 * \return The attenuation.
	 */
	virtual float getAttenuation(AUD_Handle* handle)=0;

	/**
	 * Sets the attenuation of a source.
	 * This value is used for distance calculation.
	 * \param handle The handle of the source.
	 * \param factor The new attenuation.
	 * \return Whether the action succeeded.
	 */
	virtual bool setAttenuation(AUD_Handle* handle, float factor)=0;

	/**
	 * Retrieves the outer angle of the cone of a source.
	 * \param handle The handle of the source.
	 * \return The outer angle of the cone.
	 */
	virtual float getConeAngleOuter(AUD_Handle* handle)=0;

	/**
	 * Sets the outer angle of the cone of a source.
	 * \param handle The handle of the source.
	 * \param angle The new outer angle of the cone.
	 * \return Whether the action succeeded.
	 */
	virtual bool setConeAngleOuter(AUD_Handle* handle, float angle)=0;

	/**
	 * Retrieves the inner angle of the cone of a source.
	 * \param handle The handle of the source.
	 * \return The inner angle of the cone.
	 */
	virtual float getConeAngleInner(AUD_Handle* handle)=0;

	/**
	 * Sets the inner angle of the cone of a source.
	 * \param handle The handle of the source.
	 * \param angle The new inner angle of the cone.
	 * \return Whether the action succeeded.
	 */
	virtual bool setConeAngleInner(AUD_Handle* handle, float angle)=0;

	/**
	 * Retrieves the outer volume of the cone of a source.
	 * The volume between inner and outer angle is interpolated between inner
	 * volume and this value.
	 * \param handle The handle of the source.
	 * \return The outer volume of the cone.
	 */
	virtual float getConeVolumeOuter(AUD_Handle* handle)=0;

	/**
	 * Sets the outer volume of the cone of a source.
	 * The volume between inner and outer angle is interpolated between inner
	 * volume and this value.
	 * \param handle The handle of the source.
	 * \param volume The new outer volume of the cone.
	 * \return Whether the action succeeded.
	 */
	virtual bool setConeVolumeOuter(AUD_Handle* handle, float volume)=0;
};

#endif //AUD_I3DDEVICE