00001
00011 #ifndef SOUNDMGR_H
00012 #define SOUNDMGR_H
00013
00014 #include "IS3DCommon.H"
00015
00016 namespace IS3D {
00017
00018
00019 enum SOUNDPARAM {
00020 SP_LOOP = 0,
00021 SP_PITCH = 1,
00022 SP_GAIN = 2,
00023 SP_POSX = 3,
00024 SP_POSY = 4,
00025 SP_POSZ = 5,
00026 SP_VELX = 6,
00027 SP_VELY = 7,
00028 SP_VELZ = 8,
00029
00030 SP_NUM_PARAMS = 9
00031 };
00032
00033 typedef ReferenceCountedPointer<class SoundImplementation> SoundImplementationRef;
00035 class SoundImplementation : public ReferenceCountedObject
00036 {
00037 public:
00038
00039 virtual void setListenerLoc(const CoordinateFrame &m) = 0;
00040 virtual void setListenerVel(const Vector3 &v) = 0;
00041 virtual void setListenerGain(const float g) = 0;
00042
00043
00044 virtual void load(const std::string &filename) = 0;
00045 virtual void play(const std::string &filename) = 0;
00046 virtual void stop(const std::string &filename) = 0;
00047 virtual void deleteSound(const std::string &filename) = 0;
00048 virtual void setParam(const std::string &filename, const SOUNDPARAM param,
00049 const float value) = 0;
00050 };
00051
00052
00053
00054
00055
00056 class SoundMgr
00057 {
00058 public:
00059
00060
00061
00062
00063
00064
00065 static void addImplementation(SoundImplementationRef simp);
00066
00067 static void setListenerLoc(const CoordinateFrame &m);
00068 static void setListenerVel(const Vector3 &v);
00069 static void setListenerGain(float g);
00070
00071
00072 static void load(const std::string &filename);
00073
00074 static void play(const std::string &filename);
00075
00076 static void stop(const std::string &filename);
00077
00078 static void deleteSound(const std::string &filename);
00079
00080
00081 static void setParam(const std::string &filename, const SOUNDPARAM param,
00082 const float value);
00083
00084 private:
00085
00086 static void warnNoImplementation(const std::string &attemptedAction);
00087
00088 static Array<SoundImplementationRef> _imp;
00089
00090 };
00091
00092 }
00093
00094 #endif