SDIFInStreaming.cxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 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 "SDIFInStreaming.hxx"
00023 #include "SpectrumConfig.hxx"
00024 #include "ErrOpenFile.hxx"
00025 #include "Frame.hxx"
00026 #include "Segment.hxx"
00027 #include "SpectralPeakArray.hxx"
00028 #include "Fundamental.hxx"
00029 #include "SDIFFile.hxx"
00030 #include "SDIFFrame.hxx"
00031 #include "SDIFMatrix.hxx"
00032 #include "ProcessingFactory.hxx"
00033 
00034 namespace CLAM
00035 {
00036 
00037 namespace Hidden
00038 {
00039         static const char * metadata[] = {
00040                 "key", "SDIFInStreaming",
00041         //      "category", "SDIF I/O",
00042         //      "description", "SDIFInStreaming",
00043                 0
00044         };
00045         static FactoryRegistrator<ProcessingFactory, SDIFInStreaming> reg = metadata;
00046 }
00047 
00048 SDIFInStreaming::SDIFInStreaming():
00049         mFundamentalOutput("Fundamental",this),
00050         mResidualSpectrumOutput("Residual Spectrum",this),
00051         mSpectralPeakArrayOutput("Sinusoidal Peaks",this),
00052         mSDIFReader(SDIFInConfig())
00053 {
00054         Configure(SDIFInConfig());
00055 }
00056 
00057 SDIFInStreaming::SDIFInStreaming(const SDIFInConfig& c):
00058         mFundamentalOutput("Fundamental",this),
00059         mResidualSpectrumOutput("Residual Spectrum",this),
00060         mSpectralPeakArrayOutput("Sinusoidal Peaks",this),
00061         mSDIFReader(c)
00062 {
00063         Configure(c);
00064 }
00065 
00066 SDIFInStreaming::~SDIFInStreaming()
00067 {
00068 }
00069 
00070 bool SDIFInStreaming::ConcreteConfigure(const ProcessingConfig& c)
00071 {
00072         CopyAsConcreteConfig(mConfig, c);
00073 
00074         mSDIFReader.Configure(mConfig);
00075 
00076         return true;
00077 }
00078 
00079 const ProcessingConfig& SDIFInStreaming::GetConfig() const
00080 {
00081         return mConfig;
00082 }
00083 
00084 bool SDIFInStreaming::Do(void)
00085 {
00086         bool result = mSDIFReader.ReadFrame(    mFundamentalOutput.GetData(),
00087                                                                                         mSpectralPeakArrayOutput.GetData(),
00088                                                                                         mResidualSpectrumOutput.GetData() );
00089 
00090         mFundamentalOutput.Produce();
00091         mResidualSpectrumOutput.Produce();
00092         mSpectralPeakArrayOutput.Produce();
00093 
00094         return result;
00095 }
00096 
00097 } // namespace CLAM
00098 
Generated by  doxygen 1.6.3