HatchitAudio
ht_audiobuffer.h
1 
15 #pragma once
16 
17 #include <ht_platform.h> //HT_API
18 #include <ht_noncopy.h>
19 #include <cstdlib>
20 #include <AL/al.h>
21 #include <AL/alc.h>
22 
23 namespace Hatchit
24 {
25  namespace Audio
26  {
27  class HT_API Buffer : public Core::INonCopy
28  {
29  public:
30  static constexpr size_t BufferSize = 4096;
31 
32  enum class Format : ALenum
33  {
34  Mono8 = AL_FORMAT_MONO8,
35  Mono16 = AL_FORMAT_MONO16,
36  Stereo8 = AL_FORMAT_STEREO8,
37  Stereo16 = AL_FORMAT_STEREO16
38  };
39 
40  Buffer();
41  Buffer(const Buffer&) = delete;
42  Buffer(Buffer&& buffer);
43  virtual ~Buffer();
44 
45  Buffer& operator=(const Buffer&) = delete;
46  Buffer& operator=(Buffer&& buffer);
47 
48  bool Initialize();
49  void DeInitialize();
50 
51  bool SetData(
52  Format format,
53  const void* data,
54  ALsizei dataSize,
55  ALsizei frequency);
56 
57  size_t GetBufferSize() const;
58 
59  private:
60  friend class Source;
61  const ALuint& GetBuffer() const;
62  ALuint& GetBuffer();
63 
64  ALuint m_buffer;
65  size_t m_bufferSize;
66  };
67  }
68 }
Definition: ht_audiobuffer.h:27
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_audiobuffer.h:23
Definition: ht_audiosource.h:27