Unified · Split
| @@ -114,10 +114,10 @@ static void feedbackleveler_init(tFeedbackLeveler* const fb, float targetLeve · 113 unmodified lines | ||
| 114 | 114 | { |
| 115 | 115 | _tFeedbackLeveler* p = *fb; |
| 116 | 116 | |
| 117 | − p->curr=0.0f; | |
| 118 | − p->targetLevel=targetLevel; | |
| 119 | − p->mode=mode; | |
| 120 | − p->strength=strength; | |
| 117 | + p->curr = 0.0f; | |
| 118 | + p->targetLevel = targetLevel; | |
| 119 | + p->mode = mode; | |
| 120 | + p->strength = strength; | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | void tFeedbackLeveler_init(tFeedbackLeveler* const fb, float targetLevel, float factor, float strength, int mode) |
| @@ -139,7 +139,7 @@ void tFeedbackLeveler_initToPool (tFeedbackLeveler* const fb, float targe · 15 unmodified lines | ||
| 139 | 139 | _tMempool* m = *mp; |
| 140 | 140 | _tFeedbackLeveler* p = *fb = (_tFeedbackLeveler*) mpool_alloc(sizeof(_tFeedbackLeveler), &m->pool); |
| 141 | 141 | feedbackleveler_init(fb, targetLevel, factor, strength, mode); |
| 142 | − tPowerFollower_init(&p->pwrFlw,factor); | |
| 142 | + tPowerFollower_initToPool(&p->pwrFlw, factor, mp); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | void tFeedbackLeveler_freeFromPool (tFeedbackLeveler* const fb, tMempool* const mp) |
| @@ -1273,7 +1273,6 @@ void tAutotune_free(tAutotune* const rt) · 1272 unmodified lines | ||
| 1273 | 1273 | tPitchShift_free(&r->ps[i]); |
| 1274 | 1274 | leaf_free(r->outBuffers[i]); |
| 1275 | 1275 | } |
| 1276 | − tPeriodDetection_free(&r->pd); | |
| 1277 | 1276 | leaf_free(r->tickOutput); |
| 1278 | 1277 | leaf_free(r->freq); |
| 1279 | 1278 | leaf_free(r->ps); |
| @@ -603,12 +603,12 @@ static void expsmooth_init(tExpSmooth* const expsmooth, float val, float fact · 602 unmodified lines | ||
| 603 | 603 | { // factor is usually a value between 0 and 0.1. Lower value is slower. 0.01 for example gives you a smoothing time of about 10ms |
| 604 | 604 | _tExpSmooth* smooth = *expsmooth; |
| 605 | 605 | |
| 606 | − smooth->curr=val; | |
| 607 | − smooth->dest=val; | |
| 608 | − if (factor<0) factor=0; | |
| 609 | − if (factor>1) factor=1; | |
| 610 | − smooth->factor=factor; | |
| 611 | − smooth->oneminusfactor=1.0f-factor; | |
| 606 | + smooth->curr = val; | |
| 607 | + smooth->dest = val; | |
| 608 | + if (factor < 0) factor = 0; | |
| 609 | + if (factor > 1) factor = 1; | |
| 610 | + smooth->factor = factor; | |
| 611 | + smooth->oneminusfactor = 1.0f - factor; | |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | void tExpSmooth_init(tExpSmooth* const expsmooth, float val, float factor) |
| @@ -301,17 +301,17 @@ static void poly_init(tPoly* const polyh, int maxNumVoices) · 300 unmodified lines | ||
| 301 | 301 | void tPoly_init(tPoly* const polyh, int maxNumVoices) |
| 302 | 302 | { |
| 303 | 303 | _tPoly* poly = *polyh = (_tPoly*) leaf_alloc(sizeof(_tPoly)); |
| 304 | + | |
| 305 | + poly->ramps = (tRamp*) leaf_alloc(sizeof(tRamp) * maxNumVoices); | |
| 306 | + poly->rampVals = (float*) leaf_alloc(sizeof(float) * maxNumVoices); | |
| 307 | + poly->firstReceived = (oBool*) leaf_alloc(sizeof(oBool) * maxNumVoices); | |
| 308 | + poly->voices = (int**) leaf_alloc(sizeof(int*) * maxNumVoices); | |
| 304 | 309 | for (int i = 0; i < maxNumVoices; ++i) |
| 305 | 310 | { |
| 306 | 311 | poly->voices[i] = (int*) leaf_alloc(sizeof(int) * 2); |
| 307 | 312 | } |
| 308 | 313 | poly_init(polyh, maxNumVoices); |
| 309 | 314 | |
| 310 | − poly->ramps = (tRamp*) leaf_alloc(sizeof(tRamp) * poly->maxNumVoices); | |
| 311 | − poly->rampVals = (float*) leaf_alloc(sizeof(float) * poly->maxNumVoices); | |
| 312 | − poly->firstReceived = (oBool*) leaf_alloc(sizeof(oBool) * poly->maxNumVoices); | |
| 313 | − poly->voices = (int**) leaf_alloc(sizeof(int*) * poly->maxNumVoices); | |
| 314 | − | |
| 315 | 315 | for (int i = 0; i < poly->maxNumVoices; ++i) |
| 316 | 316 | { |
| 317 | 317 | tRamp_init(&poly->ramps[i], poly->glideTime, 1); |
| @@ -346,17 +346,17 @@ void tPoly_initToPool (tPoly* const polyh, int maxNumVoices, tMemp · 28 unmodified lines | ||
| 346 | 346 | { |
| 347 | 347 | _tMempool* m = *mp; |
| 348 | 348 | _tPoly* poly = *polyh = (_tPoly*) mpool_alloc(sizeof(_tPoly), &m->pool); |
| 349 | + | |
| 350 | + poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * maxNumVoices, &m->pool); | |
| 351 | + poly->rampVals = (float*) mpool_alloc(sizeof(float) * maxNumVoices, &m->pool); | |
| 352 | + poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * maxNumVoices, &m->pool); | |
| 353 | + poly->voices = (int**) mpool_alloc(sizeof(int*) * maxNumVoices, &m->pool); | |
| 349 | 354 | for (int i = 0; i < maxNumVoices; ++i) |
| 350 | 355 | { |
| 351 | 356 | poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, &m->pool); |
| 352 | 357 | } |
| 353 | 358 | poly_init(polyh, maxNumVoices); |
| 354 | 359 | |
| 355 | − poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, &m->pool); | |
| 356 | − poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, &m->pool); | |
| 357 | − poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * poly->maxNumVoices, &m->pool); | |
| 358 | − poly->voices = (int**) mpool_alloc(sizeof(int*) * poly->maxNumVoices, &m->pool); | |
| 359 | − | |
| 360 | 360 | for (int i = 0; i < poly->maxNumVoices; ++i) |
| 361 | 361 | { |
| 362 | 362 | tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp); |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ tPluck ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ */ |
| 20 | 20 | static void pluck_init (tPluck* const pl, float lowestFrequency) |
| 21 | 21 | { |
| 22 | − _tPluck* p = *pl; | |
| 23 | − | |
| 24 | 22 | if ( lowestFrequency <= 0.0f ) lowestFrequency = 10.0f; |
| 25 | 23 | |
| 26 | 24 | tPluck_setFrequency(pl, 220.0f); |
| @@ -548,7 +546,7 @@ static void livingstring_init(tLivingString* const pl, float freq, float pick · 521 unmodified lines | ||
| 548 | 546 | { |
| 549 | 547 | _tLivingString* p = *pl; |
| 550 | 548 | |
| 551 | − p->curr=0.0f; | |
| 549 | + p->curr = 0.0f; | |
| 552 | 550 | p->freq = freq; |
| 553 | 551 | p->prepIndex = prepIndex; |
| 554 | 552 | p->dampFreq = dampFreq; |
| @@ -658,8 +656,8 @@ void tLivingString_freeFromPool (tLivingString* const pl, tMempool* const mp · 103 unmodified lines | ||
| 658 | 656 | void tLivingString_setFreq(tLivingString* const pl, float freq) |
| 659 | 657 | { // NOTE: It is faster to set wavelength in samples directly |
| 660 | 658 | _tLivingString* p = *pl; |
| 661 | − if (freq<20) freq=20; | |
| 662 | − else if (freq>10000) freq=10000; | |
| 659 | + if (freq < 20) freq = 20; | |
| 660 | + else if (freq > 10000) freq = 10000; | |
| 663 | 661 | p->waveLengthInSamples = leaf.sampleRate/freq; |
| 664 | 662 | tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples); |
| 665 | 663 | } |
| @@ -667,8 +665,8 @@ void tLivingString_setFreq(tLivingString* const pl, float freq) · 1 unmodified line | ||
| 667 | 665 | void tLivingString_setWaveLength(tLivingString* const pl, float waveLength) |
| 668 | 666 | { |
| 669 | 667 | _tLivingString* p = *pl; |
| 670 | − if (waveLength<4.8) waveLength=4.8; | |
| 671 | − else if (waveLength>2400) waveLength=2400; | |
| 668 | + if (waveLength < 4.8) waveLength = 4.8; | |
| 669 | + else if (waveLength > 2400) waveLength = 2400; | |
| 672 | 670 | p->waveLengthInSamples = waveLength; |
| 673 | 671 | tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples); |
| 674 | 672 | } |
| @@ -787,7 +785,7 @@ static void reedtable_init (tReedTable* const pm, float offset, float sl · 112 unmodified lines | ||
| 787 | 785 | |
| 788 | 786 | void tReedTable_init (tReedTable* const pm, float offset, float slope) |
| 789 | 787 | { |
| 790 | − _tReedTable* p = *pm = (_tReedTable*) leaf_alloc(sizeof(_tReedTable)); | |
| 788 | + *pm = (_tReedTable*) leaf_alloc(sizeof(_tReedTable)); | |
| 791 | 789 | reedtable_init(pm, offset, slope); |
| 792 | 790 | } |
| 793 | 791 | |
| @@ -800,7 +798,7 @@ void tReedTable_free (tReedTable* const pm) · 6 unmodified lines | ||
| 800 | 798 | void tReedTable_initToPool (tReedTable* const pm, float offset, float slope, tMempool* const mp) |
| 801 | 799 | { |
| 802 | 800 | _tMempool* m = *mp; |
| 803 | − _tReedTable* p = *pm = (_tReedTable*) mpool_alloc(sizeof(_tReedTable), &m->pool); | |
| 801 | + *pm = (_tReedTable*) mpool_alloc(sizeof(_tReedTable), &m->pool); | |
| 804 | 802 | reedtable_init(pm, offset, slope); |
| 805 | 803 | } |
| 806 | 804 | |