CLAM-Development
1.4.0
|
Class Fundamental, used to manage the bins candidates to be fundamental frequencies, and their errors. More...
#include <Fundamental.hxx>
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. | |
![]() | |
ProcessingData (const int n) | |
Constructor of an object that will contain the number of attributes passed by parameter. | |
ProcessingData (const ProcessingData &prototype, bool shareData=false, bool deep=true) | |
Copy constructor of a ProcessingData object. | |
virtual | ~ProcessingData () |
![]() | |
DynamicType (const int nAttr) | |
Constructs a DynamicType object that can hold. | |
DynamicType (const DynamicType &prototype, const bool shareData, const bool deepCopy) | |
Copy constructor of a dynamic Type. | |
DynamicType (const DynamicType &prototype) | |
virtual | ~DynamicType () |
virtual const char * | GetClassName () const =0 |
Return the class name. | |
void | CopyInit (const DynamicType &dt) |
This method allows custom code for the copy-constructor of a dynamic type, since the copy-constructor is macro expanded and can not be overwritted. | |
bool | UpdateData () |
Method used to resize the data space of the dynamic type, necessary when some AddXXX() / RemoveXXX() (where XXX is an attribute name) has been done. | |
unsigned | GetNDynamicAttributes () const |
const char * | GetDynamicAttributeName (unsigned i) |
virtual const std::type_info & | GetTypeId (unsigned i) const =0 |
bool | AttributeIsComponent (unsigned i) const |
bool | AttributeIsDynamictype (unsigned i) const |
bool | IsAttributeInstantiated (unsigned i) const |
const void * | GetAttributeAsVoidPtr (unsigned i) const |
const Component * | GetAttributeAsComponent (unsigned i) const |
Component * | GetAttributeAsComponent (unsigned i) |
void | FullfilsInvariant () const |
virtual Component * | DeepCopy () const |
void | Debug () const |
virtual void | StoreOn (CLAM::Storage &storage) const |
Stores component's subitems on the given Storage. | |
virtual void | LoadFrom (CLAM::Storage &storage) |
Loads component's subitems from the given Storage. | |
![]() | |
virtual | ~Component () |
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.
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(), CLAM::SMSPitchDiscretization::Do(), CLAM::SMSMorph::Do(), and CLAM::SegmentSMSHarmonizer::SegmentSMSHarmonizer().
|
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().
CLAM::Fundamental::DYN_ATTRIBUTE | ( | 0 | , |
public | , | ||
DataArray | , | ||
CandidatesFreq | |||
) |
Array with the candidate frequencies.
CLAM::Fundamental::DYN_ATTRIBUTE | ( | 1 | , |
public | , | ||
DataArray | , | ||
CandidatesErr | |||
) |
Array with the error of candidate frequencies.
CLAM::Fundamental::DYNAMIC_TYPE_USING_INTERFACE | ( | Fundamental | , |
2 | , | ||
ProcessingData | |||
) |
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::Fund2MIDI::Do(), CLAM::FundFreqDetect::Do(), CLAM::Fundamental2Control::Do(), CLAM::SMSPitchDiscretization::Do(), CLAM::SMSPitchShift::Do(), CLAM::SMSGenderChange::Do(), and CLAM::SMSMorph::Do().
|
inline |
Definition at line 86 of file Fundamental.hxx.
Referenced by DeleteElem(), CLAM::FundFreqDetect::Do(), CLAM::SMSPitchShift::Do(), CLAM::SMSMorph::Do(), InsertElem(), SetErr(), SetFreq(), SortByError(), and SortByFrequency().
|
inline |
Definition at line 66 of file Fundamental.hxx.
Referenced by CLAM::FundFreqDetect::Do(), and InsertElem().
|
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().
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(), and CLAM::SMSMorph::Do().
|
inline |
Definition at line 77 of file Fundamental.hxx.
Referenced by DefaultInit(), CLAM::FundFreqDetect::Do(), CLAM::SMSMorph::Do(), and Init().
|
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().