CLAM-Development
1.1
|
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 _SegmentatorConfig_ 00023 #define _SegmentatorConfig_ 00024 00025 #include "SearchArray.hxx" 00026 #include "ProcessingConfig.hxx" 00027 #include <iosfwd> 00028 00029 namespace CLAM { 00030 00031 typedef struct //may need further additions 00032 { 00033 TIndex id; 00034 TData threshold; 00035 TData percentil; 00036 TData nPreviousFrames; 00037 } TDescriptorsParams; 00038 00039 inline bool operator<(const TDescriptorsParams& param1,const TDescriptorsParams& param2) 00040 { 00041 if (param1.id<param2.id) return true; 00042 else return false; 00043 } 00044 00045 inline bool operator>=(const TDescriptorsParams& param1,const TDescriptorsParams& param2) 00046 { 00047 if (param1.id>=param2.id) return true; 00048 else return false; 00049 } 00050 00051 inline bool operator==(const TDescriptorsParams& param1,const TDescriptorsParams& param2) 00052 { 00053 if (param1.id==param2.id) return true; 00054 else return false; 00055 } 00056 00057 inline bool operator==(const TDescriptorsParams& param1,TIndex id) 00058 { 00059 if (param1.id==id) return true; 00060 else return false; 00061 } 00062 00063 std::ostream& operator << (std::ostream& myStream, const TDescriptorsParams& a); 00064 00065 std::istream& operator >> (std::istream& myStream, const TDescriptorsParams& a); 00066 00070 class SegmentatorConfig : public ProcessingConfig 00071 { 00072 friend class Segmentator; 00073 public: 00074 DYNAMIC_TYPE_USING_INTERFACE(SegmentatorConfig,2,ProcessingConfig); 00075 DYN_ATTRIBUTE (0, public, int, MinSegmentLength); 00076 DYN_ATTRIBUTE (1, public, Array<TDescriptorsParams>, DescriptorsParams); 00077 protected: 00078 void DefaultInit(); 00079 /*Public Interface*/ 00080 public: 00081 void AddDescParams(const TDescriptorsParams& descParams); 00082 bool FindDescParams(TDescriptorsParams& descParams); 00083 void ClearDescParams(); 00084 00085 void SetDescriptorsSearch (const SearchArray<TDescriptorsParams> & frame) { 00086 mDescriptorsSearch=frame; 00087 } 00088 const SearchArray<TDescriptorsParams> & GetDescriptorsSearch () const { 00089 return mDescriptorsSearch; 00090 } 00091 SearchArray<TDescriptorsParams> & GetDescriptorsSearch () { 00092 return mDescriptorsSearch; 00093 } 00094 ~SegmentatorConfig(){}; 00095 private: 00096 SearchArray<TDescriptorsParams> mDescriptorsSearch; 00097 }; 00098 00099 } // namespace CLAM 00100 00101 #endif 00102