Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/orbit_delay_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@ float OrbitDelayCore::processChannelFast(float input,

const float writePos = static_cast<float>(delay.writePos);
const float maxGuardBySize = 0.25f * delaySize;
const float guardSamples = clampf(kOrbitReadGuardMinSamples,
1.0f,
clampf(kOrbitReadGuardMaxSamples, 1.0f, maxGuardBySize));
const float guardSamples = clampf(maxGuardBySize,
kOrbitReadGuardMinSamples,
kOrbitReadGuardMaxSamples);
Comment on lines +638 to +640

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current clamping logic forces guardSamples to a minimum of kOrbitReadGuardMinSamples (16.0f). For small delay buffers where maxGuardBySize (25% of the buffer) is less than 16, this results in a guard zone that is too large relative to the buffer size. For example, if delaySize is 32, guardSamples becomes 16, which causes the read pointer to be constantly reset because the condition distanceForward < 16 || distanceForward > 16 (lines 641-642) will be true for almost all positions. This effectively breaks the delay functionality for small buffers.

To ensure robustness, the lower bound of the clamp should not exceed maxGuardBySize.

Suggested change
const float guardSamples = clampf(maxGuardBySize,
kOrbitReadGuardMinSamples,
kOrbitReadGuardMaxSamples);
const float guardSamples = clampf(maxGuardBySize,
(maxGuardBySize < kOrbitReadGuardMinSamples) ? maxGuardBySize : kOrbitReadGuardMinSamples,
kOrbitReadGuardMaxSamples);

Comment on lines +638 to +640

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cap guardSamples by delay size for small buffers

guardSamples is now floored to kOrbitReadGuardMinSamples (16) even when the attached delay buffer is smaller than 64 samples, so in orbit mode the check distanceForward < guardSamples || distanceForward > (delaySize - guardSamples) becomes effectively always true for small buffers (e.g. size 32, and for size <32 it is strictly always true). That forces readPos to writePos + guardSamples every sample, collapsing modulation and creating a read/write spacing that no longer scales with buffer size. The previous code reduced guard for small buffers, so this is a behavior regression for valid attachBuffers(..., size>=4) configurations.

Useful? React with 👍 / 👎.

const float distanceForward = wrapPosFloat(readPos - writePos, delaySize, invDelaySize);
if (distanceForward < guardSamples || distanceForward > (delaySize - guardSamples)) {
readPos = wrapPosFloat(writePos + guardSamples, delaySize, invDelaySize);
Expand Down
Loading