92 lines
6.2 KiB
Markdown
92 lines
6.2 KiB
Markdown
# Review-Cycle Backlog
|
||
|
||
Findings from the 2026-05-10 `/lyrebird_review_cycle` sweep, plus follow-ons from later cycles. This file lives across phases — addressed bullets get deleted; new review cycles fold their findings in here.
|
||
|
||
---
|
||
|
||
## Deferred from 2026-05-27 `/lyrebird_review_cycle`
|
||
|
||
- **A-9 — Six early-phase audio-only filters lack namespace-enum wrapper.**
|
||
`CombFilter`, `AllpassFilter`, `RingingFilter`, `ResonatingFilter`,
|
||
`SecondOrderSection`, `FirstOrderSection` are bare
|
||
`public final class Foo: GeneratorBase, AudioGenerator` at the top
|
||
level of their files rather than the `enum Foo { class Audio: ... }`
|
||
namespace pattern used by all newer audio-only generators (`FreeVerb`,
|
||
`GVerb`, `Chorus`, `Flanger`, etc.). All six carry
|
||
`// GeneratorEnum conformance intentionally omitted` comments —
|
||
consistent with the audio-only contract, but the unwrapped public API
|
||
means call sites use `CombFilter(...)` while peers use
|
||
`FreeVerb.Audio(...)`. Refactoring would be a breaking change touching
|
||
all call sites; track for a future refactor phase that can land the
|
||
rename + deprecation alias in one commit.
|
||
|
||
- **Q-4 — Long `_computeSamples` reverb functions.**
|
||
- `Sources/Lyrebird/Generators/Reverb/PlateReverb.swift:425` —
|
||
`_computeSamples` is 224 lines.
|
||
- `Sources/Lyrebird/Generators/Reverb/GVerb.swift:324` —
|
||
`_computeSamples` is 172 lines.
|
||
- `Sources/Lyrebird/Generators/Panning/PanXYDistance.swift:188` /
|
||
`PanAzDistance.swift:190` — 167 lines each.
|
||
- `Sources/Lyrebird/Generators/PhysicalModels/Flute.swift:192` —
|
||
162 lines.
|
||
These are RT hot loops where the team has explicitly chosen inlining
|
||
over decomposition for performance. The reverb pair (Plate + GVerb)
|
||
might benefit from a `RuntimeReverbHelpers.swift` extraction
|
||
(similar to the existing `FilterHelpers.swift` /
|
||
`RBJBiquadHelpers.swift` pattern) when profiling justifies a perf
|
||
pass. The pan + flute cases are cohesive single-purpose state
|
||
machines and resist splitting.
|
||
|
||
---
|
||
|
||
## Architectural drift (kept — not blocking)
|
||
|
||
- `_Base` pattern vs flat `GeneratorBase` subclass split: early generators (`CombFilter`, `AllpassFilter`, `ResonatingFilter`, `RingingFilter`, all `RBJ*` types, `Pan2`/`Pan4`/`PanN`, `AmbiEncoder1`/`AmbiDecoder1`, `DelayLine`/`DelayLineFeedback`, `FreqTracker`, `LookAheadLimiter`, all granular generators) hand-allocate `_result: [[Double]]` and skip the `enum { _Base; Audio; Control }` pattern. Locking in either direction would break public API. Document in the generator authoring guide as "consider the namespace pattern even for Audio-only generators in case a Control variant becomes useful later," but leave existing public API alone.
|
||
- `RBJBiquad.swift` packs three internal types (`BiquadCoeffs`, `BiquadState`, `FirstOrderState`). All tightly coupled, all `internal`. Defensible — low priority split.
|
||
|
||
## Style retained for paper fidelity
|
||
|
||
- **PlateReverb snake_case constants**: `Sources/Lyrebird/Generators/Reverb/PlateReverb.swift:77-93` uses paper-cross-reference names (`plateLTap_LD1_A`, etc.). Acceptable for fidelity to the Dattorro paper.
|
||
|
||
## Future-visibility flags (no fix required)
|
||
|
||
- **Long inherently-linear functions**:
|
||
- `Sources/Lyrebird/AudioDrivers/CoreAudioDriver.swift:132-301` `setup(engine:)` — ~170 lines, 8 numbered steps. Splitting into `_findComponent`, `_enableIO`, `_installCallback` would ease maintenance.
|
||
- `Sources/Lyrebird/Process/LyrebirdEventList.swift:949-1052` `buildFromFile(…)` — already commented in 5 numbered steps; readable.
|
||
- `Sources/Lyrebird/Generators/Reverb/PlateReverb.swift:325-413` `Audio.init` buffer-sizing block — straight-line, self-evident.
|
||
|
||
## Skipped — needs `LyrebirdBuffer.isEmpty`
|
||
|
||
- `Sources/Lyrebird/Generators/Reverb/ConvolutionReverb.swift:206` uses `ir.count > 0`. Swap to `!ir.isEmpty` when `LyrebirdBuffer` grows that accessor; until then `count > 0` is acceptable.
|
||
|
||
---
|
||
|
||
## Resolved in step-6 maintenance pass (2026-05-10)
|
||
|
||
The following findings were addressed in the spectral formant-shift step-6 commit:
|
||
|
||
- **Shared `combFeedbackCoeff` / `lyrebirdLog60dBLn`**: extracted into `Sources/Lyrebird/Generators/Filters/FilterHelpers.swift`. `CombFilter`, `AllpassFilter`, `ResonatingFilter` now call the shared helper / constant.
|
||
- **GeneratorEnum-omitted comment** added at end of 20 Audio-only generators (filters, delays, panning, dynamics, granular families).
|
||
- **`SecondOrderSection` / `FirstOrderSection`**: confirmed user-facing low-level primitives; added init-level `/// - Parameters:` blocks.
|
||
- **Butterworth queue constant rename**: dropped `lyrebird` prefix on internal `butterworthCoeffQueueCapacity` / `butterworthRespQueueCapacity` / `butterworthKillQueueCapacity`.
|
||
- **LyrebirdUI formatter dedupe**: extracted `formattedParameterValue(_:)` into `Sources/LyrebirdUI/Controls/ParameterFormatting.swift` with named threshold constants. `ParameterKnob` and `ParameterXY` route through it.
|
||
- **Drag-start sentinel collision**: replaced the dual-zero check in `ParameterKnob.dragGesture` with an explicit `@State var dragInProgress: Bool` flag.
|
||
- **Lock without `defer`**: `LyrebirdRoutineContext._checkPause` now uses `lock(); defer { unlock() }` instead of explicit unlocks.
|
||
- **`.before/.after` arm collapse**: `LyrebirdProcess` cross-EventList validation uses a single `case .before(let other), .after(let other):` switch arm.
|
||
- **Close-error swallowing**: `SpectralFrameBufferFileIO.write(to:)` now closes the file handle explicitly on the success path so flush failures surface to the caller; the `defer` keeps the close on error bail-out only.
|
||
- **`ParameterNode` Sendable invariant**: added one-line comment summarising the `Atomic<UInt64>` cross-thread channel + RT-only mutable state.
|
||
|
||
## Resolved in steps 1–4 (earlier spectral formant-shift work)
|
||
|
||
- Foundation import sweep (~54 files), DemandRandom/TemporalStream seed-helper consolidation, DelayInterpolation/MouseTracker file splits, MoogLadder `cutoff:` → `freq:` rename + MuTronIII `peak:` documentation.
|
||
|
||
## Resolved in step 5
|
||
|
||
- `docs/stdlib/generators.md` catalog refresh — covered ~40 missing generator types across 15 categories.
|
||
|
||
---
|
||
|
||
## Maintenance discipline
|
||
|
||
Drain this file periodically. When new review cycles run, fold findings in here instead of dropping them.
|