10 #define STREAM_BUFFER_COUNT 4 11 #define STREAM_BUFFER_SIZE 65536 52 inline std::uint32_t
getBPS()
const {
return m_BitsPerSecond; }
57 inline bool isLooping() { alGetSourcei(m_Source, AL_LOOPING, &m_SourceState);
return m_SourceState == 1; }
59 inline bool isPaused() { getSourceState();
return m_SourceState == AL_PAUSED; }
61 inline bool isPlaying() { getSourceState();
return m_SourceState == AL_PLAYING; }
63 inline bool isStopped() { getSourceState();
return m_SourceState == AL_STOPPED; }
68 inline ALuint
getBuffer()
const {
return m_BufferID; }
70 inline ALuint
getSource()
const {
return m_Source; }
72 static ALboolean s_g_bEAX;
73 static ALCdevice* s_Device;
74 static ALCcontext* s_Context;
76 std::string m_FilePath;
80 std::uint32_t m_AudioFormat;
81 std::uint32_t m_SampleRate;
82 std::uint32_t m_BitsPerSecond;
92 inline void getSourceState() { alGetSourcei(m_Source, AL_SOURCE_STATE, &m_SourceState); }
95 void enableStreamingMode();
bool isPlaying()
Tells whether the audio clip is playing or not.
Definition: audioclip.h:61
ALuint getBuffer() const
Gets the Buffer of the audio clip data.
Definition: audioclip.h:68
void Pause()
Pause a Source.
Definition: audioclip.cpp:70
void PlayOnce()
Play the Source Once in any loop.
Definition: audioclip.cpp:51
~AudioClip()
Definition: audioclip.cpp:16
Class responsible for managing audio clips.
Definition: audioclip.h:15
void PlayOnceOnly()
Play the Source only Once in any loop.
Definition: audioclip.cpp:57
std::uint32_t getAudioFormat() const
Gets the audio format of the audio clip.
Definition: audioclip.h:48
bool isLooping()
Tells whether the audio clip is in looping state or not.
Definition: audioclip.h:57
ALuint getSource() const
Gets the Source ID of the audio source that plays the clip.
Definition: audioclip.h:70
void Loop()
Play the Source in Looping mode in any loop.
Definition: audioclip.cpp:63
std::uint32_t getClipSizeinKB() const
Gets the the clip size in Kb.
Definition: audioclip.h:54
bool isStopped()
Tells whether the audio clip is stopped or not.
Definition: audioclip.h:63
Definition: audioclip.cpp:3
std::uint32_t getSampleRate() const
Gets the sample rate of the audio clip.
Definition: audioclip.h:50
A class to load WAVE (.wav) audio files.
Definition: wavloader.h:12
AudioClip(const std::string &filePath)
Creates a audio clip to play in your application.
Definition: audioclip.cpp:9
bool isPaused()
Tells whether the audio clip is paused or not.
Definition: audioclip.h:59
void Play()
Play, Replay, or Resume a Source.
Definition: audioclip.cpp:26
int gain
Sets the gain of the audio source.
Definition: audioclip.h:19
void Replay()
Rewind a Source (set playback position to beginning)
Definition: audioclip.cpp:46
void Stop()
Stop a Source.
Definition: audioclip.cpp:41
int pitch
Sets the pitch of the audio source.
Definition: audioclip.h:21
std::uint32_t getBPS() const
Gets the bits per second of the audio clip.
Definition: audioclip.h:52
bool didPlayonce() const
Tells whether if the audio clip did play at least once.
Definition: audioclip.h:65