-
Notifications
You must be signed in to change notification settings - Fork 0
Fix orbit read guard sample clamping #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| const float distanceForward = wrapPosFloat(readPos - writePos, delaySize, invDelaySize); | ||
| if (distanceForward < guardSamples || distanceForward > (delaySize - guardSamples)) { | ||
| readPos = wrapPosFloat(writePos + guardSamples, delaySize, invDelaySize); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current clamping logic forces
guardSamplesto a minimum ofkOrbitReadGuardMinSamples(16.0f). For small delay buffers wheremaxGuardBySize(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, ifdelaySizeis 32,guardSamplesbecomes 16, which causes the read pointer to be constantly reset because the conditiondistanceForward < 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.