SDIFFileReader.hxx

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 #ifndef _SDIFFileReader_
00023 #define _SDIFFileReader_
00024 
00025 #include "IndexArray.hxx"
00026 #include "Processing.hxx"
00027 #include "Err.hxx"
00028 #include "OutPort.hxx"
00029 #include "Filename.hxx"
00030 #include "OutPort.hxx"
00031 #include "SDIFInConfig.hxx"
00032 #include "SDIFFrame.hxx"
00033 #include "Fundamental.hxx"
00034 #include "SpectralPeakArray.hxx"
00035 #include "Spectrum.hxx"
00036 
00037 namespace SDIF { class File; } //forward declaration
00038 
00039 namespace CLAM
00040 {
00041 
00042 class SDIFFileReader
00043 {
00044 public:
00045 
00046         //TODO maybe a normal constructor?
00047         SDIFFileReader(const SDIFInConfig& c);
00048         SDIFFileReader();
00049 
00050         virtual ~SDIFFileReader();
00051 
00052         bool GetEnableResidual()        { return mConfig.GetEnableResidual(); }
00053         bool GetEnablePeakArray()       { return mConfig.GetEnablePeakArray(); }
00054         bool GetEnableFundFreq()        { return mConfig.GetEnableFundFreq(); }
00055 
00056         bool ReadFrame( CLAM::Fundamental& argFundamental,
00057                                         CLAM::SpectralPeakArray& argSpectralPeaks,
00058                                         CLAM::Spectrum& argResidual);
00059 
00060         bool ReadFrame( CLAM::Fundamental& argFundamental,
00061                                         CLAM::SpectralPeakArray& argSpectralPeaks,
00062                                         CLAM::Spectrum& argResidual,
00063                                         TTime& argFrameCenterTime);
00064 
00065         int GetReadPosition();
00066         void SetReadPosition(int readPosition);
00067 
00068         int GetSamplingRate();
00069 
00070         int GetFrameCenterTime();
00071 
00072         const ProcessingConfig &GetConfig() const;
00073 
00074         bool Configure(const SDIFInConfig& c);
00075 
00076         SDIF::File* mpFile;
00077 
00078 private:
00079         bool OpenFile();
00080 
00081         void CopyFramesDataObjects(     SDIF::Frame& tmpSDIFFrame,
00082                                                                 CLAM::Fundamental& argFundamental,
00083                                                                 CLAM::SpectralPeakArray& argSpectralPeaks,
00084                                                                 CLAM::Spectrum& argResidual);
00085 
00086         SDIFInConfig mConfig;
00087 
00088 // member variables
00089         TTime mLastCenterTime;
00090         int mSamplingRate;
00091         IndexArray mPrevIndexArray;
00092         bool isFileOpen;
00093 };
00094 
00095 
00096 };//CLAM
00097 #endif
00098 
Generated by  doxygen 1.6.3