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:
1 parent
facd5c5b5e
commit
4b0db50271
70 files changed
+115
-111
No files matched your search
@@ -0,0 +1,76 @@
|
||||
#include "ModulationMatrix.h"
|
||||
|
||||
namespace serum
|
||||
{
|
||||
|
||||
bool ModulationMatrix::addConnection (ModSource source, ModTarget target, float depth, bool bipolar)
|
||||
{
|
||||
if ((int) source < 0 || (int) source >= kNumModSources
|
||||
|| (int) target < 0 || (int) target >= kNumModTargets
|
||||
|| ! std::isfinite (depth) || (int) connections.size() >= kMaxConnections)
|
||||
return false;
|
||||
connections.push_back ({ source, target, juce::jlimit (-1.0f, 1.0f, depth), bipolar });
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModulationMatrix::removeConnection (int index)
|
||||
{
|
||||
if (index >= 0 && index < (int) connections.size())
|
||||
connections.erase (connections.begin() + index);
|
||||
}
|
||||
|
||||
void ModulationMatrix::removeAllWithTarget (ModTarget target)
|
||||
{
|
||||
connections.erase (std::remove_if (connections.begin(), connections.end(),
|
||||
[target] (const ModConnection& c) { return c.target == target; }),
|
||||
connections.end());
|
||||
}
|
||||
|
||||
juce::ValueTree ModulationMatrix::toValueTree() const
|
||||
{
|
||||
ModulationMatrix validated;
|
||||
for (const auto& c : connections)
|
||||
{
|
||||
if (validated.size() >= kMaxConnections)
|
||||
break;
|
||||
if (! validated.addConnection (c.source, c.target, c.depth, c.bipolar))
|
||||
continue;
|
||||
}
|
||||
juce::ValueTree tree ("MODMATRIX");
|
||||
for (const auto& c : validated.connections)
|
||||
{
|
||||
juce::ValueTree con ("CONNECTION");
|
||||
con.setProperty ("source", modSourceToString (c.source), nullptr);
|
||||
con.setProperty ("target", modTargetToString (c.target), nullptr);
|
||||
con.setProperty ("depth", c.depth, nullptr);
|
||||
con.setProperty ("bipolar", c.bipolar, nullptr);
|
||||
tree.appendChild (con, nullptr);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
void ModulationMatrix::fromValueTree (const juce::ValueTree& tree)
|
||||
{
|
||||
connections.clear();
|
||||
if (! tree.hasType ("MODMATRIX"))
|
||||
return;
|
||||
|
||||
for (const auto& con : tree)
|
||||
{
|
||||
if ((int) connections.size() >= kMaxConnections)
|
||||
break;
|
||||
if (! con.hasType ("CONNECTION"))
|
||||
continue;
|
||||
const auto sourceName = con.getProperty ("source").toString();
|
||||
const auto source = modSourceFromString (sourceName);
|
||||
if (sourceName.isEmpty() || modSourceToString (source) != sourceName)
|
||||
continue;
|
||||
if (! addConnection (source,
|
||||
modTargetFromString (con.getProperty ("target").toString()),
|
||||
(float) con.getProperty ("depth", 0.0),
|
||||
(bool) con.getProperty ("bipolar", false)))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace serum
|
||||
Reference in new issue
Block a user