Files
biggy 4b0db50271 refactor(source): move every implementation into its module directory
- 36 files move into the module whose AGENTS.md already claimed them:
  Engine/, Synth/, Modulation/, Params/, Plugin/, GUI/, EffectUnits/, Resources/
- Source/engine, modulation, params, plugin and synth become Engine,
  Modulation, Params, Plugin and Synth, matching the directories that already
  hold code
- ExactCompare.h stays at the Source/ root as the one shared header
- SERUMALT_INCLUDE_DIRS adds one include directory per module, so the 31
  parent-relative includes become plain names with no path prefix
- the module AGENTS.md files list owned files instead of describing a move
  that had not happened, and README.md and AGENTS.md describe the real tree

Verified: the harness passes CTest, the Linux VST3 and Standalone link, the
Windows cross-build passes its module checks, each configure exposes only its
own targets, no first-party warning line appears, and the generated Windows
manifest is unchanged.
2026-10-06 09:17:49 +02:00

50 lines
1.6 KiB
Markdown

# engine module
## Owned files
- Engine.h, Engine.cpp
## Rules
- Own the voice pool, LFOs, wavetable library, FX rack, matrix and macros by value.
- Bind APVTS pointers in `prepare()`; `v()` reads captured values without constructing parameter-name strings.
- Build the `RenderContext` once per host block and refresh its modulation inputs for each render segment.
- Render up to 64 samples at a time, splitting at MIDI event offsets and respecting prepared buffer capacity.
- Size `mixBuffer` once in `prepare()`; use non-owning views for shorter segments.
- Prebuild wavetables in the Engine constructor, before either GUI painting or audio rendering can read them.
- Clamp the final output with the soft limiter.
- Never call `setSize` on any buffer inside `processBlock`.
## IF-THEN
- IF a per-block buffer is needed THEN allocate it in `prepare()` and clear it per block.
- IF a module needs the matrix, macros or wavetables THEN go through Engine accessors rather than reaching into another module.
## Examples
```cpp
// BAD: per-callback buffer reconfiguration on the audio thread
void processBlock (...)
{
mixBuffer.setSize (2, n, false, false, true);
...
}
```
```cpp
// GOOD: size once, then wrap a non-owning view per segment
void prepare (double sr, int blockSize)
{
mixBuffer.setSize (2, blockSize, false, false, true);
}
void processBlock (...)
{
// No allocation; the view only borrows mixBuffer's channels.
juce::AudioBuffer<float> block (mixBuffer.getArrayOfWritePointers(), 2, segmentLength);
block.clear();
...
}
```
This file overrides /AGENTS.md where they conflict.