44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "Params.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// A single modulation connection: source -> target with a static depth and a
|
|
// bipolar flag. One level of modulation only (no modulation of modulation).
|
|
// ===========================================================================
|
|
struct ModConnection
|
|
{
|
|
ModSource source = ModSource::Lfo1;
|
|
ModTarget target = ModTarget::None;
|
|
float depth = 0.0f;
|
|
bool bipolar = false;
|
|
};
|
|
|
|
// ===========================================================================
|
|
// Ordered collection of modulation connections. Serialisable to/from a
|
|
// juce::ValueTree so that connections survive preset save/load.
|
|
// ===========================================================================
|
|
class ModulationMatrix
|
|
{
|
|
public:
|
|
static constexpr int kMaxConnections = 32;
|
|
|
|
std::vector<ModConnection> connections;
|
|
|
|
bool addConnection (ModSource source, ModTarget target, float depth, bool bipolar);
|
|
void removeConnection (int index);
|
|
void removeAllWithTarget (ModTarget target);
|
|
void clear() { connections.clear(); }
|
|
|
|
int size() const noexcept { return (int) connections.size(); }
|
|
|
|
juce::ValueTree toValueTree() const;
|
|
void fromValueTree (const juce::ValueTree& tree);
|
|
};
|
|
|
|
} // namespace serum
|