🛠️🐜 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.

38 lines
1010 B

  1. #ifndef ALHELPERS_H
  2. #define ALHELPERS_H
  3. #include "AL/al.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Some helper functions to get the name from the format enums. */
  8. const char *FormatName(ALenum type);
  9. /* Easy device init/deinit functions. InitAL returns 0 on success. */
  10. int InitAL(char ***argv, int *argc);
  11. void CloseAL(void);
  12. /* Cross-platform timeget and sleep functions. */
  13. int altime_get(void);
  14. void al_nssleep(unsigned long nsec);
  15. /* C doesn't allow casting between function and non-function pointer types, so
  16. * with C99 we need to use a union to reinterpret the pointer type. Pre-C99
  17. * still needs to use a normal cast and live with the warning (C++ is fine with
  18. * a regular reinterpret_cast).
  19. */
  20. #if __STDC_VERSION__ >= 199901L
  21. #define FUNCTION_CAST(T, ptr) (union{void *p; T f;}){ptr}.f
  22. #elif defined(__cplusplus)
  23. #define FUNCTION_CAST(T, ptr) reinterpret_cast<T>(ptr)
  24. #else
  25. #define FUNCTION_CAST(T, ptr) (T)(ptr)
  26. #endif
  27. #ifdef __cplusplus
  28. } // extern "C"
  29. #endif
  30. #endif /* ALHELPERS_H */