00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "soundserver.h"
00023 #include "soundeffect.h"
00024 #include "soundmodule.h"
00025 #include "soundstream.h"
00026
00027 using namespace boost;
00028 using namespace kerosin;
00029 using namespace zeitgeist;
00030 using namespace std;
00031
00032 FUNCTION(SoundServer,init)
00033 {
00034 string inSndSysName;
00035
00036 return(
00037 (in.GetSize() == 1) &&
00038 (in.GetValue(in.begin(), inSndSysName)) &&
00039 (obj->Init(inSndSysName))
00040 );
00041 }
00042
00043 FUNCTION(SoundServer,getCPU)
00044 {
00045 return obj->GetCPU();
00046 }
00047
00048 FUNCTION(SoundServer,playStream)
00049 {
00050 string inName;
00051
00052 if (
00053 (in.GetSize() != 1) ||
00054 (! in.GetValue(in.begin(), inName))
00055 )
00056 {
00057 return false;
00058 }
00059
00060 shared_ptr<SoundStream> stream = obj->LoadStream(inName);
00061
00062 if (stream.get() == 0)
00063 {
00064 return false;
00065 }
00066
00067 stream->Play();
00068 return true;
00069 }
00070
00071 FUNCTION(SoundServer,playModule)
00072 {
00073 string inName;
00074
00075 if (
00076 (in.GetSize() != 1) ||
00077 (! in.GetValue(in.begin(), inName))
00078 )
00079 {
00080 return false;
00081 }
00082
00083 shared_ptr<SoundModule> module = obj->LoadModule(inName);
00084
00085 if (module.get() == 0)
00086 {
00087 return false;
00088 }
00089
00090 module->Play();
00091 return true;
00092 }
00093
00094 FUNCTION(SoundServer,playEffect)
00095 {
00096 string inName;
00097
00098 if (
00099 (in.GetSize() != 1) ||
00100 (! in.GetValue(in.begin(), inName))
00101 )
00102 {
00103 return false;
00104 }
00105
00106 shared_ptr<SoundEffect> effect = obj->LoadEffect(inName);
00107
00108 if (effect.get() == 0)
00109 {
00110 return false;
00111 }
00112
00113 effect->Play();
00114 return true;
00115 }
00116
00117 void CLASS(SoundServer)::DefineClass()
00118 {
00119 DEFINE_BASECLASS(zeitgeist/Leaf);
00120 DEFINE_FUNCTION(init);
00121 DEFINE_FUNCTION(getCPU);
00122 DEFINE_FUNCTION(playStream);
00123 DEFINE_FUNCTION(playModule);
00124 DEFINE_FUNCTION(playEffect);
00125 }