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
);
44 case AL_METERS_PER_UNIT
:
46 pContext
->Listener
.MetersPerUnit
= flValue
;
48 alSetError(AL_INVALID_VALUE
);
52 alSetError(AL_INVALID_ENUM
);
56 ProcessContext(pContext
);
59 alSetError(AL_INVALID_OPERATION
);
65 ALAPI ALvoid ALAPIENTRY
alListener3f(ALenum eParam
, ALfloat flValue1
, ALfloat flValue2
, ALfloat flValue3
)
69 pContext
= alcGetCurrentContext();
72 SuspendContext(pContext
);
77 pContext
->Listener
.Position
[0] = flValue1
;
78 pContext
->Listener
.Position
[1] = flValue2
;
79 pContext
->Listener
.Position
[2] = flValue3
;
83 pContext
->Listener
.Velocity
[0] = flValue1
;
84 pContext
->Listener
.Velocity
[1] = flValue2
;
85 pContext
->Listener
.Velocity
[2] = flValue3
;
89 alSetError(AL_INVALID_ENUM
);
93 ProcessContext(pContext
);
96 alSetError(AL_INVALID_OPERATION
);
102 ALAPI ALvoid ALAPIENTRY
alListenerfv(ALenum eParam
, const ALfloat
*pflValues
)
104 ALCcontext
*pContext
;
106 pContext
= alcGetCurrentContext();
109 SuspendContext(pContext
);
116 if (pflValues
[0] >= 0.0f
)
117 pContext
->Listener
.Gain
= pflValues
[0];
119 alSetError(AL_INVALID_VALUE
);
122 case AL_METERS_PER_UNIT
:
123 if (pflValues
[0] > 0.0f
)
124 pContext
->Listener
.MetersPerUnit
= pflValues
[0];
126 alSetError(AL_INVALID_VALUE
);
130 pContext
->Listener
.Position
[0] = pflValues
[0];
131 pContext
->Listener
.Position
[1] = pflValues
[1];
132 pContext
->Listener
.Position
[2] = pflValues
[2];
136 pContext
->Listener
.Velocity
[0] = pflValues
[0];
137 pContext
->Listener
.Velocity
[1] = pflValues
[1];
138 pContext
->Listener
.Velocity
[2] = pflValues
[2];
143 pContext
->Listener
.Forward
[0] = pflValues
[0];
144 pContext
->Listener
.Forward
[1] = pflValues
[1];
145 pContext
->Listener
.Forward
[2] = pflValues
[2];
146 pContext
->Listener
.Up
[0] = pflValues
[3];
147 pContext
->Listener
.Up
[1] = pflValues
[4];
148 pContext
->Listener
.Up
[2] = pflValues
[5];
152 alSetError(AL_INVALID_ENUM
);
157 alSetError(AL_INVALID_VALUE
);
159 ProcessContext(pContext
);
162 alSetError(AL_INVALID_OPERATION
);
168 ALAPI ALvoid ALAPIENTRY
alListeneri(ALenum eParam
, ALint lValue
)
170 ALCcontext
*pContext
;
174 pContext
= alcGetCurrentContext();
177 SuspendContext(pContext
);
182 alSetError(AL_INVALID_ENUM
);
186 ProcessContext(pContext
);
189 alSetError(AL_INVALID_OPERATION
);
195 ALAPI
void ALAPIENTRY
alListener3i(ALenum eParam
, ALint lValue1
, ALint lValue2
, ALint lValue3
)
197 ALCcontext
*pContext
;
199 pContext
= alcGetCurrentContext();
202 SuspendContext(pContext
);
208 alListener3f(eParam
, (ALfloat
)lValue1
, (ALfloat
)lValue2
, (ALfloat
)lValue3
);
212 alSetError(AL_INVALID_ENUM
);
216 ProcessContext(pContext
);
219 alSetError(AL_INVALID_OPERATION
);
225 ALAPI
void ALAPIENTRY
alListeneriv( ALenum eParam
, const ALint
* plValues
)
227 ALCcontext
*pContext
;
230 pContext
= alcGetCurrentContext();
233 SuspendContext(pContext
);
241 flValues
[0] = (ALfloat
)plValues
[0];
242 flValues
[1] = (ALfloat
)plValues
[1];
243 flValues
[2] = (ALfloat
)plValues
[2];
244 alListenerfv(eParam
, flValues
);
248 flValues
[0] = (ALfloat
)plValues
[0];
249 flValues
[1] = (ALfloat
)plValues
[1];
250 flValues
[2] = (ALfloat
)plValues
[2];
251 flValues
[3] = (ALfloat
)plValues
[3];
252 flValues
[4] = (ALfloat
)plValues
[4];
253 flValues
[5] = (ALfloat
)plValues
[5];
254 alListenerfv(eParam
, flValues
);
258 alSetError(AL_INVALID_ENUM
);
263 alSetError(AL_INVALID_VALUE
);
265 ProcessContext(pContext
);
268 alSetError(AL_INVALID_OPERATION
);
274 ALAPI ALvoid ALAPIENTRY
alGetListenerf(ALenum eParam
, ALfloat
*pflValue
)
276 ALCcontext
*pContext
;
278 pContext
= alcGetCurrentContext();
281 SuspendContext(pContext
);
288 *pflValue
= pContext
->Listener
.Gain
;
291 case AL_METERS_PER_UNIT
:
292 *pflValue
= pContext
->Listener
.MetersPerUnit
;
296 alSetError(AL_INVALID_ENUM
);
301 alSetError(AL_INVALID_VALUE
);
303 ProcessContext(pContext
);
306 alSetError(AL_INVALID_OPERATION
);
312 ALAPI ALvoid ALAPIENTRY
alGetListener3f(ALenum eParam
, ALfloat
*pflValue1
, ALfloat
*pflValue2
, ALfloat
*pflValue3
)
314 ALCcontext
*pContext
;
316 pContext
= alcGetCurrentContext();
319 SuspendContext(pContext
);
321 if ((pflValue1
) && (pflValue2
) && (pflValue3
))
326 *pflValue1
= pContext
->Listener
.Position
[0];
327 *pflValue2
= pContext
->Listener
.Position
[1];
328 *pflValue3
= pContext
->Listener
.Position
[2];
332 *pflValue1
= pContext
->Listener
.Velocity
[0];
333 *pflValue2
= pContext
->Listener
.Velocity
[1];
334 *pflValue3
= pContext
->Listener
.Velocity
[2];
338 alSetError(AL_INVALID_ENUM
);
343 alSetError(AL_INVALID_VALUE
);
345 ProcessContext(pContext
);
348 alSetError(AL_INVALID_OPERATION
);
354 ALAPI ALvoid ALAPIENTRY
alGetListenerfv(ALenum eParam
, ALfloat
*pflValues
)
356 ALCcontext
*pContext
;
358 pContext
= alcGetCurrentContext();
361 SuspendContext(pContext
);
368 pflValues
[0] = pContext
->Listener
.Gain
;
371 case AL_METERS_PER_UNIT
:
372 pflValues
[0] = pContext
->Listener
.MetersPerUnit
;
376 pflValues
[0] = pContext
->Listener
.Position
[0];
377 pflValues
[1] = pContext
->Listener
.Position
[1];
378 pflValues
[2] = pContext
->Listener
.Position
[2];
382 pflValues
[0] = pContext
->Listener
.Velocity
[0];
383 pflValues
[1] = pContext
->Listener
.Velocity
[1];
384 pflValues
[2] = pContext
->Listener
.Velocity
[2];
389 pflValues
[0] = pContext
->Listener
.Forward
[0];
390 pflValues
[1] = pContext
->Listener
.Forward
[1];
391 pflValues
[2] = pContext
->Listener
.Forward
[2];
392 pflValues
[3] = pContext
->Listener
.Up
[0];
393 pflValues
[4] = pContext
->Listener
.Up
[1];
394 pflValues
[5] = pContext
->Listener
.Up
[2];
398 alSetError(AL_INVALID_ENUM
);
403 alSetError(AL_INVALID_VALUE
);
405 ProcessContext(pContext
);
408 alSetError(AL_INVALID_OPERATION
);
414 ALAPI ALvoid ALAPIENTRY
alGetListeneri(ALenum eParam
, ALint
*plValue
)
416 ALCcontext
*pContext
;
418 pContext
= alcGetCurrentContext();
421 SuspendContext(pContext
);
428 alSetError(AL_INVALID_ENUM
);
433 alSetError(AL_INVALID_VALUE
);
435 ProcessContext(pContext
);
438 alSetError(AL_INVALID_OPERATION
);
444 ALAPI
void ALAPIENTRY
alGetListener3i(ALenum eParam
, ALint
*plValue1
, ALint
*plValue2
, ALint
*plValue3
)
446 ALCcontext
*pContext
;
448 pContext
= alcGetCurrentContext();
451 SuspendContext(pContext
);
453 if ((plValue1
) && (plValue2
) && (plValue3
))
458 *plValue1
= (ALint
)pContext
->Listener
.Position
[0];
459 *plValue2
= (ALint
)pContext
->Listener
.Position
[1];
460 *plValue3
= (ALint
)pContext
->Listener
.Position
[2];
464 *plValue1
= (ALint
)pContext
->Listener
.Velocity
[0];
465 *plValue2
= (ALint
)pContext
->Listener
.Velocity
[1];
466 *plValue3
= (ALint
)pContext
->Listener
.Velocity
[2];
470 alSetError(AL_INVALID_ENUM
);
475 alSetError(AL_INVALID_VALUE
);
477 ProcessContext(pContext
);
480 alSetError(AL_INVALID_OPERATION
);
486 ALAPI
void ALAPIENTRY
alGetListeneriv(ALenum eParam
, ALint
* plValues
)
488 ALCcontext
*pContext
;
490 pContext
= alcGetCurrentContext();
493 SuspendContext(pContext
);
500 plValues
[0] = (ALint
)pContext
->Listener
.Position
[0];
501 plValues
[1] = (ALint
)pContext
->Listener
.Position
[1];
502 plValues
[2] = (ALint
)pContext
->Listener
.Position
[2];
506 plValues
[0] = (ALint
)pContext
->Listener
.Velocity
[0];
507 plValues
[1] = (ALint
)pContext
->Listener
.Velocity
[1];
508 plValues
[2] = (ALint
)pContext
->Listener
.Velocity
[2];
513 plValues
[0] = (ALint
)pContext
->Listener
.Forward
[0];
514 plValues
[1] = (ALint
)pContext
->Listener
.Forward
[1];
515 plValues
[2] = (ALint
)pContext
->Listener
.Forward
[2];
516 plValues
[3] = (ALint
)pContext
->Listener
.Up
[0];
517 plValues
[4] = (ALint
)pContext
->Listener
.Up
[1];
518 plValues
[5] = (ALint
)pContext
->Listener
.Up
[2];
522 alSetError(AL_INVALID_ENUM
);
527 alSetError(AL_INVALID_VALUE
);
529 ProcessContext(pContext
);
532 alSetError(AL_INVALID_OPERATION
);