Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_AUDIO_SOUND_OPENAL_H__
00009 #define __SP_AUDIO_SOUND_OPENAL_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_OPENAL
00015
00016
00017 #include "SoundSystem/spSound.hpp"
00018 #include "SoundSystem/OpenAL/spOpenALSourceObject.hpp"
00019
00020 #include <AL/al.h>
00021 #include <AL/alc.h>
00022
00023
00024 namespace sp
00025 {
00026 namespace audio
00027 {
00028
00029
00030 class ALBufferObject;
00031
00032 class OpenALSound : public Sound
00033 {
00034
00035 public:
00036
00037 OpenALSound();
00038 ~OpenALSound();
00039
00040
00041
00042 bool reload(const io::stringc &Filename, u8 BufferCount = DEF_SOUND_BUFFERCOUNT);
00043 void close();
00044
00045 void play();
00046 void pause(bool Paused = true);
00047 void stop();
00048
00049 void emit2D(f32 Volume = 1.0f, bool UseEffectSlot = true);
00050 void emit3D(const dim::vector3df &Point, f32 Volume = 1.0f, bool UseEffectSlot = true);
00051
00052 void setSeek(f32 Seek);
00053 f32 getSeek() const;
00054
00055 void setVolume(f32 Volume);
00056 void setSpeed(f32 Speed);
00057 void setBalance(f32 Balance);
00058
00059 void setLoop(bool Enable);
00060
00061 bool playing() const;
00062 bool finish() const;
00063
00064 f32 getLength() const;
00065 bool valid() const;
00066
00067 void setPosition(const dim::vector3df &Position);
00068 void setVelocity(const dim::vector3df &Veclotiy);
00069
00070 void setVolumetric(bool isVolumetric);
00071 void setVolumetricRadius(f32 Radius);
00072
00073 private:
00074
00075
00076
00077 ALuint nextSourceBuffer();
00078
00079
00080
00081 inline ALuint getSourceID() const
00082 {
00083 return (*CurSourceObject_)->getID();
00084 }
00085
00086
00087
00088 ALBufferObject* BufferObject_;
00089
00090 std::vector<ALSourceObject*> SourceObjects_;
00091 std::vector<ALuint> SourceObjectIDs_;
00092
00093 std::vector<ALSourceObject*>::iterator CurSourceObject_;
00094
00095 };
00096
00097
00098 }
00099
00100 }
00101
00102
00103 #endif
00104
00105 #endif
00106
00107
00108
00109