CLAM-Development  1.1
Public Member Functions | Protected Member Functions
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

 DYNAMIC_TYPE_USING_INTERFACE (Fundamental, 2, ProcessingData)
 DYN_ATTRIBUTE (0, public, DataArray, CandidatesFreq)
 Array with the candidate frequencies.
 DYN_ATTRIBUTE (1, public, DataArray, CandidatesErr)
 Array with the error of candidate frequencies.
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.


Member Function Documentation

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

Adds a candidate, in frequencies array and errors array.

Parameters:
freqThe frequency value of new candidate, 0 by default
errThe 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(), CLAM::SMSPitchDiscretization::Do(), CLAM::SMSMorph::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().

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

Parameters:
Positionthat we wanto to eliminate

Definition at line 111 of file Fundamental.cxx.

References CLAM_ASSERT, CLAM_DEBUG_ASSERT, and GetnCandidates().

CLAM::Fundamental::DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
CandidatesFreq   
)

Array with the candidate frequencies.

CLAM::Fundamental::DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
CandidatesErr   
)

Array with the error of candidate frequencies.

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

Parameters:
posPosition 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.

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

Parameters:
posPosition 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::FundFreqDetect::Do(), CLAM::Fundamental2Control::Do(), CLAM::Fund2MIDI::Do(), CLAM::SMSPitchDiscretization::Do(), CLAM::SMSPitchShift::Do(), CLAM::SMSGenderChange::Do(), and CLAM::SMSMorph::Do().

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:
posPosition where we want to insert the new element
freqThe frequency value of new candidate, 0 by default
errThe 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().

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

Changes the error of a candidate at a given index.

Parameters:
posPosition to change the error
newFreqNew 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:
posPosition to change the frequency
newFreqNew value of this position

Definition at line 73 of file Fundamental.cxx.

References CLAM_DEBUG_ASSERT, and GetnCandidates().

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

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

Definition at line 77 of file Fundamental.hxx.

Referenced by DefaultInit(), CLAM::FundFreqDetect::Do(), CLAM::SMSMorph::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().

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().

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: