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

+99
View File
@@ -0,0 +1,99 @@
#pragma once
#include <JuceHeader.h>
#include "Params.h"
#include "Wavetable.h"
#include "Oscillator.h"
#include "SubOscillator.h"
#include "NoiseOscillator.h"
#include "FilterBank.h"
#include "Envelope.h"
#include "ModulationMatrix.h"
#include "MacroControls.h"
namespace serum
{
// ===========================================================================
// Everything a voice needs to render one block. Global (non per-voice) values
// are provided by the engine; the voice adds its own per-voice modulation.
// ===========================================================================
struct RenderContext
{
double sampleRate = 44100.0;
const WavetableLibrary* wavetables = nullptr;
float lfoValues[kNumLfos] { 0.0f, 0.0f, 0.0f, 0.0f };
float macroValues[kNumMacros] { 0.0f, 0.0f, 0.0f, 0.0f };
float modWheel = 0.0f;
float pitchBend = 0.0f;
float pitchBendRange = 2.0f;
const ModulationMatrix* matrix = nullptr;
const MacroControls* macros = nullptr;
OscParams oscA;
OscParams oscB;
bool subOn = false;
int subShape = 0;
int subOct = -1;
float subLevel = 0.0f;
bool noiseOn = false;
int noiseType = 0;
float noiseLevel = 0.0f;
FilterBankParams filters;
float envAttack[4] { 0.01f, 0.01f, 0.01f, 0.01f };
float envDecay[4] { 0.2f, 0.2f, 0.2f, 0.2f };
float envSustain[4]{ 0.7f, 0.7f, 0.7f, 0.7f };
float envRelease[4]{ 0.3f, 0.3f, 0.3f, 0.3f };
float envCurve[4] { 0.5f, 0.5f, 0.5f, 0.5f };
};
// ===========================================================================
// One synthesis voice: two oscillators + sub + noise -> filter bank -> amp
// envelope. Four envelopes provide per-voice modulation sources.
// ===========================================================================
class SynthVoice
{
public:
void prepare (double sampleRate, int maxBlockSize);
void reset();
void noteOn (int noteNumber, float velocity, double freqHz, juce::uint32 seed);
void noteOff();
void render (float* outL, float* outR, int numSamples, const RenderContext& ctx) noexcept;
bool isActive() const noexcept { return active; }
bool isReleased() const noexcept { return released; }
int getNote() const noexcept { return note; }
juce::uint64 getNoteId() const noexcept { return noteId; }
float getModulationValue (ModSource source) const noexcept;
private:
Oscillator oscA, oscB;
SubOscillator sub;
NoiseOscillator noise;
FilterBank filters;
std::array<Envelope, 4> env;
int note = -1;
float velocity = 0.0f;
double baseFreq = 0.0;
bool active = false;
bool released = false;
juce::uint64 noteId = 0;
bool oscillatorsNeedNoteOn = false;
juce::uint32 seed = 0;
float noteRandom = 0.5f;
juce::AudioBuffer<float> scratch; // 2 channels
};
} // namespace serum