History

Dattorro reverb ugen working great.

mulshine committed 7 years ago

Commit 1af17391 parent 32bb7b98 files · +415 −219Browse files

Showing the changes to LEAF/Src_cpp/leaf-delay.cpp (1 of 8 files). Show all

Unified · Split

LEAF/Src_cpp/leaf-delay.cpp+19−11
@@ -29,8 +29,6 @@ void tDelay_init (tDelay* const d, uint32_t delay, uint32_t maxDelay) · 28 unmodified lines
29 29
30 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);30 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
31 31
32 d->delay = 0.0f;
33
34 d->inPoint = 0;32 d->inPoint = 0;
35 d->outPoint = 0;33 d->outPoint = 0;
36 34
@@ -143,8 +141,6 @@ void tDelayL_init (tDelayL* const d, float delay, uint32_t maxDelay) · 106 unmodified lines
143 141
144 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);142 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
145 143
146 d->delay = 0.0f;
147
148 d->gain = 1.0f;144 d->gain = 1.0f;
149 145
150 d->lastIn = 0.0f;146 d->lastIn = 0.0f;
@@ -206,14 +202,28 @@ int tDelayL_setDelay (tDelayL* const d, float delay) · 55 unmodified lines
206 return 0;202 return 0;
207}203}
208 204
209float tDelayL_tapOut (tDelayL* const d, uint32_t tapDelay)205float tDelayL_tapOut (tDelayL* const d, float tapDelay)
210{206{
211 int32_t tap = d->inPoint - tapDelay - 1;207 float tap = (float) d->inPoint - tapDelay - 1.f;
212 208
213 // Check for wraparound.209 // Check for wraparound.
214 while ( tap < 0 ) tap += d->maxDelay;210 while ( tap < 0.f ) tap += (float)d->maxDelay;
215 211
216 return d->buff[tap];212 float alpha = tap - (int)tap;
213 float omAlpha = 1.f - alpha;
214
215 int ptx = (int) tap;
216
217 // First 1/2 of interpolation
218 float samp = d->buff[ptx] * omAlpha;
219
220 // Second 1/2 of interpolation
221 if ((ptx + 1) < d->maxDelay)
222 samp += d->buff[ptx+1] * d->alpha;
223 else
224 samp += d->buff[0] * d->alpha;
225
226 return samp;
217 227
218}228}
219 229
@@ -274,8 +284,6 @@ void tDelayA_init (tDelayA* const d, float delay, uint32_t maxDelay) · 54 unmodified lines
274 284
275 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);285 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
276 286
277 d->delay = 0.0f;
278
279 d->gain = 1.0f;287 d->gain = 1.0f;
280 288
281 d->lastIn = 0.0f;289 d->lastIn = 0.0f;

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