slightly more correct delay behavior

portability/boost
zetaPRIME 2019-07-02 21:20:26 -04:00
parent c8b0108fb4
commit c27468fc55
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,6 @@ void Delay::process() {
// enlarge buffer if too small
if (auto mc = frames+1; buf.capacity() < mc) buf.setCapacity(mc);
while (buf.size() <= frames) buf.append({0.0, 0.0}); // pack to fit
buf.normalizeIndexes(); // and make sure every frame is reachable
auto in = std::static_pointer_cast<AudioPort>(port(Port::Input, Port::Audio, 0));
auto out = std::static_pointer_cast<AudioPort>(port(Port::Output, Port::Audio, 0));
@ -77,6 +76,7 @@ void Delay::process() {
for (size_t f = 0; f < ts; f++) {
AudioFrame fCurrent = (*in)[f];
auto fOut = buf.takeFirst();
if (!buf.areIndexesValid()) buf.normalizeIndexes(); // make sure we can actually reach the point we need
int i = frames + buf.firstIndex();
buf[i] += (fCurrent * delayMult) + (fOut * fbMult);