00001
00002
00003 #ifndef SCOLAUDIO_H
00004 #define SCOLAUDIO_H
00005
00006 #include <string>
00007 #include "plugin.h"
00008 #include <set>
00009
00010 class SAudioSound;
00011
00012 class SAudioManager
00013 {
00014 private:
00015 SAudioManager();
00016 ~SAudioManager();
00017 protected:
00018 public:
00019
00020 private:
00021 cAudio::IAudioManager* manager;
00022 static SAudioManager* _singleton;
00023 std::set<SAudioSound*> validSounds;
00024 protected:
00025
00026 public:
00027 static SAudioManager* GetInstance();
00028 static void Kill();
00029
00030 cAudio::IAudioManager* GetManager();
00031 void SetListenerPosition(cAudio::cVector3 pos, cAudio::cVector3 dir);
00032 bool GetValidSound(SAudioSound* sound);
00033 void RemoveSound(SAudioSound* sound);
00034 SAudioSound* AddSound(std::string name, std::string path, bool stream);
00035 private:
00036 void AddValidSound(SAudioSound* sound);
00037 void RemoveValidSound(SAudioSound* sound);
00038 protected:
00039 };
00040
00041
00042 class SAudioSound : public cAudio::ISourceEventHandler
00043 {
00044 public:
00045 SAudioSound(std::string name, std::string path, bool stream);
00046 ~SAudioSound();
00047
00048 private:
00049 std::string mName;
00050 cAudio::IAudioSource* mSound;
00051
00052 public:
00053 bool IsValid();
00054 std::string GetName();
00055
00056 bool Play(bool loop);
00057 bool Play3d(float attenuation, bool loop);
00058 void Stop();
00059 void Pause();
00060 void SetVolume(float volume);
00061 float GetVolume();
00062 bool IsPlaying();
00063 float GetTime();
00064 float GetTotalTime();
00065 void SetPitch(float pitch);
00066 float GetPitch();
00067 void Seek(float pos, bool relative);
00068
00069
00070 void SetPositionAndDirection(cAudio::cVector3 pos, cAudio::cVector3 dir);
00071 cAudio::cVector3 GetPosition();
00072 cAudio::cVector3 GetDirection();
00073
00074 void SetCone(float inner, float outer, float outvol);
00075 float GetInnerCone();
00076 float GetOuterCone();
00077 float GetOuterConeVolume();
00078
00079 void SetRolloffFactor(float rolloff);
00080 float GetRolloffFactor();
00081
00082 virtual void onUpdate();
00083
00085 virtual void onRelease();
00086
00088 virtual void onPlay();
00089
00091 virtual void onStop();
00092
00094 virtual void onPause();
00095 };
00096
00097 #endif