HatchitAudio
ht_audiosource.h
1 
15 #pragma once
16 
17 #include <ht_platform.h> //HT_API
18 #include <AL/al.h>
19 #include <AL/alc.h>
20 #include <ht_audiobuffer.h> //BufferHandle
21 #include <array> //std::array
22 
23 namespace Hatchit
24 {
25  namespace Audio
26  {
27  class HT_API Source
28  {
29  public:
30 
31  enum class State : ALint
32  {
33  Initial = AL_INITIAL,
34  Playing = AL_PLAYING,
35  Paused = AL_PAUSED,
36  Stopped = AL_STOPPED,
37  Error = AL_INVALID_OPERATION
38  };
39 
40  Source();
41  Source(const Source& source);
42  Source(Source&& source);
43  virtual ~Source();
44 
45  Source& operator=(Source&& source);
46  Source& operator=(const Source& source);
47 
48  bool Initialize();
49  void DeInitialize();
50 
51  bool Play();
52  bool Pause();
53  bool Stop();
54  bool Rewind();
55 
56  bool QueueBuffer(const Buffer& b);
57  bool UnqueueBuffer(Buffer& b);
58 
59  //Getters
60  void GetPosition(std::array<ALfloat, 3>& outValueArray) const;
61  void GetPosition(ALfloat* outValueArray) const;
62  void GetDirection(std::array<ALfloat, 3>& outValueArray) const;
63  void GetDirection(ALfloat* outValueArray) const;
64 
65  ALfloat GetPitch() const;
66  ALfloat GetGain() const;
67  bool GetLooping() const;
68 
69  State GetState() const;
70  int GetNumBuffersQueued() const;
71  int GetNumBuffersProcessed() const;
72 
73  bool SetPosition(const std::array<ALfloat, 3>& values);
74  bool SetPosition(const ALfloat* values);
75  bool SetPosition(ALfloat x, ALfloat y, ALfloat z);
76  bool SetDirection(const std::array<ALfloat, 3>& values);
77  bool SetDirection(const ALfloat* values);
78  bool SetDirection(ALfloat x, ALfloat y, ALfloat z);
79 
80  bool SetPitch(ALfloat newPitch);
81  bool SetGain(ALfloat newGain);
82  bool SetLooping(bool newVal);
83 
84  private:
85  bool CopyInfo(const Source& source);
86  ALuint m_source;
87  };
88  }
89 }
Definition: ht_audiobuffer.h:27
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_audiobuffer.h:23
Definition: ht_audiosource.h:27