26 lines
480 B
C++
26 lines
480 B
C++
#ifndef _H_SOUNDMANAGER_H
|
|
#define _H_SOUNDMANAGER_H
|
|
|
|
#include <AL/al.h>
|
|
#include <array>
|
|
#include <glm/glm.hpp>
|
|
|
|
class SoundManager
|
|
{
|
|
public:
|
|
SoundManager();
|
|
void playSound(ALuint buffer, int priority=10, const glm::vec3& pos = glm::vec3(0));
|
|
void pollSources();
|
|
~SoundManager();
|
|
private:
|
|
struct AudioSource {
|
|
ALuint source;
|
|
ALuint buffer;
|
|
bool inUse;
|
|
int priority;
|
|
};
|
|
std::array<AudioSource, 10> sources;
|
|
std::size_t lastUsed = 0;
|
|
};
|
|
|
|
#endif // _H_SOUNDMANAGER_H
|