Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef __SP_AUDIO_OPENAL_BUFFER_H__
00009 #define __SP_AUDIO_OPENAL_BUFFER_H__
00010 
00011 
00012 #include "Base/spStandard.hpp"
00013 
00014 #ifdef SP_COMPILE_WITH_OPENAL
00015 
00016 
00017 #include "FileFormats/Sound/spSoundLoader.hpp"
00018 
00019 #include <AL/al.h>
00020 #include <AL/alc.h>
00021 
00022 
00023 namespace sp
00024 {
00025 namespace audio
00026 {
00027 
00028 
00030 class ALBufferObject
00031 {
00032     
00033     public:
00034         
00035         ALBufferObject();
00036         ~ALBufferObject();
00037         
00038         
00039         
00040         bool updateBuffer(
00041             const io::stringc &Filename, ALenum Format, const void* Buffer, ALsizei Size, ALsizei Frequency
00042         );
00043         
00045         void grab();
00047         bool drop();
00048         
00049         
00050         
00052         inline ALuint getID() const
00053         {
00054             return ALBuffer_;
00055         }
00056         
00058         inline SWaveFormatFlags getFormatFlags() const
00059         {
00060             return FormatFlags_;
00061         }
00062         inline io::stringc getFilename() const
00063         {
00064             return Filename_;
00065         }
00066         
00067     private:
00068         
00069         
00070         
00071         ALuint ALBuffer_;               
00072         
00073         u32 BufferSize_;
00074         SWaveFormatFlags FormatFlags_;
00075         
00076         u32 ReferenceCounter_;          
00077         io::stringc Filename_;          
00078         
00079 };
00080 
00081 
00082 } 
00083 
00084 } 
00085 
00086 
00087 #endif
00088 
00089 #endif
00090 
00091 
00092 
00093