# 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` for delay lines and size them in `prepare()`. - Use `juce::MathConstants::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 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.