alhelpers.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef ALHELPERS_H
  2. #define ALHELPERS_H
  3. #include "AL/alc.h"
  4. #include "AL/al.h"
  5. #include "AL/alext.h"
  6. #include "threads.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif /* __cplusplus */
  10. /* Some helper functions to get the name from the channel and type enums. */
  11. const char *ChannelsName(ALenum chans);
  12. const char *TypeName(ALenum type);
  13. /* Helpers to convert frame counts and byte lengths. */
  14. ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type);
  15. ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type);
  16. /* Retrieves a compatible buffer format given the channel configuration and
  17. * sample type. If an alIsBufferFormatSupportedSOFT-compatible function is
  18. * provided, it will be called to find the closest-matching format from
  19. * AL_SOFT_buffer_samples. Returns AL_NONE (0) if no supported format can be
  20. * found. */
  21. ALenum GetFormat(ALenum channels, ALenum type, LPALISBUFFERFORMATSUPPORTEDSOFT palIsBufferFormatSupportedSOFT);
  22. /* Loads samples into a buffer using the standard alBufferData call, but with a
  23. * LPALBUFFERSAMPLESSOFT-compatible prototype. Assumes internalformat is valid
  24. * for alBufferData, and that channels and type match it. */
  25. void AL_APIENTRY wrap_BufferSamples(ALuint buffer, ALuint samplerate,
  26. ALenum internalformat, ALsizei samples,
  27. ALenum channels, ALenum type,
  28. const ALvoid *data);
  29. /* Easy device init/deinit functions. InitAL returns 0 on success. */
  30. int InitAL(void);
  31. void CloseAL(void);
  32. #ifdef __cplusplus
  33. }
  34. #endif /* __cplusplus */
  35. #endif /* ALHELPERS_H */