Handle the scalar values a bit better
[openal-soft/openal-hmr.git] / OpenAL32 / alExtension.c
blobc73200d0f7b6b88f989a047eed56e012c406bbad
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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, 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", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB },
40 { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB },
41 { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO },
42 { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR },
43 { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT },
44 { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE },
45 { NULL, 0, NULL, (ALenum)0 }
49 AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
51 ALboolean ret = AL_FALSE;
52 ALCcontext *Context;
53 const char *ptr;
54 size_t len;
56 Context = GetContextRef();
57 if(!Context) return AL_FALSE;
59 al_try
61 CHECK_VALUE(Context, extName);
63 len = strlen(extName);
64 ptr = Context->ExtensionList;
65 while(ptr && *ptr)
67 if(strncasecmp(ptr, extName, len) == 0 &&
68 (ptr[len] == '\0' || isspace(ptr[len])))
70 ret = AL_TRUE;
71 break;
73 if((ptr=strchr(ptr, ' ')) != NULL)
75 do {
76 ++ptr;
77 } while(isspace(*ptr));
81 al_endtry;
83 ALCcontext_DecRef(Context);
84 return ret;
88 AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
90 if(!funcName)
91 return NULL;
92 return alcGetProcAddress(NULL, funcName);
95 AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
97 if(!enumName)
98 return (ALenum)0;
99 return alcGetEnumValue(NULL, enumName);