Frame.cxx

Go to the documentation of this file.
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 #include "Frame.hxx"
00023 
00024 namespace CLAM{
00025 
00026 
00027 
00029 //
00030 // Frame
00031 //
00033 
00034         void Frame::DefaultInit()
00035         {
00036                 AddCenterTime();
00037                 AddDuration();
00038                 UpdateData();
00039                 SetCenterTime(-1);
00040                 SetDuration(-1);
00041         };
00042         
00043 
00044 
00045         //For Spectrum
00046         TData Frame::GetMag(TData freq) const
00047         {
00048                 return GetSpectrum().GetMag(freq);
00049         }
00050         TData Frame::GetMag(TIndex pos) const 
00051         {
00052                 return GetSpectrum().GetMag(pos);
00053         }
00054         TData Frame::GetPhase(TData freq) const 
00055         {
00056                 return GetSpectrum().GetPhase(freq);
00057         }
00058         TData Frame::GetPhase(TIndex pos) const 
00059         {
00060                 return GetSpectrum().GetPhase(pos);
00061         }
00062 
00063         void Frame::SetMag(TData freq, TData newMag)
00064         {
00065                 GetSpectrum().SetMag(freq,newMag);
00066         }
00067         void Frame::SetMag(TIndex pos, TData newMag)
00068         {
00069                 GetSpectrum().SetMag(pos,newMag);
00070         }
00071         void Frame::SetPhase(TData freq, TData newPhase)
00072         {
00073                 GetSpectrum().SetPhase(freq,newPhase);
00074         }
00075         void Frame::SetPhase(TIndex pos, TData newPhase)
00076         {
00077                 GetSpectrum().SetPhase(pos,newPhase);
00078         }
00079 
00080         //For Peak Array
00081         SpectralPeak Frame::GetSpectralPeak(TIndex pos) const
00082         {
00083                 return GetSpectralPeakArray().GetSpectralPeak(pos);
00084         }
00085         SpectralPeak Frame::GetThruIndexSpectralPeak(TIndex pos) const 
00086         {
00087                 return GetSpectralPeakArray().GetThruIndexSpectralPeak(pos);
00088         }
00089         void Frame::SetSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,TIndex index)
00090         {
00091                 GetSpectralPeakArray().SetSpectralPeak(pos,spectralPeak,index);
00092         }
00093         void Frame::InsertSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,
00094                 bool insertIndex,TIndex index)
00095         {
00096                 GetSpectralPeakArray().InsertSpectralPeak(pos,spectralPeak,insertIndex,index);
00097         }
00098         void Frame::AddSpectralPeak(const SpectralPeak& spectralPeak,
00099                 bool addIndex,TIndex index)
00100         {
00101                 GetSpectralPeakArray().AddSpectralPeak(spectralPeak,addIndex,index);
00102         }
00103         void Frame::DeleteSpectralPeak(TIndex pos,bool deleteIndex)
00104         {
00105                 GetSpectralPeakArray().DeleteSpectralPeak(pos,deleteIndex);
00106         }
00107 
00108         //For Residual
00109         TData Frame::GetResMag(TData freq) const
00110         {
00111                 return GetResidualSpec().GetMag(freq);
00112         }
00113         TData Frame::GetResMag(TIndex pos) const 
00114         {
00115                 return GetResidualSpec().GetMag(pos);
00116         }
00117         TData Frame::GetResPhase(TData freq) const 
00118         {
00119                 return GetResidualSpec().GetPhase(freq);
00120         }
00121         TData Frame::GetResPhase(TIndex pos) const 
00122         {
00123                 return GetResidualSpec().GetPhase(pos);
00124         }
00125 
00126         void Frame::SetResMag(TData freq, TData newMag)
00127         {
00128                 GetResidualSpec().SetMag(freq,newMag);
00129         }
00130         void Frame::SetResMag(TIndex pos, TData newMag)
00131         {
00132                 GetResidualSpec().SetMag(pos,newMag);
00133         }
00134         void Frame::SetResPhase(TData freq, TData newPhase)
00135         {
00136                 GetResidualSpec().SetPhase(freq,newPhase);
00137         }
00138         void Frame::SetResPhase(TIndex pos, TData newPhase)
00139         {
00140                 GetResidualSpec().SetPhase(pos,newPhase);
00141         }
00142 
00143         //For Fundamental
00144         TData Frame::GetFundamentalFreq(TIndex pos)const
00145         {
00146                 return GetFundamental().GetFreq(pos);
00147         }
00148         TData Frame::GetFundamentalErr(TIndex pos)
00149         {
00150                 return GetFundamental().GetErr(pos);
00151         }
00152         void Frame::SetFundamentalFreq(TIndex pos,TData newFreq)const
00153         {
00154                 GetFundamental().SetFreq(pos,newFreq);
00155         }
00156         void Frame::SetFundamentalErr(TIndex pos,TData newErr)const
00157         {
00158                 GetFundamental().SetErr(pos,newErr);
00159         }
00160 
00161         /*Comparison Operators*/
00162         bool Frame::operator ==(const Frame& newFrame) const 
00163         {
00164                 return (newFrame.GetCenterTime()==GetCenterTime());
00165         }
00166         bool Frame::operator !=(const Frame& newFrame) const 
00167         {
00168                 return (newFrame.GetCenterTime()!=GetCenterTime());
00169         }
00170         bool Frame::operator <(const Frame& newFrame) const 
00171         {
00172                 return (newFrame.GetCenterTime()<GetCenterTime());
00173         }
00174         bool Frame::operator <=(const Frame& newFrame) const 
00175         {
00176                 return (newFrame.GetCenterTime()<=GetCenterTime());
00177         }
00178         bool Frame::operator >(const Frame& newFrame) const 
00179         {
00180                 return (newFrame.GetCenterTime()>GetCenterTime());
00181         }
00182         bool Frame::operator >=(const Frame& newFrame) const 
00183         {
00184                 return (newFrame.GetCenterTime()>=GetCenterTime());
00185         }
00186 
00187 };
00188 
Generated by  doxygen 1.6.3