Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2005 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 "InvSpectrum.h" 00020 00021 using std::ostringstream; 00022 using namespace Marsyas; 00023 00024 InvSpectrum::InvSpectrum(mrs_string name):MarSystem("InvSpectrum",name) 00025 { 00026 //type_ = "InvSpectrum"; 00027 //name_ = name; 00028 } 00029 00030 InvSpectrum::~InvSpectrum() 00031 { 00032 } 00033 00034 00035 MarSystem* 00036 InvSpectrum::clone() const 00037 { 00038 return new InvSpectrum(*this); 00039 } 00040 00041 00042 void 00043 InvSpectrum::myUpdate(MarControlPtr sender) 00044 { 00045 (void) sender; //suppress warning of unused parameter(s) 00046 setctrl("mrs_natural/onSamples", getctrl("mrs_natural/inObservations")); 00047 setctrl("mrs_natural/onObservations", getctrl("mrs_natural/inSamples")); 00048 setctrl("mrs_real/osrate", getctrl("mrs_real/israte")->to<mrs_real>() * getctrl("mrs_natural/inObservations")->to<mrs_natural>()); 00049 00050 tempVec_.create(getctrl("mrs_natural/onSamples")->to<mrs_natural>()); 00051 } 00052 00053 void 00054 InvSpectrum::myProcess(realvec& in, realvec& out) 00055 { 00056 mrs_natural o,t; 00057 00058 for(o=0 ; o<onObservations_; o++) 00059 { 00060 for (t=0; t < onSamples_; t++) 00061 tempVec_(t) = in(t,o); 00062 00063 mrs_real *tmp = tempVec_.getData(); 00064 myfft_.rfft(tmp, onSamples_/2, FFT_INVERSE); 00065 for (t=0; t < onSamples_; t++) 00066 out(o,t) = tempVec_(t); 00067 00068 } 00069 } 00070 00071 00072 00073 00074 00075 00076 00077 00078