00001
00010 #ifndef SOUNDIMPNETWORK_H
00011 #define SOUNDIMPNETWORK_H
00012
00013 #include "SoundMgr.H"
00014
00015 namespace IS3D {
00016
00017 typedef ReferenceCountedPointer<class SoundImpNetwork> SoundImpNetworkRef;
00018 class SoundImpNetwork : public SoundImplementation
00019 {
00020 public:
00021
00022 enum SoundServerNetMessageType {
00023 SMSG_SetListenerLoc = 1001,
00024 SMSG_SetListenerVel = 1002,
00025 SMSG_SetListenerGain = 1003,
00026 SMSG_Load = 1004,
00027 SMSG_Play = 1005,
00028 SMSG_Stop = 1006,
00029 SMSG_DeleteSound = 1007,
00030 SMSG_SetParam = 1008
00031 };
00032
00033 SoundImpNetwork(const std::string &host, int port);
00034 virtual ~SoundImpNetwork();
00035
00036 void setListenerLoc(const CoordinateFrame &m);
00037 void setListenerVel(const Vector3 &v);
00038 void setListenerGain(const float g);
00039
00040 void load(const std::string &filename);
00041 void play(const std::string &filename);
00042 void stop(const std::string &filename);
00043 void deleteSound(const std::string &filename);
00044 void setParam(const std::string &filename, const SOUNDPARAM param,
00045 const float value);
00046
00047 protected:
00048
00049 NetworkDevice *_networkDevice;
00050 LightweightConduitRef _conduit;
00051 NetAddress _address;
00052 };
00053
00054
00055
00056
00057 class SoundServerNetMessagePlay
00058 {
00059 public:
00060 SoundServerNetMessagePlay() {}
00061
00062 SoundServerNetMessagePlay(const std::string filename) {
00063 _filename = filename;
00064 }
00065
00066 virtual ~SoundServerNetMessagePlay() {}
00067
00068 uint32 type() const { return SoundImpNetwork::SMSG_Play; }
00069
00070 void serialize(BinaryOutput &b) const {
00071 b.writeInt32(_filename.size());
00072 b.writeString(_filename);
00073 }
00074
00075 void deserialize(BinaryInput &b) {
00076 int size = b.readInt32();
00077 _filename = b.readString(size+1);
00078 }
00079
00080 std::string getFilename() { return _filename; }
00081
00082 private:
00083 std::string _filename;
00084 };
00085
00086
00087
00088 }
00089
00090 #endif
00091