History

Added custom tTapeDelay object.

mulshine committed 7 years ago

Commit e28e39c1 parent 9d82b878 files · +332 −50Browse files

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

Unified · Split

LEAF/Src_cpp/leaf-math.cpp+31−1
@@ -231,4 +231,34 @@ float LEAF_midiToFrequency(float f) · 230 unmodified lines
231 if( f <= -1500.0f ) return (0);231 if( f <= -1500.0f ) return (0);
232 else if( f > 1499.0f ) return (LEAF_midiToFrequency(1499.0f));232 else if( f > 1499.0f ) return (LEAF_midiToFrequency(1499.0f));
233 else return ( powf(2.0f, (f - 69.0f) / 12.0f) * 440.0f );233 else return ( powf(2.0f, (f - 69.0f) / 12.0f) * 440.0f );
234}234}
235
236
237// alpha, [0.0, 1.0]
238float LEAF_interpolate_hermite (float A, float B, float C, float D, float alpha)
239{
240 alpha = LEAF_clip(0.0f, alpha, 1.0f);
241
242 float a = -A/2.0f + (3.0f*B)/2.0f - (3.0f*C)/2.0f + D/2.0f;
243 float b = A - (5.0f*B)/2.0f + 2.0f*C - D / 2.0f;
244 float c = -A/2.0f + C/2.0f;
245 float d = B;
246
247 return a*alpha*alpha*alpha + b*alpha*alpha + c*alpha + d;
248}
249
250// alpha, [0.0, 1.0]
251float LEAF_interpolation_linear (float A, float B, float alpha)
252{
253 alpha = LEAF_clip(0.0f, alpha, 1.0f);
254
255 float omAlpha = 1.0f - alpha;
256
257 // First 1/2 of interpolation
258 float out = A * omAlpha;
259
260 out += B * alpha;
261
262 return out;
263}
264

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