Skip to content

Commit

Permalink
InterpolatingDelay: solved issue with delays that span signal vectors…
Browse files Browse the repository at this point in the history
…. branch just needs a bit of clean up before pull request. see issue #28
  • Loading branch information
nwolek committed Nov 5, 2015
1 parent 32f6b3a commit 8488f7c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions includes/library/JamomaDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,23 @@ namespace Jamoma {

Jamoma::SampleBundle tailPull(x.channelCount(), x.frameCount()+2);
// need one extra frame for interpolation
Jamoma::Sample tailBeforeWrite = 0.0;

for (int channel=0; channel < x.channelCount(); ++channel) {
//mHistory[channel].resize(mIntegralDelay+2);
// we need to grab one sample before the write to protect
// delay sizes that span two SampleBundles
tailBeforeWrite = mHistory[channel].tail(0-mIntegralDelay-1);

// write first (then read) so that we can acheive a zero-sample delay
mHistory[channel].write(x[channel]);
mHistory[channel].tail(tailPull[channel]);

// compute the first value with the value we stashed in tailBeforeWrite
out[0][channel][0] =
fractionalDelay() * mHistory[channel].tail(x.frameCount()+1) +
fractionalDelay() * tailBeforeWrite +
oneMinusFractionalDelay() * tailPull[channel][0];

// then run through the rest with the tailPull SampleBundle
for (int frame=1; frame < x.frameCount(); ++frame) {
out[0][channel][frame] =
fractionalDelay() * tailPull[channel][frame-1] +
Expand Down

0 comments on commit 8488f7c

Please sign in to comment.