Use proper atomics in the OSS backend
[openal-soft.git] / OpenAL32 / alExtension.c
blobc85e900799015c5545234f2a2cbf6a875d13e765
1 /**
2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2007 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.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
21 #include "config.h"
23 #include <stdlib.h>
24 #include <string.h>
25 #include <ctype.h>
27 #include "alError.h"
28 #include "alMain.h"
29 #include "alFilter.h"
30 #include "alEffect.h"
31 #include "alAuxEffectSlot.h"
32 #include "alSource.h"
33 #include "alBuffer.h"
34 #include "AL/al.h"
35 #include "AL/alc.h"
38 const struct EffectList EffectList[] = {
39 { "eaxreverb", AL__EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB },
40 { "reverb", AL__REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB },
41 { "chorus", AL__CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS },
42 { "compressor", AL__COMPRESSOR, "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR },
43 { "distortion", AL__DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION },
44 { "echo", AL__ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO },
45 { "equalizer", AL__EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER },
46 { "flanger", AL__FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER },
47 { "modulator", AL__MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR },
48 { "dedicated", AL__DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT },
49 { "dedicated", AL__DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE },
50 { NULL, 0, NULL, (ALenum)0 }
54 AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
56 ALboolean ret = AL_FALSE;
57 ALCcontext *context;
58 const char *ptr;
59 size_t len;
61 context = GetContextRef();
62 if(!context) return AL_FALSE;
64 if(!(extName))
65 SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
67 len = strlen(extName);
68 ptr = context->ExtensionList;
69 while(ptr && *ptr)
71 if(strncasecmp(ptr, extName, len) == 0 &&
72 (ptr[len] == '\0' || isspace(ptr[len])))
74 ret = AL_TRUE;
75 break;
77 if((ptr=strchr(ptr, ' ')) != NULL)
79 do {
80 ++ptr;
81 } while(isspace(*ptr));
85 done:
86 ALCcontext_DecRef(context);
87 return ret;
91 AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
93 if(!funcName)
94 return NULL;
95 return alcGetProcAddress(NULL, funcName);
98 AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
100 if(!enumName)
101 return (ALenum)0;
102 return alcGetEnumValue(NULL, enumName);