Go to the documentation of this file.00001
00002
00003 #ifndef _SOUND_H_
00004 #define _SOUND_H_
00005
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 #include <scene/Node.h>
00009 #include <resource/ResourceEventReceiver.h>
00010
00011 namespace core
00012 {
00013 class vector3d;
00014 }
00015
00016 namespace resource
00017 {
00018 struct ResourceEvent;
00019 }
00020
00021 namespace sound
00022 {
00023
00024 class SoundData;
00025 class SoundProperties;
00026
00030 class ENGINE_PUBLIC_EXPORT Sound: public scene::Node, public resource::ResourceEventReceiver
00031 {
00032 public:
00033
00034 Sound(SoundData* soundData);
00035 Sound(const std::string& name, SoundData* soundData);
00036
00037 virtual ~Sound();
00038
00040 void setSoundData(const std::string& filename);
00041 void setSoundData(SoundData* soundData);
00042
00043 SoundData* getSoundData() const;
00044
00046 virtual void play();
00047
00049 virtual void pause();
00050
00052 virtual void stop();
00053
00055 virtual bool isPlaying() const;
00056
00058 virtual bool isPaused() const;
00059
00061 virtual bool isStopped() const;
00062
00063 void setVelocity(f32 x, f32 y, f32 z);
00064 void setVelocity(const core::vector3d& vec);
00065 const core::vector3d& getVelocity() const;
00066
00067 const core::vector3d getDirection() const;
00068
00070 virtual void setPitch(f32 pitch);
00072 f32 getPitch() const;
00073
00075 virtual void setGain(f32 gain);
00077 f32 getGain() const;
00078
00082 void setDistanceValues(f32 minDistance, f32 maxDistance);
00084 virtual void setMinDistance(f32 minDistance);
00086 virtual void setMaxDistance(f32 maxDistance);
00087
00089 f32 getMinDistance() const;
00091 f32 getMaxDistance() const;
00092
00097 void setConeSettings(f32 innerConeAngle, f32 outerConeAngle, f32 outerConeGain);
00098
00100 virtual void setInnerConeAngle(f32 innerConeAngle);
00102 f32 getInnerConeAngle() const;
00103
00105 virtual void setOuterConeAngle(f32 outerConeAngle);
00107 f32 getOuterConeAngle() const;
00108
00110 virtual void setOuterConeGain(f32 outerConeGain);
00112 f32 getOuterConeGain() const;
00113
00115 virtual void setLoop(bool loop);
00117 bool isLooping() const;
00118
00119 void resourceLoaded(const resource::ResourceEvent& evt);
00120 void resourceUnloaded(const resource::ResourceEvent& evt);
00121
00122 protected:
00123
00124
00125 static u32 msNextGeneratedSoundIndex;
00126
00127 void initProperties();
00128
00129 SoundData* mSoundData;
00130
00131 core::vector3d mVelocity;
00132
00133 f32 mPitch;
00134 f32 mGain;
00135 f32 mMinDistance;
00136 f32 mMaxDistance;
00137 f32 mInnerConeAngle;
00138 f32 mOuterConeAngle;
00139 f32 mOuterConeGain;
00140
00141 bool mLoop;
00142 };
00143
00144 }
00145
00146 #endif