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.
This commit is contained in:
biggy committed 2026-10-06 09:17:49 +02:00
1 parent facd5c5b5e
commit 4b0db50271
70 files changed
+115 -111

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
#pragma once
#include <JuceHeader.h>
#include "Params.h"
namespace serum
{
// ===========================================================================
// Free-running LFO with tempo sync, seven shapes (sine/tri/saw/square/S&H/
// step-sequencer/freehand), adjustable phase, fade-in and start delay.
// ===========================================================================
class LFO
{
public:
static constexpr int kShapePoints = 64;
LFO() { reset(); }
void prepare (double sampleRate) { sr = sampleRate; reset(); }
void reset();
void setParams (float rateNorm, bool sync, float beat, int shape, float phase,
float fade, float delay);
void setTempo (double bpm) noexcept { tempo = bpm; }
void setShapeData (const std::vector<float>& data, int steps);
float process() noexcept; // advance and return current value
float advance (int numSamples) noexcept;
float getPhase() const noexcept { return (float) (phase + phaseOffset - std::floor (phase + phaseOffset)); }
float getValue() const noexcept { return value; }
const std::vector<float>& getShapeData() const noexcept { return shapeBuffer; }
int getShapeSteps() const noexcept { return shapeSteps; }
private:
double sr = 44100.0;
double tempo = 120.0;
double phase = 0.0;
double phaseOffset = 0.0;
double rateHz = 1.0;
float value = 0.0f;
int shape = 0;
bool sync = false;
float beat = 0.25f;
double delaySeconds = 0.0;
double fadeSeconds = 0.0;
double delayCounter = 0.0; // samples remaining before start
double fadeCounter = 0.0; // samples elapsed in fade
float fadeVal = 1.0f;
float prevDelayParam = -1.0f;
float prevFadeParam = -1.0f;
std::vector<float> shapeBuffer;
int shapeSteps = 16;
juce::Random rng;
float holdValue = 0.0f;
float shapeValue() noexcept;
};
// ===========================================================================
// Pure shape evaluation shared by the audio render (LFO::shapeValue) and the
// GUI preview (LFODisplay::valueAt), so the drawn shape cannot drift from the
// played one. `sampleHoldValue` supplies the current held level for
// LfoShape::SampleHold, which is stateful in the audio path.
// ===========================================================================
float lfoShapeValue (float phase, LfoShape shape, int steps,
const float* data, int dataSize, float sampleHoldValue) noexcept;
} // namespace serum