ref: 8e6e59716b25624b726ee8f2c4bd50c6d3328c08
parent: 1a65dc6f465711ffa88151dfa8846b989ee70d54
author: mulshine <mulshine@princeton.edu>
date: Wed Jan 30 13:01:46 EST 2019
No prints.
--- a/LEAF/Src/leaf-sample.c
+++ b/LEAF/Src/leaf-sample.c
@@ -106,7 +106,7 @@
//==============================================================================
-#define CFX 10
+#define CFX 30
void tSamplePlayer_init (tSamplePlayer* const p, tSample* s)
{
@@ -152,6 +152,7 @@
int idx = (int) p->idx;
float alpha = p->idx - idx;
+ float idxx;
int32_t start = p->start, end = p->end;
if (p->flip < 0)
@@ -160,9 +161,6 @@
end = p->start;
}
- p->g1 = 1.f;
- p->g2 = 0.f;
-
// Check dir (direction) to interpolate properly
if (dir > 0)
{
@@ -181,12 +179,14 @@
buff[i4],
alpha);
+ //printf("cidx: %d\n", idx);
+
cfx = (end - idx) / p->inc;
if (cfx <= CFX)
{
// CROSSFADE SAMPLE
- float idxx = p->idx - p->len;
+ idxx = p->idx - p->len;
int cdx = (int)(idxx);
float alpha = idxx - cdx;
@@ -195,10 +195,12 @@
i4 = cdx+2;
cfxsample = LEAF_interpolate_hermite (buff[i1],
- buff[idx],
+ buff[cdx],
buff[i3],
buff[i4],
alpha);
+
+ //rprintf("cidx: %d\n", cdx);
}
else cfx = CFX;
}
@@ -224,7 +226,9 @@
if (cfx <= CFX)
{
// CROSSFADE SAMPLE
- int cdx = idx + p->len;
+ idxx = p->idx + p->len;
+ int cdx = (int)(idxx);
+ float alpha = idxx - cdx;
i1 = cdx+1;
i3 = cdx-1;
@@ -231,7 +235,7 @@
i4 = cdx-2;
cfxsample = LEAF_interpolate_hermite (buff[i1],
- buff[idx],
+ buff[cdx],
buff[i3],
buff[i4],
alpha);
@@ -263,10 +267,10 @@
}
}
- sample = sample * p->g1 + cfxsample * p->g2;
-
p->g2 = (float) (CFX - cfx) / (float) CFX;
p->g1 = 1.f - p->g2;
+
+ sample = sample * p->g1 + cfxsample * p->g2;
return sample;
}
--- a/LEAF/leaf.h
+++ b/LEAF/leaf.h
@@ -11,10 +11,10 @@
#ifndef LEAF_H_INCLUDED
#define LEAF_H_INCLUDED
-#define DEBUG 0
+#define LEAF_DEBUG 0
-#if DEBUG
-#include "../JuceLibraryCode/JuceHeader.h"
+#if LEAF_DEBUG
+#include "../LEAF_JUCEPlugin/JuceLibraryCode/JuceHeader.h"
#endif
#if _WIN32 || _WIN64