🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.1 KiB

  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 <cstdlib>
  22. #include <cstring>
  23. #include <cctype>
  24. #include "AL/al.h"
  25. #include "AL/alc.h"
  26. #include "alMain.h"
  27. #include "alcontext.h"
  28. #include "alError.h"
  29. #include "alexcpt.h"
  30. AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
  31. START_API_FUNC
  32. {
  33. ContextRef context{GetContextRef()};
  34. if(UNLIKELY(!context)) return AL_FALSE;
  35. if(!extName)
  36. SETERR_RETURN(context.get(), AL_INVALID_VALUE, AL_FALSE, "NULL pointer");
  37. size_t len{strlen(extName)};
  38. const char *ptr{context->ExtensionList};
  39. while(ptr && *ptr)
  40. {
  41. if(strncasecmp(ptr, extName, len) == 0 &&
  42. (ptr[len] == '\0' || isspace(ptr[len])))
  43. return AL_TRUE;
  44. if((ptr=strchr(ptr, ' ')) != nullptr)
  45. {
  46. do {
  47. ++ptr;
  48. } while(isspace(*ptr));
  49. }
  50. }
  51. return AL_FALSE;
  52. }
  53. END_API_FUNC
  54. AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
  55. START_API_FUNC
  56. {
  57. if(!funcName) return nullptr;
  58. return alcGetProcAddress(nullptr, funcName);
  59. }
  60. END_API_FUNC
  61. AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
  62. START_API_FUNC
  63. {
  64. if(!enumName) return static_cast<ALenum>(0);
  65. return alcGetEnumValue(nullptr, enumName);
  66. }
  67. END_API_FUNC