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 00023 #ifndef _IFFT_base_ 00024 #define _IFFT_base_ 00025 00026 #include <typeinfo> // for bad_cast definition 00027 #include "Processing.hxx" 00028 #include "InPort.hxx" 00029 #include "AudioOutPort.hxx" 00030 #include "ProcessingData.hxx" 00031 #include "DataTypes.hxx" 00032 #include "Spectrum.hxx" 00033 00034 #include "IFFTConfig.hxx" 00035 00036 namespace CLAM { 00037 00038 class Audio; 00039 class Spectrum; 00040 00042 class IFFT_base: public Processing 00043 { 00044 protected: 00045 enum {CLAM_DEFAULT_IFFT_SIZE=1024}; 00046 00048 IFFTConfig mConfig; 00050 int mSize; 00051 00052 InPort<Spectrum> mInput; 00053 AudioOutPort mOutput; 00054 00055 // Control change callback function 00056 void ChangeSize(int n); 00057 int GetSize() {return mSize;} 00058 00059 virtual bool ConcreteConfigure(const ProcessingConfig&) = 0; 00060 00061 public: 00062 00063 IFFT_base(); 00064 00065 virtual ~IFFT_base(); 00066 00067 const char *GetClassName() const {return "IFFT";} 00068 00071 virtual const ProcessingConfig &GetConfig() const { return mConfig;} 00072 00075 virtual bool Do(void) = 0; 00076 00080 virtual bool Do(const Spectrum& in, Audio &out) const = 0; 00081 00082 // Input/Output configuration methods 00083 00085 virtual bool SetPrototypes(const Spectrum& in,const Audio &out) = 0; 00086 00088 virtual bool SetPrototypes() {return false;} 00089 00091 virtual bool UnsetPrototypes() {return false;} 00092 00093 // Enable/Disable methods. Maybe we should not be deriving 00094 // these ones in IFFT subclasses. (IFFT implementations will 00095 // probably be always memoryless. 00096 00097 virtual bool MayDisableExecution() const {return false;} 00098 00099 }; 00100 } 00101 00102 #endif // _IFFT_base_ 00103