AudioBuffer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef AUDIOBUFFER_H_
  2. #define AUDIOBUFFER_H_
  3. #include "Ref.h"
  4. #include "Stream.h"
  5. namespace gameplay
  6. {
  7. class AudioSource;
  8. /**
  9. * The actual audio buffer data.
  10. *
  11. * Currently only supports supported formats: .wav, .au and .raw files.
  12. */
  13. class AudioBuffer : public Ref
  14. {
  15. friend class AudioSource;
  16. private:
  17. /**
  18. * Constructor.
  19. */
  20. AudioBuffer(const char* path, ALuint buffer);
  21. /**
  22. * Destructor.
  23. */
  24. virtual ~AudioBuffer();
  25. /**
  26. * Hidden copy assignment operator.
  27. */
  28. AudioBuffer& operator=(const AudioBuffer&);
  29. /**
  30. * Creates an audio buffer from a file.
  31. *
  32. * @param path The path to the audio buffer on the filesystem.
  33. *
  34. * @return The buffer from a file.
  35. */
  36. static AudioBuffer* create(const char* path);
  37. static bool loadWav(Stream* stream, ALuint buffer);
  38. static bool loadOgg(Stream* stream, ALuint buffer);
  39. std::string _filePath;
  40. ALuint _alBuffer;
  41. };
  42. }
  43. #endif