CLAM-Development  1.4.0
Frame.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-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 #include "Frame.hxx"
23 
24 namespace CLAM{
25 
26 
27 
29 //
30 // Frame
31 //
33 
35  {
36  AddCenterTime();
37  AddDuration();
38  UpdateData();
39  SetCenterTime(-1);
40  SetDuration(-1);
41  };
42 
43 
44 
45  //For Spectrum
47  {
48  return GetSpectrum().GetMag(freq);
49  }
51  {
52  return GetSpectrum().GetMag(pos);
53  }
55  {
56  return GetSpectrum().GetPhase(freq);
57  }
59  {
60  return GetSpectrum().GetPhase(pos);
61  }
62 
63  void Frame::SetMag(TData freq, TData newMag)
64  {
65  GetSpectrum().SetMag(freq,newMag);
66  }
67  void Frame::SetMag(TIndex pos, TData newMag)
68  {
69  GetSpectrum().SetMag(pos,newMag);
70  }
71  void Frame::SetPhase(TData freq, TData newPhase)
72  {
73  GetSpectrum().SetPhase(freq,newPhase);
74  }
75  void Frame::SetPhase(TIndex pos, TData newPhase)
76  {
77  GetSpectrum().SetPhase(pos,newPhase);
78  }
79 
80  //For Peak Array
82  {
83  return GetSpectralPeakArray().GetSpectralPeak(pos);
84  }
86  {
87  return GetSpectralPeakArray().GetThruIndexSpectralPeak(pos);
88  }
89  void Frame::SetSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,TIndex index)
90  {
91  GetSpectralPeakArray().SetSpectralPeak(pos,spectralPeak,index);
92  }
93  void Frame::InsertSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,
94  bool insertIndex,TIndex index)
95  {
96  GetSpectralPeakArray().InsertSpectralPeak(pos,spectralPeak,insertIndex,index);
97  }
98  void Frame::AddSpectralPeak(const SpectralPeak& spectralPeak,
99  bool addIndex,TIndex index)
100  {
101  GetSpectralPeakArray().AddSpectralPeak(spectralPeak,addIndex,index);
102  }
103  void Frame::DeleteSpectralPeak(TIndex pos,bool deleteIndex)
104  {
105  GetSpectralPeakArray().DeleteSpectralPeak(pos,deleteIndex);
106  }
107 
108  //For Residual
110  {
111  return GetResidualSpec().GetMag(freq);
112  }
114  {
115  return GetResidualSpec().GetMag(pos);
116  }
118  {
119  return GetResidualSpec().GetPhase(freq);
120  }
122  {
123  return GetResidualSpec().GetPhase(pos);
124  }
125 
126  void Frame::SetResMag(TData freq, TData newMag)
127  {
128  GetResidualSpec().SetMag(freq,newMag);
129  }
130  void Frame::SetResMag(TIndex pos, TData newMag)
131  {
132  GetResidualSpec().SetMag(pos,newMag);
133  }
134  void Frame::SetResPhase(TData freq, TData newPhase)
135  {
136  GetResidualSpec().SetPhase(freq,newPhase);
137  }
138  void Frame::SetResPhase(TIndex pos, TData newPhase)
139  {
140  GetResidualSpec().SetPhase(pos,newPhase);
141  }
142 
143  //For Fundamental
145  {
146  return GetFundamental().GetFreq(pos);
147  }
149  {
150  return GetFundamental().GetErr(pos);
151  }
152  void Frame::SetFundamentalFreq(TIndex pos,TData newFreq)const
153  {
154  GetFundamental().SetFreq(pos,newFreq);
155  }
156  void Frame::SetFundamentalErr(TIndex pos,TData newErr)const
157  {
158  GetFundamental().SetErr(pos,newErr);
159  }
160 
161  /*Comparison Operators*/
162  bool Frame::operator ==(const Frame& newFrame) const
163  {
164  return (newFrame.GetCenterTime()==GetCenterTime());
165  }
166  bool Frame::operator !=(const Frame& newFrame) const
167  {
168  return (newFrame.GetCenterTime()!=GetCenterTime());
169  }
170  bool Frame::operator <(const Frame& newFrame) const
171  {
172  return (newFrame.GetCenterTime()<GetCenterTime());
173  }
174  bool Frame::operator <=(const Frame& newFrame) const
175  {
176  return (newFrame.GetCenterTime()<=GetCenterTime());
177  }
178  bool Frame::operator >(const Frame& newFrame) const
179  {
180  return (newFrame.GetCenterTime()>GetCenterTime());
181  }
182  bool Frame::operator >=(const Frame& newFrame) const
183  {
184  return (newFrame.GetCenterTime()>=GetCenterTime());
185  }
186 
187 };
188