CLAM::Fundamental Class Reference

Class Fundamental, used to manage the bins candidates to be fundamental frequencies, and their errors. More...

#include <Fundamental.hxx>

List of all members.

Public Member Functions

 Fundamental ()
 Fundamental (const Fundamental &prototype, const bool shareData=false, const bool deep=true)
 __COMMON_DYNAMIC_TYPE (Fundamental, 2)
 __COMMON_DYN_ATTRIBUTE (0, public, DataArray, CandidatesFreq) protected
 Array with the candidate frequencies.
bool LoadCandidatesFreq (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (1, public, DataArray, CandidatesErr) protected
 Array with the error of candidate frequencies.
bool LoadCandidatesErr (CLAM::Storage &s)
void SetnMaxCandidates (TSize nMaxCandidates)
TSize GetnMaxCandidates () const
void SetnCandidates (int size)
int GetnCandidates () const
TData GetFreq (TIndex pos=0) const
 Returns the Frequency of a given position in the candidate array.
TData GetErr (TIndex pos=0) const
 Returns the Error of a given position in the candidate array.
void SetFreq (TIndex pos, TData newFreq)
 Changes the frequency of a candidate at a given index.
void SetErr (TIndex pos, TData newErr)
 Changes the error of a candidate at a given index.
void AddElem (TData freq=0.f, TData err=0.f)
 Adds a candidate, in frequencies array and errors array.
void InsertElem (TIndex pos, TData freq=0.f, TData err=0.f)
 Adds a candidate, in frequencies array and errors array, and uses parameter pos to insert it in the arrays.
void DeleteElem (TIndex pos)
 Delete an element of both arrays (frequency and error) given its position.
void SortByFrequency ()
 Sort the arrays by frequency.
void SortByError ()
 Sort the arrays by estimated error.
void Init ()
 Initializes data.

Protected Member Functions

void DefaultInit ()
 The concrete dynamic type constructor calls DefaultInit().

Detailed Description

Class Fundamental, used to manage the bins candidates to be fundamental frequencies, and their errors.

There are getters and setters, but for efficiency work directly on the buffer.

See also:
Frame

Definition at line 44 of file Fundamental.hxx.


Constructor & Destructor Documentation

CLAM::Fundamental::Fundamental (  )  [inline]

Definition at line 47 of file Fundamental.hxx.

CLAM::Fundamental::Fundamental ( const Fundamental prototype,
const bool  shareData = false,
const bool  deep = true 
) [inline]

Definition at line 47 of file Fundamental.hxx.


Member Function Documentation

CLAM::Fundamental::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
CandidatesErr   
) [inline]

Array with the error of candidate frequencies.

Definition at line 51 of file Fundamental.hxx.

CLAM::Fundamental::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
CandidatesFreq   
) [inline]

Array with the candidate frequencies.

Definition at line 49 of file Fundamental.hxx.

CLAM::Fundamental::__COMMON_DYNAMIC_TYPE ( Fundamental  ,
 
)
void CLAM::Fundamental::AddElem ( TData  freq = 0.f,
TData  err = 0.f 
)

Adds a candidate, in frequencies array and errors array.

Parameters:
freq The frequency value of new candidate, 0 by default
err The estimated error of new candidate, 0 by default

Definition at line 90 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT.

Referenced by CLAM::FundFreqDetect::Do(), and CLAM::SegmentSMSHarmonizer::SegmentSMSHarmonizer().

void CLAM::Fundamental::DefaultInit ( void   )  [protected]

The concrete dynamic type constructor calls DefaultInit().

This allows user to initialize his/her object. But we define DefaultInit() here because we don't want to force writting one DefaultInit() function for each concrete dynamic type. If a dynamic type concrete class defines some (not-default) constructors, this should also call the DefaultInit().

See also:
CopyInit()

Reimplemented from CLAM::DynamicType.

Definition at line 39 of file Fundamental.cxx.

