History

readd period detection alpha and tolerance

Matthew Wang committed 6 years ago

Commit 249e21c1 parent 63e93a54 files · +33 −0Browse files

Unified · Split

4 files
  1. LEAF/Inc/leaf-analysis.h +6 −0
  2. LEAF/Inc/leaf-effects.h +2 −0
  3. LEAF/Src/leaf-analysis.c +13 −0
  4. LEAF/Src/leaf-effects.c +12 −0
LEAF/Inc/leaf-analysis.h+6−0
@@ -239,6 +239,10 @@ extern "C" { · 238 unmodified lines
239 239
240 float fidelityThreshold;240 float fidelityThreshold;
241 241
242 float history;
243 float alpha;
244 float tolerance;
245
242 } _tPeriodDetection;246 } _tPeriodDetection;
243 247
244 typedef _tPeriodDetection* tPeriodDetection;248 typedef _tPeriodDetection* tPeriodDetection;
@@ -253,6 +257,8 @@ extern "C" { · 8 unmodified lines
253 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);257 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);
254 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);258 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);
255 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);259 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);
260 void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);
261 void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);
256 262
257 //==============================================================================263 //==============================================================================
258 264
LEAF/Inc/leaf-effects.h+2−0
@@ -298,6 +298,8 @@ extern "C" { · 297 unmodified lines
298 void tAutotune_setHopSize (tAutotune* const, int hs);298 void tAutotune_setHopSize (tAutotune* const, int hs);
299 void tAutotune_setWindowSize (tAutotune* const, int ws);299 void tAutotune_setWindowSize (tAutotune* const, int ws);
300 void tAutotune_setFidelityThreshold (tAutotune* const, float threshold);300 void tAutotune_setFidelityThreshold (tAutotune* const, float threshold);
301 void tAutotune_setAlpha (tAutotune* const, float alpha);
302 void tAutotune_setTolerance (tAutotune* const, float tolerance);
301 float tAutotune_getInputPeriod (tAutotune* const);303 float tAutotune_getInputPeriod (tAutotune* const);
302 float tAutotune_getInputFreq (tAutotune* const);304 float tAutotune_getInputFreq (tAutotune* const);
303 305
LEAF/Src/leaf-analysis.c+13−0
@@ -944,3 +944,16 @@ void tPeriodDetection_setFidelityThreshold(tPeriodDetection* pd, float threshold · 943 unmodified lines
944 _tPeriodDetection* p = *pd;944 _tPeriodDetection* p = *pd;
945 p->fidelityThreshold = threshold;945 p->fidelityThreshold = threshold;
946}946}
947
948void tPeriodDetection_setAlpha (tPeriodDetection* pd, float alpha)
949{
950 _tPeriodDetection* p = *pd;
951 p->alpha = LEAF_clip(0.0f, alpha, 1.0f);
952}
953
954void tPeriodDetection_setTolerance (tPeriodDetection* pd, float tolerance)
955{
956 _tPeriodDetection* p = *pd;
957 if (tolerance < 0.0f) p->tolerance = 0.0f;
958 else p->tolerance = tolerance;
959}
LEAF/Src/leaf-effects.c+12−0
@@ -1545,6 +1545,18 @@ void tAutotune_setFidelityThreshold(tAutotune* const rt, float threshold) · 1544 unmodified lines
1545 tPeriodDetection_setFidelityThreshold(&r->pd, threshold);1545 tPeriodDetection_setFidelityThreshold(&r->pd, threshold);
1546}1546}
1547 1547
1548void tAutotune_setAlpha (tAutotune* rt, float alpha)
1549{
1550 _tAutotune* r = *rt;
1551 tPeriodDetection_setAlpha(&r->pd, alpha);
1552}
1553
1554void tAutotune_setTolerance (tAutotune* rt, float tolerance)
1555{
1556 _tAutotune* r = *rt;
1557 tPeriodDetection_setTolerance(&r->pd, tolerance);
1558}
1559
1548float tAutotune_getInputPeriod(tAutotune* const rt)1560float tAutotune_getInputPeriod(tAutotune* const rt)
1549{1561{
1550 _tAutotune* r = *rt;1562 _tAutotune* r = *rt;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t