Skip to content

fix: resolve review findings (audio-thread safety, robustness)#18

Merged
yves-vogl merged 3 commits into
mainfrom
fix/review-findings
Jul 16, 2026
Merged

fix: resolve review findings (audio-thread safety, robustness)#18
yves-vogl merged 3 commits into
mainfrom
fix/review-findings

Conversation

@yves-vogl

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Unconditional per-block heap allocation in OvertureEngine::process() via IIR::Coefficients::make{High,Low}Pass #12OvertureEngine::process() unconditionally called IIR::Coefficients<float>::makeHighPass/makeLowPass for the Tight HPF and both Tone LPF stages every block, each new-ing a fresh ref-counted Coefficients object (up to 6 allocations/6 deallocations per processBlock() call on the audio thread). Replaced 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 processBlock has no defensive clamp against block sizes exceeding the size declared to prepareToPlay #13processBlock()/OvertureEngine::process() had no clamp against a host handing more samples than the spec.maximumBlockSize declared to prepareToPlay()/prepare(); the oversampler's and DryWetMixer's internal buffers are both fixed to that size and only guarded by a jassert (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 private processChunk()) 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 instruments operator new/delete (AllocationGuard.h/.cpp, ported from sibling plugin Seraph's proven pattern) and fails if OvertureAudioProcessor::processBlock() or OvertureEngine::process() ever allocates while Tight/Tone are being automated. Confirmed red (96 allocations observed) against pre-fix main, green after the fix.
  • tests/EngineTests.cpp (new case): feeds a 64x-oversized block (8192 samples against a 128-sample prepare()) through OvertureEngine::process() and checks it produces output numerically identical to a correctly host-chunked reference run. Confirmed red (16175/16386 assertions failed) against pre-fix main, green after the fix.
  • Full local suite green: cmake --build build --target Tests Overture_Standalone && ctest --test-dir build --output-on-failure — 54/54 passed (51 pre-existing + 3 new).
  • Verified both new regression tests actually fail on pre-fix main via an isolated git worktree build (not just asserted from reading the diff).

🤖 Generated with Claude Code

yves-vogl and others added 3 commits July 16, 2026 00:10
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>
@yves-vogl
yves-vogl merged commit 81a22b5 into main Jul 16, 2026
3 of 4 checks passed
@yves-vogl
yves-vogl deleted the fix/review-findings branch July 16, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant