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
2929
3030 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
3131
32− d->delay = 0.0f;
33−
3432 d->inPoint = 0;
3533 d->outPoint = 0;
3634
@@ -143,8 +141,6 @@ void tDelayL_init (tDelayL* const d, float delay, uint32_t maxDelay) · 106 unmodified lines
143141
144142 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
145143
146− d->delay = 0.0f;
147−
148144 d->gain = 1.0f;
149145
150146 d->lastIn = 0.0f;
@@ -206,14 +202,28 @@ int tDelayL_setDelay (tDelayL* const d, float delay) · 55 unmodified lines
206202 return 0;
207203 }
208204
209−float tDelayL_tapOut (tDelayL* const d, uint32_t tapDelay)
205+float tDelayL_tapOut (tDelayL* const d, float tapDelay)
210206 {
211− int32_t tap = d->inPoint - tapDelay - 1;
207+ float tap = (float) d->inPoint - tapDelay - 1.f;
212208
213209 // Check for wraparound.
214− while ( tap < 0 ) tap += d->maxDelay;
215−
216− return d->buff[tap];
210+ while ( tap < 0.f ) tap += (float)d->maxDelay;
211+
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;
217227
218228 }
219229
@@ -274,8 +284,6 @@ void tDelayA_init (tDelayA* const d, float delay, uint32_t maxDelay) · 54 unmodified lines
274284
275285 d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
276286
277− d->delay = 0.0f;
278−
279287 d->gain = 1.0f;
280288
281289 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