Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/FlowCutSource.cpp
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2006 George Tzanetakis <gtzan@cs.uvic.ca>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 
00020 #include "FlowCutSource.h"
00021 
00022 using std::ostringstream;
00023 using namespace Marsyas;
00024 
00025 FlowCutSource::FlowCutSource(mrs_string name):MarSystem("FlowCutSource", name)
00026 {
00027 
00028   addControls();
00029 }
00030 
00031 FlowCutSource::FlowCutSource(const FlowCutSource& a) : MarSystem(a)
00032 {
00033 
00034 }
00035 
00036 FlowCutSource::~FlowCutSource()
00037 {
00038 }
00039 
00040 MarSystem*
00041 FlowCutSource::clone() const
00042 {
00043   return new FlowCutSource(*this);
00044 }
00045 
00046 void
00047 FlowCutSource::addControls()
00048 {
00049   //Add specific controls needed by this MarSystem.
00050   addctrl("mrs_natural/setSamples", 0);
00051   addctrl("mrs_natural/setObservations", 0);
00052   addctrl("mrs_real/setRate", 0.0);
00053   setctrlState("mrs_natural/setSamples", true);
00054   setctrlState("mrs_natural/setObservations", true);
00055   setctrlState("mrs_real/setRate", true);
00056 }
00057 
00058 void
00059 FlowCutSource::myUpdate(MarControlPtr sender)
00060 {
00061   MarSystem::myUpdate(sender);
00062 
00063   if(getctrl("mrs_natural/setSamples")->to<mrs_natural>())
00064     setctrl("mrs_natural/onSamples", getctrl("mrs_natural/setSamples")->to<mrs_natural>());
00065   if(getctrl("mrs_natural/setObservations")->to<mrs_natural>())
00066     setctrl("mrs_natural/onObservations", getctrl("mrs_natural/setObservations")->to<mrs_natural>());
00067   if(getctrl("mrs_real/setRate")->to<mrs_real>())
00068     setctrl("mrs_real/osrate", getctrl("mrs_real/setRate")->to<mrs_real>());
00069 }
00070 
00071 
00072 void
00073 FlowCutSource::myProcess(realvec& in, realvec& out)
00074 {
00075   mrs_natural o,t;
00076   (void) in;
00077   for (o=0; o < onObservations_; o++)
00078   {
00079     for (t = 0; t < onSamples_; t++)
00080     {
00081       out(o,t) =0;
00082     }
00083   }
00084 }
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092