reVeno/Source/Veno/Audio/Engine/VeNoMatrix.h

49 lines
1.6 KiB
C
Raw Permalink Normal View History

//
// Created by versustune on 13.06.20.
//
#ifndef VENO_VENOMATRIX_H
#define VENO_VENOMATRIX_H
#include <string>
#include <unordered_map>
#include <vector>
#include "Modulator.h"
#include "ModulateValue.h"
2020-07-09 16:31:33 +02:00
#include "JuceHeader.h"
// class that modulate everything :D
2020-07-09 16:31:33 +02:00
struct VeNoMatrixTarget
{
std::string name;
2020-07-09 16:31:33 +02:00
std::string source;
float amount = 0; // always 0 to 1 <-- apply amount to modulator
2020-07-09 16:31:33 +02:00
std::string toString() const;
static VeNoMatrixTarget* fromString(const std::string& value);
};
2020-07-09 16:31:33 +02:00
//@todo rebuild to new unlimited implementation!
// and make compatible with the value class that is used for saving and sync the ValueTree...
class VeNoMatrix
{
public:
2020-07-09 16:31:33 +02:00
explicit VeNoMatrix (const std::string& processId);
~VeNoMatrix ();
void updateSlots ();
void addModulator (const std::string& name, Modulator* modulator);
void addModulateValue (const std::string& name, ModulateValue* modulateValue);
void removeModulator (const std::string& name);
void removeModulateValue (const std::string& name);
2020-07-09 16:31:33 +02:00
void setMatrixModulation(const std::string& name, const std::string& source, float amount);
std::unique_ptr<XmlElement> saveMatrixToXML();
void getMatrixFromXML(std::unique_ptr<XmlElement>& xml);
private:
std::unordered_map<std::string, Modulator*> m_modulators; //all sources
std::unordered_map<std::string, ModulateValue*> m_modulationValues;
2020-07-09 16:31:33 +02:00
std::unordered_map<std::string, VeNoMatrixTarget*> m_slots;
std::string m_processId;
2020-07-09 16:31:33 +02:00
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VeNoMatrix)
};
#endif //VENO_VENOMATRIX_H