History

fix incorrect init ordering in livingstring

Matthew Wang committed 6 years ago

Commit 9cb36a11 parent e3276fe2 files · +7 −5Browse files

Unified · Split

2 files
  1. LEAF/Src/leaf-effects.c +2 −2
  2. LEAF/Src/leaf-physical.c +5 −3
LEAF/Src/leaf-effects.c+2−2
@@ -1268,12 +1268,12 @@ void tAutotune_init(tAutotune* const rt, int numVoices, int bufSize, int frameSi · 1267 unmodified lines
12681268 void tAutotune_free(tAutotune* const rt)
12691269 {
12701270 _tAutotune* r = *rt;
1271− tPeriodDetection_free(&r->pd);
12721271 for (int i = 0; i < r->numVoices; ++i)
12731272 {
12741273 tPitchShift_free(&r->ps[i]);
12751274 leaf_free(r->outBuffers[i]);
12761275 }
1276+ tPeriodDetection_free(&r->pd);
12771277 leaf_free(r->tickOutput);
12781278 leaf_free(r->freq);
12791279 leaf_free(r->ps);
@@ -1311,12 +1311,12 @@ void tAutotune_freeFromPool (tAutotune* const rt, tMempool* const mp) · 31 unmodified lines
13111311 {
13121312 _tMempool* m = *mp;
13131313 _tAutotune* r = *rt;
1314− tPeriodDetection_freeFromPool(&r->pd, mp);
13151314 for (int i = 0; i < r->numVoices; ++i)
13161315 {
13171316 tPitchShift_freeFromPool(&r->ps[i], mp);
13181317 mpool_free(r->outBuffers[i], &m->pool);
13191318 }
1319+ tPeriodDetection_freeFromPool(&r->pd, mp);
13201320 mpool_free(r->tickOutput, &m->pool);
13211321 mpool_free(r->freq, &m->pool);
13221322 mpool_free(r->ps, &m->pool);
LEAF/Src/leaf-physical.c+5−3
@@ -555,8 +555,6 @@ static void livingstring_init(tLivingString* const pl, float freq, float pick · 554 unmodified lines
555555 p->decay = decay;
556556 p->prepIndex = prepIndex;
557557 p->levMode = levMode;
558− tLivingString_setFreq(pl, freq);
559− tLivingString_setPickPos(pl, pickPos);
560558 }
561559
562560 void tLivingString_init(tLivingString* const pl, float freq, float pickPos, float prepIndex,
@@ -564,9 +562,11 @@ void tLivingString_init(tLivingString* const pl, float freq, float pickPos, f · 1 unmodified line
564562 float levStrength, int levMode)
565563 {
566564 _tLivingString* p = *pl = (_tLivingString*) leaf_alloc(sizeof(_tLivingString));
567−
565+
568566 tExpSmooth_init(&p->wlSmooth, leaf.sampleRate/freq, 0.01); // smoother for string wavelength (not freq, to avoid expensive divisions)
569567 tExpSmooth_init(&p->ppSmooth, pickPos, 0.01); // smoother for pick position
568+ tLivingString_setFreq(pl, freq);
569+ tLivingString_setPickPos(pl, pickPos);
570570 tLinearDelay_init(&p->delLF,p->waveLengthInSamples, 2400);
571571 tLinearDelay_init(&p->delUF,p->waveLengthInSamples, 2400);
572572 tLinearDelay_init(&p->delUB,p->waveLengthInSamples, 2400);
@@ -614,6 +614,8 @@ void tLivingString_initToPool (tLivingString* const pl, float freq, float · 41 unmodified lines
614614
615615 tExpSmooth_initToPool(&p->wlSmooth, leaf.sampleRate/freq, 0.01, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
616616 tExpSmooth_initToPool(&p->ppSmooth, pickPos, 0.01, mp); // smoother for pick position
617+ tLivingString_setFreq(pl, freq);
618+ tLivingString_setPickPos(pl, pickPos);
617619 tLinearDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
618620 tLinearDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
619621 tLinearDelay_initToPool(&p->delUB,p->waveLengthInSamples, 2400, mp);

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