00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00027
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;
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