Class Fundamental, used to manage the bins candidates to be fundamental frequencies, and their errors. More...
#include <Fundamental.hxx>
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(). |
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.
Definition at line 44 of file Fundamental.hxx.
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.
CLAM::Fundamental::__COMMON_DYN_ATTRIBUTE | ( | 1 | , | |
public | , | |||
DataArray | , | |||
CandidatesErr | ||||
) | [inline] |
Array with the error of candidate frequencies.
Definition at line 51 of file Fundamental.hxx.
CLAM::Fundamental::__COMMON_DYN_ATTRIBUTE | ( | 0 | , | |
public | , | |||
DataArray | , | |||
CandidatesFreq | ||||
) | [inline] |
Array with the candidate frequencies.
Definition at line 49 of file Fundamental.hxx.
CLAM::Fundamental::__COMMON_DYNAMIC_TYPE | ( | Fundamental | , | |
2 | ||||
) |
Adds a candidate, in frequencies array and errors array.
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().
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.
Position | that we wanto to eliminate |
Definition at line 111 of file Fundamental.cxx.
References CLAM_ASSERT, CLAM_DEBUG_ASSERT, and GetnCandidates().
Returns the Error of a given position in the candidate array.
pos | Position we want to get frequency, 0 by default |
Definition at line 66 of file Fundamental.cxx.
References CLAM_DEBUG_ASSERT.
Returns the Frequency of a given position in the candidate array.
pos | Position we want to get frequency, 0 by default |
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] |
Definition at line 86 of file Fundamental.hxx.
Referenced by DeleteElem(), CLAM::SMSPitchShift::Do(), CLAM::FundFreqDetect::Do(), InsertElem(), SetErr(), SetFreq(), SortByError(), and SortByFrequency().
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().
Adds a candidate, in frequencies array and errors array, and uses parameter pos to insert it in the arrays.
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.
Changes the error of a candidate at a given index.
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().
Changes the frequency of a candidate at a given index.
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.
Definition at line 138 of file Fundamental.cxx.
References GetnCandidates().
Referenced by CLAM::FundFreqDetect::Do().
void CLAM::Fundamental::SortByFrequency | ( | ) |
Sort the arrays by frequency.
Definition at line 121 of file Fundamental.cxx.
References GetnCandidates().