From 7a2365e68fb0d097d26d5f59facf24baf9f0d534 Mon Sep 17 00:00:00 2001 From: nwolek Date: Sat, 26 Dec 2015 15:49:17 -0500 Subject: [PATCH] DelayWithInterpolation: sample operator now using interpolation class, passes tests. see issue #60 --- include/objects/JamomaDelay.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/objects/JamomaDelay.h b/include/objects/JamomaDelay.h index aedf457..7cc6dba 100644 --- a/include/objects/JamomaDelay.h +++ b/include/objects/JamomaDelay.h @@ -104,9 +104,10 @@ namespace Jamoma { const std::size_t mCapacity; CircularSampleBufferGroup mHistory; - std::size_t mIntegralDelay; - double mFractionalDelay; - double mOneMinusFractionalDelay; + std::size_t mIntegralDelay; + double mFractionalDelay; + double mOneMinusFractionalDelay; + Jamoma::Interpolation::Linear mInterpolation; // NW: according to TAP this ensures that mHistory is resized when necessary Observer mChannelCountObserver = { std::bind(&DelayWithLinearInterpolation::resizeHistory, this) }; @@ -166,8 +167,9 @@ namespace Jamoma { { mHistory[channel].resize(size+2); // need delay samples plus 2 "now" samples for interpolation mHistory[channel].write(x); - return fractionalDelay() * mHistory[channel].tail() + - oneMinusFractionalDelay() * mHistory[channel].tail(1); + return mInterpolation(mHistory[channel].tail(1), + mHistory[channel].tail(), + fractionalDelay()); } SharedSampleBundleGroup operator()(const SampleBundle& x)