Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/EnhADRessStereoSpectrum.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 #include "EnhADRessStereoSpectrum.h"
00020 #include "../common_source.h"
00021 
00022 using std::ostringstream;
00023 using namespace Marsyas;
00024 
00025 EnhADRessStereoSpectrum::EnhADRessStereoSpectrum(mrs_string name):MarSystem("EnhADRessStereoSpectrum", name)
00026 {
00027   addControls();
00028 }
00029 
00030 EnhADRessStereoSpectrum::EnhADRessStereoSpectrum(const EnhADRessStereoSpectrum& a) : MarSystem(a)
00031 {
00032 
00033 }
00034 
00035 EnhADRessStereoSpectrum::~EnhADRessStereoSpectrum()
00036 {
00037 }
00038 
00039 MarSystem*
00040 EnhADRessStereoSpectrum::clone() const
00041 {
00042   return new EnhADRessStereoSpectrum(*this);
00043 }
00044 
00045 void
00046 EnhADRessStereoSpectrum::addControls()
00047 {
00048 
00049 }
00050 
00051 void
00052 EnhADRessStereoSpectrum::myUpdate(MarControlPtr sender)
00053 {
00054   MRSDIAG("EnhADRessStereoSpectrum.cpp - EnhADRessStereoSpectrum:myUpdate");
00055   (void) sender;  //suppress warning of unused parameter(s)
00056 
00057   N2_ = ctrl_inObservations_->to<mrs_natural>()/3; //i.e. N/2+1
00058 
00059   ctrl_onSamples_->setValue(ctrl_inSamples_, NOUPDATE);
00060   ctrl_onObservations_->setValue(N2_, NOUPDATE);
00061   ctrl_osrate_->setValue(ctrl_israte_, NOUPDATE);
00062 
00063   ostringstream oss;
00064   for (mrs_natural n=0; n < N2_; n++)
00065     oss << "enhADRess_stereobin_" << n << ",";
00066   ctrl_onObsNames_->setValue(oss.str(), NOUPDATE);
00067 }
00068 
00069 void
00070 EnhADRessStereoSpectrum::myProcess(realvec& in, realvec& out)
00071 {
00072   mrs_natural o,t;
00073   for(t=0; t < inSamples_; ++t)
00074   {
00075     for(o=0; o<N2_; ++o)
00076     {
00077       out(o,t) = in(N2_*2+o,t);
00078     }
00079   }
00080   //MATLAB_PUT(out, "out2");
00081   //MATLAB_EVAL("figure(3);plot(out2)");
00082 }