Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_AUDIO_SOUND_H__
00009 #define __SP_AUDIO_SOUND_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spDimensionVector3D.hpp"
00014 #include "Base/spInputOutputString.hpp"
00015
00016
00017 namespace sp
00018 {
00019 namespace audio
00020 {
00021
00022
00023
00024
00025
00026
00027 static const s32 DEF_SOUND_BUFFERCOUNT = 1;
00028
00029
00035 class SP_EXPORT Sound
00036 {
00037
00038 public:
00039
00040 virtual ~Sound();
00041
00042
00043
00044 virtual bool reload(const io::stringc &Filename, u8 BufferCount = DEF_SOUND_BUFFERCOUNT) = 0;
00045 virtual void close() = 0;
00046
00048 virtual void play();
00049
00051 virtual void pause(bool Paused = true);
00052
00054 virtual void stop();
00055
00057 virtual void emit2D(f32 Volume = 1.0f, bool UseEffectSlot = true);
00059 virtual void emit3D(const dim::vector3df &Point, f32 Volume = 1.0f, bool UseEffectSlot = true);
00060
00065 virtual void setSeek(f32 Seek);
00066 virtual f32 getSeek() const;
00067
00073 virtual void setVolume(f32 Volume);
00074
00080 virtual void setSpeed(f32 Speed);
00081
00088 virtual void setBalance(f32 Balance);
00089
00091 virtual void setLoop(bool Enable);
00092
00094 virtual f32 getLength() const = 0;
00095
00097 virtual bool valid() const = 0;
00098
00100 virtual void setPosition(const dim::vector3df &Position);
00102 virtual void setVelocity(const dim::vector3df &Veclotiy);
00103
00104 virtual void setVolumetric(bool isVolumetric);
00105 virtual void setVolumetricRadius(f32 Radius);
00106
00108 virtual bool playing() const;
00110 virtual bool finish() const;
00111
00118 virtual bool saveRecord(const io::stringc &Filename);
00119
00121 virtual void beginRecording();
00122
00124 virtual void endRecording();
00125
00126
00127
00129 inline u8 getBufferCount() const
00130 {
00131 return BufferCount_;
00132 }
00134 inline io::stringc getFilename() const
00135 {
00136 return Filename_;
00137 }
00138
00143 inline bool paused() const
00144 {
00145 return isPaused_;
00146 }
00148 inline bool recording() const
00149 {
00150 return isRecording_;
00151 }
00152
00154 inline bool getLoop() const
00155 {
00156 return isLoop_;
00157 }
00158
00160 inline bool getVolumetric() const
00161 {
00162 return isVolumetric_;
00163 }
00165 inline f32 getVolumetricRadius() const
00166 {
00167 return Radius_;
00168 }
00169
00171 inline dim::vector3df getPosition() const
00172 {
00173 return Position_;
00174 }
00176 inline dim::vector3df getVeclotiy() const
00177 {
00178 return Veclotiy_;
00179 }
00180
00182 inline f32 getSpeed() const
00183 {
00184 return Speed_;
00185 }
00187 inline f32 getVolume() const
00188 {
00189 return Volume_;
00190 }
00195 inline f32 getBalance() const
00196 {
00197 return Balance_;
00198 }
00199
00200 protected:
00201
00202 friend class SoundDevice;
00203
00204 Sound();
00205
00206
00207
00208 bool checkFile(const io::stringc &Filename) const;
00209
00210
00211
00212 io::stringc Filename_;
00213 u8 BufferCount_;
00214
00215 f32 Radius_, Volume_, Balance_, Speed_, Seek_;
00216 bool isPaused_, isLoop_, isPlaying_, isVolumetric_, isRecording_;
00217
00218 dim::vector3df Position_, Veclotiy_;
00219 bool hasSeekChanged_;
00220
00221 };
00222
00223
00224 }
00225
00226 }
00227
00228
00229 #endif
00230
00231
00232
00233