slightly more correct delay behavior
parent
c8b0108fb4
commit
c27468fc55
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue