Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

soundserver_c.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: soundserver_c.cpp,v 1.3 2004/03/22 11:18:03 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 }

Generated on Thu Apr 6 15:25:40 2006 for rcssserver3d by  doxygen 1.4.4