CLAM-Development  1.4.0
SDIFOut.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef _SDIFOut_
23 #define _SDIFOut_
24 
25 #include "IndexArray.hxx"
26 #include "Processing.hxx"
27 #include "Err.hxx"
28 #include "Segment.hxx"
29 #include "Filename.hxx"
30 #include "InPort.hxx"
31 #include "Fundamental.hxx"
32 #include "Spectrum.hxx"
33 #include "SpectralPeakArray.hxx"
34 
35 
36 namespace SDIF {class File;};//forward declaration
37 
38 namespace CLAM{
39 
41 {
42 public:
43 
45  DYN_ATTRIBUTE(0,public, TData, SpectralRange);
46  DYN_ATTRIBUTE(1,public, TIndex, MaxNumPeaks);
47  DYN_ATTRIBUTE(2,public, bool,EnableResidual);
48  DYN_ATTRIBUTE(3,public, bool,EnablePeakArray);
49  DYN_ATTRIBUTE(4,public, bool,EnableFundFreq);
50  DYN_ATTRIBUTE(5,public, Filename,FileName);
51  DYN_ATTRIBUTE(6,public, TData, SamplingRate);
52  DYN_ATTRIBUTE(7,public, TData, FrameSize);
53  DYN_ATTRIBUTE(8,public, TData, SpectrumSize);
54 
55  void DefaultInit();
56 };
57 
58 class SDIFOut: public Processing
59 {
60 public:
61 
62  SDIFOut(const SDIFOutConfig& c);
63  SDIFOut();
64 
65  virtual ~SDIFOut();
66  const char * GetClassName() const {return "SDIFOut";}
67 
68  bool GetEnableResidual() {return mConfig.GetEnableResidual();}
69  bool GetEnablePeakArray() {return mConfig.GetEnablePeakArray();}
70  bool GetEnableFundFreq() {return mConfig.GetEnableFundFreq();}
71 
72  bool Do(void);
73 
74  bool Do(const Frame& frame);
75 
76  const ProcessingConfig &GetConfig() const;
77 
79 
80 protected:
81 
82  bool ConcreteStart();
83 
84  bool ConcreteStop();
85 
89 
90 private:
91 
92  bool ConcreteConfigure(const ProcessingConfig& c);
93  void ConnectAndPublishPorts();
94 
95  SDIFOutConfig mConfig;
96 
97 // member variables
98  IndexArray mPrevIndexArray;
99  Frame singletonFrame;
100 
101 };
102 
103 
104 
105 };//CLAM
106 #endif
107