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
1268void tAutotune_free(tAutotune* const rt)1268void tAutotune_free(tAutotune* const rt)
1269{1269{
1270 _tAutotune* r = *rt;1270 _tAutotune* r = *rt;
1271 tPeriodDetection_free(&r->pd);
1272 for (int i = 0; i < r->numVoices; ++i)1271 for (int i = 0; i < r->numVoices; ++i)
1273 {1272 {
1274 tPitchShift_free(&r->ps[i]);1273 tPitchShift_free(&r->ps[i]);
1275 leaf_free(r->outBuffers[i]);1274 leaf_free(r->outBuffers[i]);
1276 }1275 }
1276 tPeriodDetection_free(&r->pd);
1277 leaf_free(r->tickOutput);1277 leaf_free(r->tickOutput);
1278 leaf_free(r->freq);1278 leaf_free(r->freq);
1279 leaf_free(r->ps);1279 leaf_free(r->ps);
@@ -1311,12 +1311,12 @@ void tAutotune_freeFromPool (tAutotune* const rt, tMempool* const mp) · 31 unmodified lines
1311{1311{
1312 _tMempool* m = *mp;1312 _tMempool* m = *mp;
1313 _tAutotune* r = *rt;1313 _tAutotune* r = *rt;
1314 tPeriodDetection_freeFromPool(&r->pd, mp);
1315 for (int i = 0; i < r->numVoices; ++i)1314 for (int i = 0; i < r->numVoices; ++i)
1316 {1315 {
1317 tPitchShift_freeFromPool(&r->ps[i], mp);1316 tPitchShift_freeFromPool(&r->ps[i], mp);
1318 mpool_free(r->outBuffers[i], &m->pool);1317 mpool_free(r->outBuffers[i], &m->pool);
1319 }1318 }
1319 tPeriodDetection_freeFromPool(&r->pd, mp);
1320 mpool_free(r->tickOutput, &m->pool);1320 mpool_free(r->tickOutput, &m->pool);
1321 mpool_free(r->freq, &m->pool);1321 mpool_free(r->freq, &m->pool);
1322 mpool_free(r->ps, &m->pool);1322 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
555 p->decay = decay;555 p->decay = decay;
556 p->prepIndex = prepIndex;556 p->prepIndex = prepIndex;
557 p->levMode = levMode;557 p->levMode = levMode;
558 tLivingString_setFreq(pl, freq);
559 tLivingString_setPickPos(pl, pickPos);
560}558}
561 559
562void tLivingString_init(tLivingString* const pl, float freq, float pickPos, float prepIndex,560void 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
564 float levStrength, int levMode)562 float levStrength, int levMode)
565{563{
566 _tLivingString* p = *pl = (_tLivingString*) leaf_alloc(sizeof(_tLivingString));564 _tLivingString* p = *pl = (_tLivingString*) leaf_alloc(sizeof(_tLivingString));
567 565
568 tExpSmooth_init(&p->wlSmooth, leaf.sampleRate/freq, 0.01); // smoother for string wavelength (not freq, to avoid expensive divisions)566 tExpSmooth_init(&p->wlSmooth, leaf.sampleRate/freq, 0.01); // smoother for string wavelength (not freq, to avoid expensive divisions)
569 tExpSmooth_init(&p->ppSmooth, pickPos, 0.01); // smoother for pick position567 tExpSmooth_init(&p->ppSmooth, pickPos, 0.01); // smoother for pick position
568 tLivingString_setFreq(pl, freq);
569 tLivingString_setPickPos(pl, pickPos);
570 tLinearDelay_init(&p->delLF,p->waveLengthInSamples, 2400);570 tLinearDelay_init(&p->delLF,p->waveLengthInSamples, 2400);
571 tLinearDelay_init(&p->delUF,p->waveLengthInSamples, 2400);571 tLinearDelay_init(&p->delUF,p->waveLengthInSamples, 2400);
572 tLinearDelay_init(&p->delUB,p->waveLengthInSamples, 2400);572 tLinearDelay_init(&p->delUB,p->waveLengthInSamples, 2400);
@@ -614,6 +614,8 @@ void tLivingString_initToPool (tLivingString* const pl, float freq, float · 41 unmodified lines
614 614
615 tExpSmooth_initToPool(&p->wlSmooth, leaf.sampleRate/freq, 0.01, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)615 tExpSmooth_initToPool(&p->wlSmooth, leaf.sampleRate/freq, 0.01, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
616 tExpSmooth_initToPool(&p->ppSmooth, pickPos, 0.01, mp); // smoother for pick position616 tExpSmooth_initToPool(&p->ppSmooth, pickPos, 0.01, mp); // smoother for pick position
617 tLivingString_setFreq(pl, freq);
618 tLivingString_setPickPos(pl, pickPos);
617 tLinearDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);619 tLinearDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
618 tLinearDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);620 tLinearDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
619 tLinearDelay_initToPool(&p->delUB,p->waveLengthInSamples, 2400, mp);621 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