2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2000 by authors.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
24 #include "alListener.h"
26 ALAPI ALvoid ALAPIENTRY
alListenerf(ALenum eParam
, ALfloat flValue
)
30 pContext
= alcGetCurrentContext();
33 SuspendContext(pContext
);
39 pContext
->Listener
.Gain
= flValue
;
41 alSetError(AL_INVALID_VALUE
);
45 alSetError(AL_INVALID_ENUM
);
49 ProcessContext(pContext
);
52 alSetError(AL_INVALID_OPERATION
);
58 ALAPI ALvoid ALAPIENTRY
alListener3f(ALenum eParam
, ALfloat flValue1
, ALfloat flValue2
, ALfloat flValue3
)
62 pContext
= alcGetCurrentContext();
65 SuspendContext(pContext
);
70 pContext
->Listener
.Position
[0] = flValue1
;
71 pContext
->Listener
.Position
[1] = flValue2
;
72 pContext
->Listener
.Position
[2] = flValue3
;
76 pContext
->Listener
.Velocity
[0] = flValue1
;
77 pContext
->Listener
.Velocity
[1] = flValue2
;
78 pContext
->Listener
.Velocity
[2] = flValue3
;
82 alSetError(AL_INVALID_ENUM
);
86 ProcessContext(pContext
);
89 alSetError(AL_INVALID_OPERATION
);
95 ALAPI ALvoid ALAPIENTRY
alListenerfv(ALenum eParam
, const ALfloat
*pflValues
)
99 pContext
= alcGetCurrentContext();
102 SuspendContext(pContext
);
109 if (pflValues
[0] >= 0.0f
)
110 pContext
->Listener
.Gain
= pflValues
[0];
112 alSetError(AL_INVALID_VALUE
);
116 pContext
->Listener
.Position
[0] = pflValues
[0];
117 pContext
->Listener
.Position
[1] = pflValues
[1];
118 pContext
->Listener
.Position
[2] = pflValues
[2];
122 pContext
->Listener
.Velocity
[0] = pflValues
[0];
123 pContext
->Listener
.Velocity
[1] = pflValues
[1];
124 pContext
->Listener
.Velocity
[2] = pflValues
[2];
129 pContext
->Listener
.Forward
[0] = pflValues
[0];
130 pContext
->Listener
.Forward
[1] = pflValues
[1];
131 pContext
->Listener
.Forward
[2] = pflValues
[2];
132 pContext
->Listener
.Up
[0] = pflValues
[3];
133 pContext
->Listener
.Up
[1] = pflValues
[4];
134 pContext
->Listener
.Up
[2] = pflValues
[5];
138 alSetError(AL_INVALID_ENUM
);
143 alSetError(AL_INVALID_VALUE
);
145 ProcessContext(pContext
);
148 alSetError(AL_INVALID_OPERATION
);
154 ALAPI ALvoid ALAPIENTRY
alListeneri(ALenum eParam
, ALint lValue
)
156 ALCcontext
*pContext
;
160 pContext
= alcGetCurrentContext();
163 SuspendContext(pContext
);
168 alSetError(AL_INVALID_ENUM
);
172 ProcessContext(pContext
);
175 alSetError(AL_INVALID_OPERATION
);
181 ALAPI
void ALAPIENTRY
alListener3i(ALenum eParam
, ALint lValue1
, ALint lValue2
, ALint lValue3
)
183 ALCcontext
*pContext
;
185 pContext
= alcGetCurrentContext();
188 SuspendContext(pContext
);
194 alListener3f(eParam
, (ALfloat
)lValue1
, (ALfloat
)lValue2
, (ALfloat
)lValue3
);
198 alSetError(AL_INVALID_ENUM
);
202 ProcessContext(pContext
);
205 alSetError(AL_INVALID_OPERATION
);
211 ALAPI
void ALAPIENTRY
alListeneriv( ALenum eParam
, const ALint
* plValues
)
213 ALCcontext
*pContext
;
216 pContext
= alcGetCurrentContext();
219 SuspendContext(pContext
);
227 flValues
[0] = (ALfloat
)plValues
[0];
228 flValues
[1] = (ALfloat
)plValues
[1];
229 flValues
[2] = (ALfloat
)plValues
[2];
230 alListenerfv(eParam
, flValues
);
234 flValues
[0] = (ALfloat
)plValues
[0];
235 flValues
[1] = (ALfloat
)plValues
[1];
236 flValues
[2] = (ALfloat
)plValues
[2];
237 flValues
[3] = (ALfloat
)plValues
[3];
238 flValues
[4] = (ALfloat
)plValues
[4];
239 flValues
[5] = (ALfloat
)plValues
[5];
240 alListenerfv(eParam
, flValues
);
244 alSetError(AL_INVALID_ENUM
);
249 alSetError(AL_INVALID_VALUE
);
251 ProcessContext(pContext
);
254 alSetError(AL_INVALID_OPERATION
);
260 ALAPI ALvoid ALAPIENTRY
alGetListenerf(ALenum eParam
, ALfloat
*pflValue
)
262 ALCcontext
*pContext
;
264 pContext
= alcGetCurrentContext();
267 SuspendContext(pContext
);
274 *pflValue
= pContext
->Listener
.Gain
;
278 alSetError(AL_INVALID_ENUM
);
283 alSetError(AL_INVALID_VALUE
);
285 ProcessContext(pContext
);
288 alSetError(AL_INVALID_OPERATION
);
294 ALAPI ALvoid ALAPIENTRY
alGetListener3f(ALenum eParam
, ALfloat
*pflValue1
, ALfloat
*pflValue2
, ALfloat
*pflValue3
)
296 ALCcontext
*pContext
;
298 pContext
= alcGetCurrentContext();
301 SuspendContext(pContext
);
303 if ((pflValue1
) && (pflValue2
) && (pflValue3
))
308 *pflValue1
= pContext
->Listener
.Position
[0];
309 *pflValue2
= pContext
->Listener
.Position
[1];
310 *pflValue3
= pContext
->Listener
.Position
[2];
314 *pflValue1
= pContext
->Listener
.Velocity
[0];
315 *pflValue2
= pContext
->Listener
.Velocity
[1];
316 *pflValue3
= pContext
->Listener
.Velocity
[2];
320 alSetError(AL_INVALID_ENUM
);
325 alSetError(AL_INVALID_VALUE
);
327 ProcessContext(pContext
);
330 alSetError(AL_INVALID_OPERATION
);
336 ALAPI ALvoid ALAPIENTRY
alGetListenerfv(ALenum eParam
, ALfloat
*pflValues
)
338 ALCcontext
*pContext
;
340 pContext
= alcGetCurrentContext();
343 SuspendContext(pContext
);
350 pflValues
[0] = pContext
->Listener
.Gain
;
354 pflValues
[0] = pContext
->Listener
.Position
[0];
355 pflValues
[1] = pContext
->Listener
.Position
[1];
356 pflValues
[2] = pContext
->Listener
.Position
[2];
360 pflValues
[0] = pContext
->Listener
.Velocity
[0];
361 pflValues
[1] = pContext
->Listener
.Velocity
[1];
362 pflValues
[2] = pContext
->Listener
.Velocity
[2];
367 pflValues
[0] = pContext
->Listener
.Forward
[0];
368 pflValues
[1] = pContext
->Listener
.Forward
[1];
369 pflValues
[2] = pContext
->Listener
.Forward
[2];
370 pflValues
[3] = pContext
->Listener
.Up
[0];
371 pflValues
[4] = pContext
->Listener
.Up
[1];
372 pflValues
[5] = pContext
->Listener
.Up
[2];
376 alSetError(AL_INVALID_ENUM
);
381 alSetError(AL_INVALID_VALUE
);
383 ProcessContext(pContext
);
386 alSetError(AL_INVALID_OPERATION
);
392 ALAPI ALvoid ALAPIENTRY
alGetListeneri(ALenum eParam
, ALint
*plValue
)
394 ALCcontext
*pContext
;
396 pContext
= alcGetCurrentContext();
399 SuspendContext(pContext
);
406 alSetError(AL_INVALID_ENUM
);
411 alSetError(AL_INVALID_VALUE
);
413 ProcessContext(pContext
);
416 alSetError(AL_INVALID_OPERATION
);
422 ALAPI
void ALAPIENTRY
alGetListener3i(ALenum eParam
, ALint
*plValue1
, ALint
*plValue2
, ALint
*plValue3
)
424 ALCcontext
*pContext
;
426 pContext
= alcGetCurrentContext();
429 SuspendContext(pContext
);
431 if ((plValue1
) && (plValue2
) && (plValue3
))
436 *plValue1
= (ALint
)pContext
->Listener
.Position
[0];
437 *plValue2
= (ALint
)pContext
->Listener
.Position
[1];
438 *plValue3
= (ALint
)pContext
->Listener
.Position
[2];
442 *plValue1
= (ALint
)pContext
->Listener
.Velocity
[0];
443 *plValue2
= (ALint
)pContext
->Listener
.Velocity
[1];
444 *plValue3
= (ALint
)pContext
->Listener
.Velocity
[2];
448 alSetError(AL_INVALID_ENUM
);
453 alSetError(AL_INVALID_VALUE
);
455 ProcessContext(pContext
);
458 alSetError(AL_INVALID_OPERATION
);
464 ALAPI
void ALAPIENTRY
alGetListeneriv(ALenum eParam
, ALint
* plValues
)
466 ALCcontext
*pContext
;
468 pContext
= alcGetCurrentContext();
471 SuspendContext(pContext
);
478 plValues
[0] = (ALint
)pContext
->Listener
.Position
[0];
479 plValues
[1] = (ALint
)pContext
->Listener
.Position
[1];
480 plValues
[2] = (ALint
)pContext
->Listener
.Position
[2];
484 plValues
[0] = (ALint
)pContext
->Listener
.Velocity
[0];
485 plValues
[1] = (ALint
)pContext
->Listener
.Velocity
[1];
486 plValues
[2] = (ALint
)pContext
->Listener
.Velocity
[2];
491 plValues
[0] = (ALint
)pContext
->Listener
.Forward
[0];
492 plValues
[1] = (ALint
)pContext
->Listener
.Forward
[1];
493 plValues
[2] = (ALint
)pContext
->Listener
.Forward
[2];
494 plValues
[3] = (ALint
)pContext
->Listener
.Up
[0];
495 plValues
[4] = (ALint
)pContext
->Listener
.Up
[1];
496 plValues
[5] = (ALint
)pContext
->Listener
.Up
[2];
500 alSetError(AL_INVALID_ENUM
);
505 alSetError(AL_INVALID_VALUE
);
507 ProcessContext(pContext
);
510 alSetError(AL_INVALID_OPERATION
);