References SetnCandidates(), SetnMaxCandidates(), and CLAM::DynamicType::UpdateData().

void CLAM::Fundamental::DeleteElem ( TIndex  pos  ) 

Delete an element of both arrays (frequency and error) given its position.

Parameters:
Position that we wanto to eliminate

Definition at line 111 of file Fundamental.cxx.

References CLAM_ASSERT, CLAM_DEBUG_ASSERT, and GetnCandidates().

TData CLAM::Fundamental::GetErr ( TIndex  pos = 0  )  const

Returns the Error of a given position in the candidate array.

Parameters:
pos Position we want to get frequency, 0 by default
Returns:
The error estimated in this position

Definition at line 66 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT.

TData CLAM::Fundamental::GetFreq ( TIndex  pos = 0  )  const

Returns the Frequency of a given position in the candidate array.

Parameters:
pos Position we want to get frequency, 0 by default
Returns:
The frequency in the position indicated

Definition at line 52 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT.

Referenced by CLAM::SMSPitchShift::Do(), and CLAM::FundFreqDetect::Do().

int CLAM::Fundamental::GetnCandidates (  )  const [inline]
TSize CLAM::Fundamental::GetnMaxCandidates (  )  const [inline]

Definition at line 66 of file Fundamental.hxx.

Referenced by CLAM::FundFreqDetect::Do(), and InsertElem().

void CLAM::Fundamental::Init (  )  [inline]

Initializes data.

Definition at line 159 of file Fundamental.hxx.

References SetnCandidates().

Referenced by CLAM::FundFreqDetect::Do().

void CLAM::Fundamental::InsertElem ( TIndex  pos,
TData  freq = 0.f,
TData  err = 0.f 
)

Adds a candidate, in frequencies array and errors array, and uses parameter pos to insert it in the arrays.

Parameters:
pos Position where we want to insert the new element
freq The frequency value of new candidate, 0 by default
err The estimated error of new candidate, 0 by default

Definition at line 101 of file Fundamental.cxx.

References CLAM_ASSERT, CLAM_DEBUG_ASSERT, GetnCandidates(), and GetnMaxCandidates().

bool CLAM::Fundamental::LoadCandidatesErr ( CLAM::Storage s  )  [inline]

Definition at line 51 of file Fundamental.hxx.

bool CLAM::Fundamental::LoadCandidatesFreq ( CLAM::Storage s  )  [inline]

Definition at line 49 of file Fundamental.hxx.

void CLAM::Fundamental::SetErr ( TIndex  pos,
TData  newErr 
)

Changes the error of a candidate at a given index.

Parameters:
pos Position to change the error
newFreq New value of this position

Definition at line 81 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT, and GetnCandidates().

void CLAM::Fundamental::SetFreq ( TIndex  pos,
TData  newFreq 
)

Changes the frequency of a candidate at a given index.

Parameters:
pos Position to change the frequency
newFreq New value of this position

Definition at line 73 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT, and GetnCandidates().

Referenced by CLAM::SMSPitchShift::Do().

void CLAM::Fundamental::SetnCandidates ( int  size  )  [inline]

Definition at line 77 of file Fundamental.hxx.

Referenced by DefaultInit(), CLAM::FundFreqDetect::Do(), and Init().

void CLAM::Fundamental::SetnMaxCandidates ( TSize  nMaxCandidates  )  [inline]

Definition at line 57 of file Fundamental.hxx.

Referenced by DefaultInit(), and CLAM::FundFreqDetect::Do().

void CLAM::Fundamental::SortByError (  ) 

Sort the arrays by estimated error.

Todo:
It uses a bubble sort, not so efficient

Definition at line 138 of file Fundamental.cxx.

References GetnCandidates().

Referenced by CLAM::FundFreqDetect::Do().

void CLAM::Fundamental::SortByFrequency (  ) 

Sort the arrays by frequency.

Todo:
It uses a bubble sort, not so efficient

Definition at line 121 of file Fundamental.cxx.

References GetnCandidates().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3