| @@ -1003,6 +1003,87 @@ float tLivingString2_tick(tLivingString2* const pl, float input) · 1002 unmodified lines |
| 1003 | 1003 | return p->curr; |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | +float tLivingString2_tickEfficient(tLivingString2* const pl, float input) |
| 1007 | +{ |
| 1008 | + _tLivingString2* p = *pl; |
| 1009 | + |
| 1010 | + input = input * 0.5f; // drop gain by half since we'll be equally adding it at half amplitude to forward and backward waveguides |
| 1011 | + // from prepPos upwards=forwards |
| 1012 | + //float pickupPos=tExpSmooth_tick(&p->puSmooth); |
| 1013 | + float wLen = p->wlSmooth->dest; |
| 1014 | + |
| 1015 | + float pickP = p->ppSmooth->dest; |
| 1016 | + |
| 1017 | + //need to determine which delay line to put it into (should be half amplitude into forward and backward lines for the correct portion of string) |
| 1018 | + float prepP = p->prpSmooth->dest; |
| 1019 | + float lowLen=p->prpSmooth->dest*p->wlSmooth->dest; |
| 1020 | + float upLen=(1.0f-p->prpSmooth->dest)*p->wlSmooth->dest; |
| 1021 | + uint32_t pickPInt; |
| 1022 | + if (pickP > prepP) |
| 1023 | + { |
| 1024 | + float fullPickPoint = ((pickP*wLen) - lowLen); |
| 1025 | + pickPInt = (uint32_t) fullPickPoint; // where does the input go? that's the pick point |
| 1026 | + |
| 1027 | + tHermiteDelay_addTo(&p->delUF, input, pickPInt); |
| 1028 | + tHermiteDelay_addTo(&p->delUB, input, (uint32_t) (upLen - pickPInt)); |
| 1029 | + } |
| 1030 | + else |
| 1031 | + { |
| 1032 | + float fullPickPoint = pickP * wLen; |
| 1033 | + pickPInt = (uint32_t) fullPickPoint; // where does the input go? that's the pick point |
| 1034 | + |
| 1035 | + tHermiteDelay_addTo(&p->delLF, input, pickPInt); |
| 1036 | + tHermiteDelay_addTo(&p->delLB, input, (uint32_t) (lowLen - pickPInt)); |
| 1037 | + } |
| 1038 | + float fromLF=tHermiteDelay_tickOut(&p->delLF); |
| 1039 | + float fromUF=tHermiteDelay_tickOut(&p->delUF); |
| 1040 | + float fromUB=tHermiteDelay_tickOut(&p->delUB); |
| 1041 | + float fromLB=tHermiteDelay_tickOut(&p->delLB); |
| 1042 | + // into upper half of string, from bridge, going backwards |
| 1043 | + //float fromBridge=-tFeedbackLeveler_tick(&p->fbLevU, (p->levMode==0?p->decay:1.0f)*tHighpass_tick(&p->DCblockerU, tTwoZero_tick(&p->bridgeFilter, fromUF))); |
| 1044 | + float fromBridge=-tFeedbackLeveler_tick(&p->fbLevU,tHighpass_tick(&p->DCblockerU, tTwoZero_tick(&p->bridgeFilter, fromUF))); |
| 1045 | + tHermiteDelay_tickIn(&p->delUB, fromBridge); |
| 1046 | + // into lower half of string, from prepPoint, going backwards |
| 1047 | + float fromLowerPrep=-tTwoZero_tick(&p->prepFilterL, fromLF); |
| 1048 | + float intoLower=(p->prepIndex*fromLowerPrep)+((1.0f - p->prepIndex)*fromUB); //used to add input here |
| 1049 | + tHermiteDelay_tickIn(&p->delLB, intoLower); |
| 1050 | + // into lower half of string, from nut |
| 1051 | + //float fromNut=-tFeedbackLeveler_tick(&p->fbLevL, (p->levMode==0?p->decay:1.0f)*tHighpass_tick(&p->DCblockerL, tTwoZero_tick(&p->nutFilter, fromLB))); |
| 1052 | + float fromNut=-tFeedbackLeveler_tick(&p->fbLevL,tHighpass_tick(&p->DCblockerL, tTwoZero_tick(&p->nutFilter, fromLB))); |
| 1053 | + tHermiteDelay_tickIn(&p->delLF, fromNut); |
| 1054 | + // into upper half of string, from prepPoint, going forwards/upwards |
| 1055 | + float fromUpperPrep=-tTwoZero_tick(&p->prepFilterU, fromUB); |
| 1056 | + float intoUpper=(p->prepIndex*fromUpperPrep)+((1.0f - p->prepIndex)*fromLF); |
| 1057 | + tHermiteDelay_tickIn(&p->delUF, intoUpper); |
| 1058 | + // update all delay lengths |
| 1059 | + |
| 1060 | + p->curr = fromBridge; |
| 1061 | + |
| 1062 | + //p->curr = fromBridge; |
| 1063 | + //p->curr += fromNut; |
| 1064 | + |
| 1065 | + return p->curr; |
| 1066 | +} |
| 1067 | + |
| 1068 | +float tLivingString2_udpateDelays(tLivingString2* const pl) |
| 1069 | +{ |
| 1070 | + _tLivingString2* p = *pl; |
| 1071 | + |
| 1072 | + |
| 1073 | + |
| 1074 | + //need to determine which delay line to put it into (should be half amplitude into forward and backward lines for the correct portion of string) |
| 1075 | + |
| 1076 | + float lowLen=p->prpSmooth->dest*p->wlSmooth->dest; |
| 1077 | + float upLen=(1.0f-p->prpSmooth->dest)*p->wlSmooth->dest; |
| 1078 | + |
| 1079 | + |
| 1080 | + |
| 1081 | + tHermiteDelay_setDelay(&p->delLF, lowLen); |
| 1082 | + tHermiteDelay_setDelay(&p->delLB, lowLen); |
| 1083 | + tHermiteDelay_setDelay(&p->delUF, upLen); |
| 1084 | + tHermiteDelay_setDelay(&p->delUB, upLen); |
| 1085 | +} |
| 1086 | + |
| 1006 | 1087 | float tLivingString2_sample(tLivingString2* const pl) |
| 1007 | 1088 | { |
| 1008 | 1089 | _tLivingString2* p = *pl; |