diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-18 09:21:20 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-18 09:21:20 +0000 |
commit | 4a2bad92171ff8a9a248599f47087cfe39e93653 (patch) | |
tree | b8a4fe7f616b3e4f707d89a35fff5e8b5fdcfcc8 /src/audio/buffers.h | |
parent | a185c11f2397c0296a4b62cc266b4fa00a63c1e2 (diff) |
OpenAL support
Diffstat (limited to 'src/audio/buffers.h')
-rw-r--r-- | src/audio/buffers.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/audio/buffers.h b/src/audio/buffers.h new file mode 100644 index 0000000..e61ba7b --- /dev/null +++ b/src/audio/buffers.h @@ -0,0 +1,47 @@ +/* + audio/buffers.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_AUDIO_BUFFERS_H__ +#define __INCLUDED_AUDIO_BUFFERS_H__ + +#include "AL/al.h" +#include "AL/alc.h" + +#include <string> +#include <map> + +namespace audio { + +const size_t MAXBUFFERS = 128; + +/// OpenAL buffers wrapper class + +class Buffers { +public: + static void init(); + static void shutdown(); + static void clear(); + + /// find previously loaded PCM data + static size_t find(std::string name); + + /// load audio data into a buffer ans return the buffer index + static size_t load(std::string name); + + /// bind a buffer to a source + static void bind(ALuint source, std::string name); + +private: + typedef std::map<std::string, size_t>::iterator iterator; + + static std::map<std::string, size_t> registry; + static size_t index; + static ALuint buffers[MAXBUFFERS]; +}; + +} + +#endif // __INCLUDED_AUDIO_BUFFERS_H__ |