alExtension.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.
  8. *
  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.
  13. *
  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
  19. */
  20. #include "config.h"
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <ctype.h>
  24. #include "alError.h"
  25. #include "alMain.h"
  26. #include "alFilter.h"
  27. #include "alEffect.h"
  28. #include "alAuxEffectSlot.h"
  29. #include "alSource.h"
  30. #include "alBuffer.h"
  31. #include "AL/al.h"
  32. #include "AL/alc.h"
  33. const struct EffectList EffectList[] = {
  34. { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB },
  35. { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB },
  36. #if 0
  37. { "autowah", AUTOWAH, "AL_EFFECT_AUTOWAH", AL_EFFECT_AUTOWAH },
  38. #endif
  39. { "chorus", CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS },
  40. { "compressor", COMPRESSOR, "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR },
  41. { "distortion", DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION },
  42. { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO },
  43. { "equalizer", EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER },
  44. { "flanger", FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER },
  45. { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR },
  46. { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT },
  47. { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE },
  48. { NULL, 0, NULL, (ALenum)0 }
  49. };
  50. AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
  51. {
  52. ALboolean ret = AL_FALSE;
  53. ALCcontext *context;
  54. const char *ptr;
  55. size_t len;
  56. context = GetContextRef();
  57. if(!context) return AL_FALSE;
  58. if(!(extName))
  59. SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
  60. len = strlen(extName);
  61. ptr = context->ExtensionList;
  62. while(ptr && *ptr)
  63. {
  64. if(strncasecmp(ptr, extName, len) == 0 &&
  65. (ptr[len] == '\0' || isspace(ptr[len])))
  66. {
  67. ret = AL_TRUE;
  68. break;
  69. }
  70. if((ptr=strchr(ptr, ' ')) != NULL)
  71. {
  72. do {
  73. ++ptr;
  74. } while(isspace(*ptr));
  75. }
  76. }
  77. done:
  78. ALCcontext_DecRef(context);
  79. return ret;
  80. }
  81. AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
  82. {
  83. if(!funcName)
  84. return NULL;
  85. return alcGetProcAddress(NULL, funcName);
  86. }
  87. AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
  88. {
  89. if(!enumName)
  90. return (ALenum)0;
  91. return alcGetEnumValue(NULL, enumName);
  92. }