FrameAdder.cxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #include "Complex.hxx"
00023 #include "SpecTypeFlags.hxx"
00024 #include "FrameAdder.hxx"
00025 #include "BPF.hxx"
00026 #include "Point.hxx"
00027 
00028 namespace CLAM {
00029 
00030         FrameAdder::FrameAdder()
00031                 : mIn1("Input 1",this),
00032                   mIn2("Input 2",this),
00033                   mOut("Output",this)
00034         {
00035                 AttachChildren();
00036                 Configure(FrameAdderConfig());
00037         }
00038 
00039         FrameAdder::FrameAdder(const FrameAdderConfig &c)
00040                 : mIn1("Input 1",this),
00041                   mIn2("Input 2",this),
00042                   mOut("Output",this)
00043         {
00044                 AttachChildren();
00045                 Configure(c);
00046         }
00047 
00048 
00049         bool FrameAdder::ConcreteConfigure(const ProcessingConfig&c)
00050         {
00051                 CopyAsConcreteConfig(mConfig, c);
00052 
00053                 return true;
00054         }
00055 
00056         void FrameAdder::AttachChildren()
00057         {
00058                 mPO_SpectrumAdder.SetParent(this);
00059                 mPO_PeaksAdder.SetParent(this);
00060         }
00061 
00062 
00063         // Unsupervised Do() function.
00064         bool FrameAdder::Do(const Frame& in1, const Frame& in2, Frame& out)
00065         {
00066                 CLAM_DEBUG_ASSERT(IsRunning(),
00067                         "FrameAdder::Do(): Not in execution mode");
00068 
00072                 if(out.GetFundamental().GetnCandidates()==0)
00073                         out.GetFundamental().AddElem(0,0);
00074                 else
00075                         out.GetFundamental().SetFreq(0,0);
00076                 out.GetFundamental().SetnCandidates(1);
00077 
00079                 //SpectralPeakArrayAdder cannot process inplace, by making this temporal
00080                 //copy we allow FrameAdder to process inplace
00081                 SpectralPeakArray tmpPeakArray;
00082                 
00083                 mPO_PeaksAdder.Do(in1.GetSpectralPeakArray(),in2.GetSpectralPeakArray(),tmpPeakArray);
00084                 out.SetSpectralPeakArray(tmpPeakArray);
00086                 mPO_SpectrumAdder.Do(in1.GetResidualSpec(),in2.GetResidualSpec(),out.GetResidualSpec());
00087                 
00088                 return true;
00089         }
00090 
00091         bool FrameAdder::Do(void)
00092         {
00093                 CLAM_ASSERT(false,"FrameAdder::Do(): Not implemented");
00094 
00095                 return true;
00096         }
00097 
00098         
00099 
00100 
00101 
00102 }
00103 
Generated by  doxygen 1.6.3