docs: add agent guidance and historical audit report
Add root AGENT.md with project conventions, build verification steps, source layout, style rules, and real-time/concurrency requirements. Add per-module AGENT.md files for each existing and proposed source subdirectory. Add AUDIT_REPORT.md as a historical Phase 1 snapshot documenting memory management, error handling, concurrency model, naming conventions, and anti-pattern catalog.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# effects module
|
||||
|
||||
## Owned files
|
||||
|
||||
- Related rack implementation: `../FXProcessor.h`, `../FXProcessor.cpp`
|
||||
- Biquad.h
|
||||
- Hyper.h, Hyper.cpp
|
||||
- Chorus.h, Chorus.cpp
|
||||
- Flanger.h, Flanger.cpp
|
||||
- Phaser.h, Phaser.cpp
|
||||
- Distortion.h, Distortion.cpp
|
||||
- EQ.h, EQ.cpp
|
||||
- Compressor.h, Compressor.cpp
|
||||
- Delay.h, Delay.cpp
|
||||
- Reverb.h, Reverb.cpp
|
||||
|
||||
## Rules
|
||||
|
||||
- Implement the `FXUnit` interface with `prepare`, `reset` and `process (float* l, float* r, int numSamples, const float p[4])`.
|
||||
- Process full-wet in place; FXProcessor handles the dry/wet mix.
|
||||
- Document what p[0] through p[3] mean for each unit in the header comment.
|
||||
- Use `std::vector<float>` for delay lines and size them in `prepare()`.
|
||||
- Use `juce::MathConstants<T>::pi` and `twoPi` in delay LFOs, not raw literals.
|
||||
- Never allocate or resize a delay line inside `process`.
|
||||
- Guard empty delay lines with an early `if (len < 4) return;`.
|
||||
|
||||
## IF-THEN
|
||||
|
||||
- IF a unit needs a delay line THEN allocate it in `prepare()` at the full required length and only read and write it in `process`.
|
||||
- Include the existing rack interface via `../FXProcessor.h`; no source relocation is implied by this guidance.
|
||||
|
||||
## Examples
|
||||
|
||||
```cpp
|
||||
// BAD: reallocates a delay line on the audio thread
|
||||
void process (float* l, float* r, int n, const float p[4]) override
|
||||
{
|
||||
std::vector<float> delay ((size_t) (sr * 0.05), 0.0f);
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
```cpp
|
||||
// GOOD: sized once at prepare time, reused per block
|
||||
void prepare (double sampleRate, int) override
|
||||
{
|
||||
sr = sampleRate;
|
||||
delayL.assign ((size_t) (sr * 0.05), 0.0f);
|
||||
delayR.assign ((size_t) (sr * 0.05), 0.0f);
|
||||
}
|
||||
```
|
||||
|
||||
This file overrides /AGENT.md where they conflict.
|
||||
Reference in New Issue
Block a user