History

tLivingString2 tweaks

spiricom committed 5 years ago

Commit b48e5eb1 parent debdbb42 files · +14 −12Browse files

Unified · Split

2 files
  1. leaf/Src/leaf-distortion.c +1 −1
  2. leaf/Src/leaf-physical.c +13 −11
leaf/Src/leaf-distortion.c+1−1
@@ -318,7 +318,7 @@ void tOversampler_setRatio (tOversampler* const osr, int ratio) · 317 unmodified lines
318318 else if (ratio == 2 || ratio == 4 || ratio == 8 ||
319319 ratio == 16 || ratio == 32 || ratio == 64)
320320 {
321− os->ratio = os->maxRatio;
321+ os->ratio = os->ratio;
322322 int idx = (int)(log2f(os->ratio))-1+os->offset;
323323 os->numTaps = __leaf_tablesize_firNumTaps[idx];
324324 os->phaseLength = os->numTaps / os->ratio;
leaf/Src/leaf-physical.c+13−11
@@ -682,7 +682,7 @@ void tLivingString2_initToPool (tLivingString2* const pl, float freq, floa · 681 unmodified lines
682682 LEAF* leaf = p->mempool->leaf;
683683
684684 p->curr=0.0f;
685− tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.01f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
685+ tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.1f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
686686 tLivingString2_setFreq(pl, freq);
687687 p->freq = freq;
688688 p->prepPos = prepPos;
@@ -691,7 +691,7 @@ void tLivingString2_initToPool (tLivingString2* const pl, float freq, floa · 2 unmodified lines
691691 tExpSmooth_initToPool(&p->puSmooth, pickupPos, 0.01f, mp); // smoother for pickup position
692692 tLivingString2_setPickPos(pl, pickPos);
693693 tLivingString2_setPrepPos(pl, prepPos);
694− p->prepIndex=prepIndex;
694+ p->prepIndex = prepIndex;
695695 p->pickupPos = pickupPos;
696696 tHermiteDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
697697 tHermiteDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
@@ -745,6 +745,7 @@ void tLivingString2_setFreq(tLivingString2* const pl, float freq) · 47 unmodified lines
745745 LEAF* leaf = p->mempool->leaf;
746746 if (freq<20.f) freq=20.f;
747747 else if (freq>10000.f) freq=10000.f;
748+ freq = freq*2;
748749 p->freq = freq;
749750 p->waveLengthInSamples = (leaf->sampleRate/freq) - 1;
750751 tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples);
@@ -754,6 +755,7 @@ void tLivingString2_setWaveLength(tLivingString2* const pl, float waveLength · 3 unmodified lines
754755 {
755756 _tLivingString2* p = *pl;
756757 LEAF* leaf = p->mempool->leaf;
758+ waveLength = waveLength * 0.5f;
757759 if (waveLength<4.8f) waveLength=4.8f;
758760 else if (waveLength>2400.f) waveLength=2400.f;
759761 p->waveLengthInSamples = waveLength - 1;
@@ -926,27 +928,27 @@ float tLivingString2_tick(tLivingString2* const pl, float input) · 166 unmodified lines
926928 tHermiteDelay_setDelay(&p->delUF, upLen);
927929 tHermiteDelay_setDelay(&p->delUB, upLen);
928930
929− /*
930− uint pickupPosInt;
931+
932+ uint32_t pickupPosInt;
931933 float pickupOut = 0.0f;
932− if (pickupPos < 0.9f)
934+ if (p->pickupPos < 0.98f)
933935 {
934− float fullPickupPos = (pickupPos*upLen);
935− pickupPosInt = (uint) fullPickupPos;
936+ float fullPickupPos = (p->pickupPos*upLen);
937+ pickupPosInt = (uint32_t) fullPickupPos;
936938 float pickupPosFloat = fullPickupPos - pickupPosInt;
937939 if (pickupPosInt == 0)
938940 {
939941 pickupPosInt = 1;
940942 }
941943 pickupOut = tHermiteDelay_tapOutInterpolated(&p->delUF, pickupPosInt, pickupPosFloat);
942− pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint) (upLen - pickupPosInt), pickupPosFloat);
944+ pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint32_t) (upLen - pickupPosInt), pickupPosFloat);
943945 p->curr = pickupOut;
944946 }
945947 else
946− */
947− //{
948+
949+ {
948950 p->curr = fromBridge;
949− //}
951+ }
950952
951953 //p->curr = fromBridge;
952954 //p->curr += fromNut;

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