fix: resolve review findings (audio-thread safety, robustness)#18
Merged
Conversation
A host handing process() more samples than the spec.maximumBlockSize declared to prepare() would overrun the oversampler's and DryWetMixer's internal buffers, which only guard that invariant with a jassert (compiled out in Release builds). process() now splits any block exceeding preparedMaxBlockSize into safe-sized chunks (each run through a new private processChunk()) before touching either internal, matching the real, Release-safe chunking guard already used by sibling plugins Twist Your Guts and Miserere. Fixes #13 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ss() OvertureEngine::process() unconditionally called IIR::Coefficients<float>::makeHighPass/makeLowPass for the Tight HPF and both Tone LPF stages every block; each call `new`s a fresh ref-counted Coefficients object (plus its own heap-backed Array), i.e. up to 6 allocations/6 deallocations per processBlock() call on the audio thread. Replace with juce::dsp::IIR::ArrayCoefficients (stack-computed) written directly into the already-allocated Coefficients storage via a new src/dsp/RealtimeCoefficients.h helper - the same non-allocating pattern already used by sibling plugins Lancet and Twist Your Guts. Fixes #12 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OvertureEngine::process()unconditionally calledIIR::Coefficients<float>::makeHighPass/makeLowPassfor the Tight HPF and both Tone LPF stages every block, eachnew-ing a fresh ref-countedCoefficientsobject (up to 6 allocations/6 deallocations perprocessBlock()call on the audio thread). Replaced withjuce::dsp::IIR::ArrayCoefficients(stack-computed) written directly into the already-allocatedCoefficientsstorage via a newsrc/dsp/RealtimeCoefficients.hhelper — the same non-allocating pattern already used by sibling plugins Lancet and Twist Your Guts.processBlock()/OvertureEngine::process()had no clamp against a host handing more samples than thespec.maximumBlockSizedeclared toprepareToPlay()/prepare(); the oversampler's andDryWetMixer's internal buffers are both fixed to that size and only guarded by ajassert(compiled out in Release builds).OvertureEngine::process()now defensively splits any oversized block into chunks of at most the prepared maximum (each run through a new privateprocessChunk()) before touching either internal — the same real, Release-safe chunking guard already used by sibling plugins Twist Your Guts and Miserere.Test plan
tests/AllocationTests.cpp(new): globally instrumentsoperator new/delete(AllocationGuard.h/.cpp, ported from sibling plugin Seraph's proven pattern) and fails ifOvertureAudioProcessor::processBlock()orOvertureEngine::process()ever allocates while Tight/Tone are being automated. Confirmed red (96 allocations observed) against pre-fixmain, green after the fix.tests/EngineTests.cpp(new case): feeds a 64x-oversized block (8192 samples against a 128-sampleprepare()) throughOvertureEngine::process()and checks it produces output numerically identical to a correctly host-chunked reference run. Confirmed red (16175/16386 assertions failed) against pre-fixmain, green after the fix.cmake --build build --target Tests Overture_Standalone && ctest --test-dir build --output-on-failure— 54/54 passed (51 pre-existing + 3 new).mainvia an isolated git worktree build (not just asserted from reading the diff).🤖 Generated with Claude Code