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
29 static const ALchar alVendor
[] = "OpenAL Community";
30 static const ALchar alVersion
[] = "1.1";
31 static const ALchar alRenderer
[] = "OpenAL Soft";
34 static const ALchar alNoError
[] = "No Error";
35 static const ALchar alErrInvalidName
[] = "Invalid Name";
36 static const ALchar alErrInvalidEnum
[] = "Invalid Enum";
37 static const ALchar alErrInvalidValue
[] = "Invalid Value";
38 static const ALchar alErrInvalidOp
[] = "Invalid Operation";
39 static const ALchar alErrOutOfMemory
[] = "Out of Memory";
41 ALAPI ALvoid ALAPIENTRY
alEnable(ALenum capability
)
45 Context
=alcGetCurrentContext();
48 SuspendContext(Context
);
53 alSetError(AL_INVALID_ENUM
);
57 ProcessContext(Context
);
62 alSetError(AL_INVALID_OPERATION
);
66 ALAPI ALvoid ALAPIENTRY
alDisable(ALenum capability
)
70 Context
=alcGetCurrentContext();
73 SuspendContext(Context
);
78 alSetError(AL_INVALID_ENUM
);
82 ProcessContext(Context
);
87 alSetError(AL_INVALID_OPERATION
);
91 ALAPI ALboolean ALAPIENTRY
alIsEnabled(ALenum capability
)
94 ALboolean value
=AL_FALSE
;
96 Context
=alcGetCurrentContext();
99 SuspendContext(Context
);
104 alSetError(AL_INVALID_ENUM
);
108 ProcessContext(Context
);
113 alSetError(AL_INVALID_OPERATION
);
119 ALAPI ALboolean ALAPIENTRY
alGetBoolean(ALenum pname
)
122 ALboolean value
=AL_FALSE
;
124 Context
=alcGetCurrentContext();
127 SuspendContext(Context
);
131 case AL_DOPPLER_FACTOR
:
132 if (Context
->DopplerFactor
!= 0.0f
)
136 case AL_DOPPLER_VELOCITY
:
137 if (Context
->DopplerVelocity
!= 0.0f
)
141 case AL_DISTANCE_MODEL
:
142 if (Context
->DistanceModel
== AL_INVERSE_DISTANCE_CLAMPED
)
146 case AL_SPEED_OF_SOUND
:
147 if (Context
->flSpeedOfSound
!= 0.0f
)
152 alSetError(AL_INVALID_ENUM
);
156 ProcessContext(Context
);
161 alSetError(AL_INVALID_OPERATION
);
167 ALAPI ALdouble ALAPIENTRY
alGetDouble(ALenum pname
)
170 ALdouble value
= 0.0;
172 Context
=alcGetCurrentContext();
175 SuspendContext(Context
);
179 case AL_DOPPLER_FACTOR
:
180 value
= (double)Context
->DopplerFactor
;
183 case AL_DOPPLER_VELOCITY
:
184 value
= (double)Context
->DopplerVelocity
;
187 case AL_DISTANCE_MODEL
:
188 value
= (double)Context
->DistanceModel
;
191 case AL_SPEED_OF_SOUND
:
192 value
= (double)Context
->flSpeedOfSound
;
196 alSetError(AL_INVALID_ENUM
);
200 ProcessContext(Context
);
205 alSetError(AL_INVALID_OPERATION
);
211 ALAPI ALfloat ALAPIENTRY
alGetFloat(ALenum pname
)
214 ALfloat value
= 0.0f
;
216 Context
=alcGetCurrentContext();
219 SuspendContext(Context
);
223 case AL_DOPPLER_FACTOR
:
224 value
= Context
->DopplerFactor
;
227 case AL_DOPPLER_VELOCITY
:
228 value
= Context
->DopplerVelocity
;
231 case AL_DISTANCE_MODEL
:
232 value
= (float)Context
->DistanceModel
;
235 case AL_SPEED_OF_SOUND
:
236 value
= Context
->flSpeedOfSound
;
240 alSetError(AL_INVALID_ENUM
);
244 ProcessContext(Context
);
249 alSetError(AL_INVALID_OPERATION
);
255 ALAPI ALint ALAPIENTRY
alGetInteger(ALenum pname
)
260 Context
=alcGetCurrentContext();
263 SuspendContext(Context
);
267 case AL_DOPPLER_FACTOR
:
268 value
= (ALint
)Context
->DopplerFactor
;
271 case AL_DOPPLER_VELOCITY
:
272 value
= (ALint
)Context
->DopplerVelocity
;
275 case AL_DISTANCE_MODEL
:
276 value
= (ALint
)Context
->DistanceModel
;
279 case AL_SPEED_OF_SOUND
:
280 value
= (ALint
)Context
->flSpeedOfSound
;
284 alSetError(AL_INVALID_ENUM
);
288 ProcessContext(Context
);
293 alSetError(AL_INVALID_OPERATION
);
299 ALAPI ALvoid ALAPIENTRY
alGetBooleanv(ALenum pname
,ALboolean
*data
)
303 Context
=alcGetCurrentContext();
306 SuspendContext(Context
);
312 case AL_DOPPLER_FACTOR
:
313 *data
= (ALboolean
)((Context
->DopplerFactor
!= 0.0f
) ? AL_TRUE
: AL_FALSE
);
316 case AL_DOPPLER_VELOCITY
:
317 *data
= (ALboolean
)((Context
->DopplerVelocity
!= 0.0f
) ? AL_TRUE
: AL_FALSE
);
320 case AL_DISTANCE_MODEL
:
321 *data
= (ALboolean
)((Context
->DistanceModel
== AL_INVERSE_DISTANCE_CLAMPED
) ? AL_TRUE
: AL_FALSE
);
324 case AL_SPEED_OF_SOUND
:
325 *data
= (ALboolean
)((Context
->flSpeedOfSound
!= 0.0f
) ? AL_TRUE
: AL_FALSE
);
329 alSetError(AL_INVALID_ENUM
);
335 // data is a NULL pointer
336 alSetError(AL_INVALID_VALUE
);
339 ProcessContext(Context
);
344 alSetError(AL_INVALID_OPERATION
);
350 ALAPI ALvoid ALAPIENTRY
alGetDoublev(ALenum pname
,ALdouble
*data
)
354 Context
=alcGetCurrentContext();
357 SuspendContext(Context
);
363 case AL_DOPPLER_FACTOR
:
364 *data
= (double)Context
->DopplerFactor
;
367 case AL_DOPPLER_VELOCITY
:
368 *data
= (double)Context
->DopplerVelocity
;
371 case AL_DISTANCE_MODEL
:
372 *data
= (double)Context
->DistanceModel
;
375 case AL_SPEED_OF_SOUND
:
376 *data
= (double)Context
->flSpeedOfSound
;
380 alSetError(AL_INVALID_ENUM
);
386 // data is a NULL pointer
387 alSetError(AL_INVALID_VALUE
);
390 ProcessContext(Context
);
395 alSetError(AL_INVALID_OPERATION
);
401 ALAPI ALvoid ALAPIENTRY
alGetFloatv(ALenum pname
,ALfloat
*data
)
405 Context
=alcGetCurrentContext();
408 SuspendContext(Context
);
414 case AL_DOPPLER_FACTOR
:
415 *data
= Context
->DopplerFactor
;
418 case AL_DOPPLER_VELOCITY
:
419 *data
= Context
->DopplerVelocity
;
422 case AL_DISTANCE_MODEL
:
423 *data
= (float)Context
->DistanceModel
;
426 case AL_SPEED_OF_SOUND
:
427 *data
= Context
->flSpeedOfSound
;
431 alSetError(AL_INVALID_ENUM
);
437 // data is a NULL pointer
438 alSetError(AL_INVALID_VALUE
);
441 ProcessContext(Context
);
446 alSetError(AL_INVALID_OPERATION
);
452 ALAPI ALvoid ALAPIENTRY
alGetIntegerv(ALenum pname
,ALint
*data
)
456 Context
=alcGetCurrentContext();
459 SuspendContext(Context
);
465 case AL_DOPPLER_FACTOR
:
466 *data
= (ALint
)Context
->DopplerFactor
;
469 case AL_DOPPLER_VELOCITY
:
470 *data
= (ALint
)Context
->DopplerVelocity
;
473 case AL_DISTANCE_MODEL
:
474 *data
= (ALint
)Context
->DistanceModel
;
477 case AL_SPEED_OF_SOUND
:
478 *data
= (ALint
)Context
->flSpeedOfSound
;
482 alSetError(AL_INVALID_ENUM
);
488 // data is a NULL pointer
489 alSetError(AL_INVALID_VALUE
);
492 ProcessContext(Context
);
497 alSetError(AL_INVALID_OPERATION
);
503 ALAPI
const ALchar
* ALAPIENTRY
alGetString(ALenum pname
)
506 ALCcontext
*pContext
;
508 pContext
= alcGetCurrentContext();
511 alSetError(AL_INVALID_OPERATION
);
515 SuspendContext(pContext
);
532 value
=pContext
->ExtensionList
;//alExtensions;
539 case AL_INVALID_NAME
:
540 value
=alErrInvalidName
;
543 case AL_INVALID_ENUM
:
544 value
=alErrInvalidEnum
;
547 case AL_INVALID_VALUE
:
548 value
=alErrInvalidValue
;
551 case AL_INVALID_OPERATION
:
552 value
=alErrInvalidOp
;
555 case AL_OUT_OF_MEMORY
:
556 value
=alErrOutOfMemory
;
561 alSetError(AL_INVALID_ENUM
);
565 ProcessContext(pContext
);
570 ALAPI ALvoid ALAPIENTRY
alDopplerFactor(ALfloat value
)
574 Context
=alcGetCurrentContext();
577 SuspendContext(Context
);
580 Context
->DopplerFactor
= value
;
582 alSetError(AL_INVALID_VALUE
);
584 ProcessContext(Context
);
589 alSetError(AL_INVALID_OPERATION
);
595 ALAPI ALvoid ALAPIENTRY
alDopplerVelocity(ALfloat value
)
599 Context
=alcGetCurrentContext();
602 SuspendContext(Context
);
605 Context
->DopplerVelocity
=value
;
607 alSetError(AL_INVALID_VALUE
);
609 ProcessContext(Context
);
614 alSetError(AL_INVALID_OPERATION
);
620 ALAPI ALvoid ALAPIENTRY
alSpeedOfSound(ALfloat flSpeedOfSound
)
622 ALCcontext
*pContext
;
624 pContext
= alcGetCurrentContext();
627 SuspendContext(pContext
);
629 if (flSpeedOfSound
> 0.0f
)
630 pContext
->flSpeedOfSound
= flSpeedOfSound
;
632 alSetError(AL_INVALID_VALUE
);
634 ProcessContext(pContext
);
638 alSetError(AL_INVALID_OPERATION
);
644 ALAPI ALvoid ALAPIENTRY
alDistanceModel(ALenum value
)
648 Context
=alcGetCurrentContext();
651 SuspendContext(Context
);
656 case AL_INVERSE_DISTANCE
:
657 case AL_INVERSE_DISTANCE_CLAMPED
:
658 case AL_LINEAR_DISTANCE
:
659 case AL_LINEAR_DISTANCE_CLAMPED
:
660 case AL_EXPONENT_DISTANCE
:
661 case AL_EXPONENT_DISTANCE_CLAMPED
:
662 Context
->DistanceModel
= value
;
666 alSetError(AL_INVALID_VALUE
);
670 ProcessContext(Context
);
675 alSetError(AL_INVALID_OPERATION
);