-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
502 additions
and
502 deletions.
There are no files selected for viewing
Submodule juce_organicui
updated
9 files
+1 −1 | controllable/Controllable.h | |
+57 −57 | controllable/Trigger.h | |
+1 −1 | controllable/parameter/EnumParameter.h | |
+91 −91 | controllable/parameter/gradient/GradientColorManager.h | |
+54 −54 | dashboard/Dashboard.h | |
+1 −1 | engine/Engine.h | |
+2 −2 | inspectable/Inspectable.h | |
+1 −1 | manager/BaseItem.h | |
+137 −137 | remotecontrol/OSCRemoteControl.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,181 +1,181 @@ | ||
/* | ||
============================================================================== | ||
ParameterLink.h | ||
Created: 21 Dec 2020 11:12:38pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "JuceHeader.h" | ||
#include "Common/Processor/Multiplex/MultiplexTarget.h" | ||
|
||
class BaseMultiplexList; | ||
class CVPresetMultiplexList; | ||
|
||
class ParameterLink : | ||
public MultiplexTarget, | ||
public MultiplexListListener, | ||
public Inspectable::InspectableListener | ||
{ | ||
public: | ||
enum LinkType { NONE, MAPPING_INPUT, MULTIPLEX_LIST, INDEX, INDEX_ZERO, CV_PRESET_PARAM }; | ||
|
||
ParameterLink(WeakReference<Parameter> p, Multiplex * multiplex = nullptr); | ||
~ParameterLink(); | ||
|
||
bool isLinkable; | ||
bool canLinkToMapping; | ||
bool isLinkBeingDestroyed; | ||
|
||
LinkType linkType; | ||
WeakReference<Parameter> parameter; | ||
|
||
//links | ||
|
||
int mappingValueIndex; | ||
BaseMultiplexList* list; | ||
WeakReference<Inspectable> listRef; | ||
String presetParamName; | ||
bool fullPresetSelectMode; | ||
|
||
Array<var> mappingValues; | ||
StringArray inputValueNames; //this is also reference to how many mapping inputs are available | ||
|
||
bool replacementHasMappingInputToken; | ||
String replacementString; | ||
|
||
void multiplexCountChanged() override; | ||
void multiplexPreviewIndexChanged() override; | ||
|
||
void listItemUpdated(int multiplexIndex) override; | ||
|
||
void setLinkType(LinkType type); | ||
|
||
void setLinkedList(BaseMultiplexList* _list); | ||
void setLinkedPresetParam(CVPresetMultiplexList* list, const String& paramName); | ||
|
||
var getLinkedValue(int multiplexIndex = 0); | ||
|
||
//For target parameters | ||
WeakReference<Controllable> getLinkedTarget(int multiplexIndex); | ||
WeakReference<ControllableContainer> getLinkedTargetContainer(int multiplexIndex); | ||
|
||
void updateMappingInputValue(var value, int multiplexIndex); | ||
|
||
void setInputNamesFromParams(Array<Parameter*> params); | ||
|
||
String getReplacementString(int multiplexIndex); | ||
|
||
var getInputMappingValue(var value); | ||
|
||
void notifyLinkUpdated(); | ||
|
||
|
||
void setLinkFromScript(var data); | ||
|
||
var getJSONData(); | ||
void loadJSONData(var data); | ||
|
||
class ParameterLinkListener | ||
{ | ||
public: | ||
virtual ~ParameterLinkListener() {} | ||
virtual void linkUpdated(ParameterLink* pLink) {} | ||
virtual void listItemUpdated(ParameterLink * pLink, int multiplexIndex) {} | ||
}; | ||
|
||
ListenerList<ParameterLinkListener, Array<ParameterLinkListener*, CriticalSection>> parameterLinkListeners; | ||
void addParameterLinkListener(ParameterLinkListener* newListener) { parameterLinkListeners.add(newListener); } | ||
void removeParameterLinkListener(ParameterLinkListener* listener) { if(!isLinkBeingDestroyed) parameterLinkListeners.remove(listener); } | ||
|
||
DECLARE_ASYNC_EVENT(ParameterLink, ParameterLink, paramLink, ENUM_LIST(LINK_UPDATED, PREVIEW_UPDATED, INPUT_VALUE_UPDATED, LIST_ITEM_UPDATED), !isLinkBeingDestroyed) | ||
|
||
juce::WeakReference<ParameterLink>::Master masterReference; | ||
|
||
}; | ||
|
||
|
||
class ParamLinkContainer : | ||
public ControllableContainer, | ||
public MultiplexTarget, | ||
public ParameterLink::ParameterLinkListener | ||
{ | ||
public: | ||
ParamLinkContainer(const String& name, Multiplex * multiplex); | ||
virtual ~ParamLinkContainer(); | ||
|
||
OwnedArray<ParameterLink> paramLinks; | ||
HashMap<Parameter*, ParameterLink*> paramLinkMap; | ||
HashMap<ParameterLink*, Parameter*> linkParamMap; | ||
StringArray inputNames; | ||
|
||
bool paramsCanBeLinked; | ||
bool canLinkToMapping; | ||
|
||
var linksGhostData; | ||
|
||
virtual void onControllableAdded(Controllable* c) override; | ||
virtual void onControllableRemoved(Controllable* c) override; | ||
|
||
virtual ParameterLink* getLinkedParam(Parameter* p); | ||
virtual var getLinkedValue(Parameter* p, int multiplexIndex); | ||
|
||
virtual void linkUpdated(ParameterLink* p) override; | ||
virtual void listItemUpdated(ParameterLink* p, int multiplexIndex) override; | ||
|
||
|
||
template<class T> | ||
T* getLinkedTargetAs(TargetParameter* target, int multiplexIndex) | ||
{ | ||
if (target == nullptr) return nullptr; | ||
|
||
if (paramsCanBeLinked) | ||
{ | ||
if (ParameterLink* pl = getLinkedParam(target)) return dynamic_cast<T*>(pl->getLinkedTarget(multiplexIndex).get()); | ||
} | ||
|
||
return dynamic_cast<T*>(target->target.get()); | ||
} | ||
|
||
template<class T> | ||
T* getLinkedTargetContainerAs(TargetParameter * target, int multiplexIndex) | ||
{ | ||
if (paramsCanBeLinked) | ||
{ | ||
if (ParameterLink* pl = getLinkedParam(target)) return dynamic_cast<T*>(pl->getLinkedTargetContainer(multiplexIndex).get()); | ||
} | ||
|
||
return dynamic_cast<T*>(target->targetContainer.get()); | ||
} | ||
|
||
virtual void linkParamToMappingIndex(Parameter* p, int mappingIndex); | ||
|
||
static var linkParamToMappingIndexFromScript(const var::NativeFunctionArgs& a); | ||
static var setParamLinkFromScript(const var::NativeFunctionArgs& a); | ||
static var unlinkParamFromScript(const var::NativeFunctionArgs& a); | ||
|
||
static ParameterLink* getLinkedParamFromScript(const var::NativeFunctionArgs& a); | ||
|
||
virtual void setInputNamesFromParams(Array<WeakReference<Parameter>> outParams); | ||
|
||
class ParamLinkContainerListener | ||
{ | ||
public: | ||
virtual ~ParamLinkContainerListener() {} | ||
virtual void linkUpdated(ParamLinkContainer* container, ParameterLink* pLink) {} | ||
virtual void listItemUpdated(ParamLinkContainer * container, ParameterLink* pLink, int multiplexIndex) {} | ||
}; | ||
|
||
|
||
DECLARE_INSPECTACLE_CRITICAL_LISTENER(ParamLinkContainer, paramLinkContainer); | ||
|
||
virtual var getJSONData() override; | ||
virtual void loadJSONDataInternal(var data) override; | ||
|
||
virtual InspectableEditor* getEditorInternal(bool isRoot, Array<Inspectable*> inspectables = Array<Inspectable*>()) override; | ||
|
||
}; | ||
/* | ||
============================================================================== | ||
ParameterLink.h | ||
Created: 21 Dec 2020 11:12:38pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "JuceHeader.h" | ||
#include "Common/Processor/Multiplex/MultiplexTarget.h" | ||
|
||
class BaseMultiplexList; | ||
class CVPresetMultiplexList; | ||
|
||
class ParameterLink : | ||
public MultiplexTarget, | ||
public MultiplexListListener, | ||
public Inspectable::InspectableListener | ||
{ | ||
public: | ||
enum LinkType { NONE, MAPPING_INPUT, MULTIPLEX_LIST, INDEX, INDEX_ZERO, CV_PRESET_PARAM }; | ||
|
||
ParameterLink(WeakReference<Parameter> p, Multiplex * multiplex = nullptr); | ||
~ParameterLink(); | ||
|
||
bool isLinkable; | ||
bool canLinkToMapping; | ||
bool isLinkBeingDestroyed; | ||
|
||
LinkType linkType; | ||
WeakReference<Parameter> parameter; | ||
|
||
//links | ||
|
||
int mappingValueIndex; | ||
BaseMultiplexList* list; | ||
WeakReference<Inspectable> listRef; | ||
String presetParamName; | ||
bool fullPresetSelectMode; | ||
|
||
Array<var> mappingValues; | ||
StringArray inputValueNames; //this is also reference to how many mapping inputs are available | ||
|
||
bool replacementHasMappingInputToken; | ||
String replacementString; | ||
|
||
void multiplexCountChanged() override; | ||
void multiplexPreviewIndexChanged() override; | ||
|
||
void listItemUpdated(int multiplexIndex) override; | ||
|
||
void setLinkType(LinkType type); | ||
|
||
void setLinkedList(BaseMultiplexList* _list); | ||
void setLinkedPresetParam(CVPresetMultiplexList* list, const String& paramName); | ||
|
||
var getLinkedValue(int multiplexIndex = 0); | ||
|
||
//For target parameters | ||
WeakReference<Controllable> getLinkedTarget(int multiplexIndex); | ||
WeakReference<ControllableContainer> getLinkedTargetContainer(int multiplexIndex); | ||
|
||
void updateMappingInputValue(var value, int multiplexIndex); | ||
|
||
void setInputNamesFromParams(Array<Parameter*> params); | ||
|
||
String getReplacementString(int multiplexIndex); | ||
|
||
var getInputMappingValue(var value); | ||
|
||
void notifyLinkUpdated(); | ||
|
||
|
||
void setLinkFromScript(var data); | ||
|
||
var getJSONData(); | ||
void loadJSONData(var data); | ||
|
||
class ParameterLinkListener | ||
{ | ||
public: | ||
virtual ~ParameterLinkListener() {} | ||
virtual void linkUpdated(ParameterLink* pLink) {} | ||
virtual void listItemUpdated(ParameterLink * pLink, int multiplexIndex) {} | ||
}; | ||
|
||
ListenerList<ParameterLinkListener, Array<ParameterLinkListener*, CriticalSection>> parameterLinkListeners; | ||
void addParameterLinkListener(ParameterLinkListener* newListener) { parameterLinkListeners.add(newListener); } | ||
void removeParameterLinkListener(ParameterLinkListener* listener) { if(!isLinkBeingDestroyed) parameterLinkListeners.remove(listener); } | ||
|
||
DECLARE_ASYNC_EVENT(ParameterLink, ParameterLink, paramLink, ENUM_LIST(LINK_UPDATED, PREVIEW_UPDATED, INPUT_VALUE_UPDATED, LIST_ITEM_UPDATED), !isLinkBeingDestroyed) | ||
|
||
juce::WeakReference<ParameterLink>::Master masterReference; | ||
|
||
}; | ||
|
||
|
||
class ParamLinkContainer : | ||
public ControllableContainer, | ||
public MultiplexTarget, | ||
public ParameterLink::ParameterLinkListener | ||
{ | ||
public: | ||
ParamLinkContainer(const String& name, Multiplex * multiplex); | ||
virtual ~ParamLinkContainer(); | ||
|
||
OwnedArray<ParameterLink> paramLinks; | ||
HashMap<Parameter*, ParameterLink*> paramLinkMap; | ||
HashMap<ParameterLink*, Parameter*> linkParamMap; | ||
StringArray inputNames; | ||
|
||
bool paramsCanBeLinked; | ||
bool canLinkToMapping; | ||
|
||
var linksGhostData; | ||
|
||
virtual void onControllableAdded(Controllable* c) override; | ||
virtual void onControllableRemoved(Controllable* c) override; | ||
|
||
virtual ParameterLink* getLinkedParam(Parameter* p); | ||
virtual var getLinkedValue(Parameter* p, int multiplexIndex); | ||
|
||
virtual void linkUpdated(ParameterLink* p) override; | ||
virtual void listItemUpdated(ParameterLink* p, int multiplexIndex) override; | ||
|
||
|
||
template<class T> | ||
T* getLinkedTargetAs(TargetParameter* target, int multiplexIndex) | ||
{ | ||
if (target == nullptr) return nullptr; | ||
|
||
if (paramsCanBeLinked) | ||
{ | ||
if (ParameterLink* pl = getLinkedParam(target)) return dynamic_cast<T*>(pl->getLinkedTarget(multiplexIndex).get()); | ||
} | ||
|
||
return dynamic_cast<T*>(target->target.get()); | ||
} | ||
|
||
template<class T> | ||
T* getLinkedTargetContainerAs(TargetParameter * target, int multiplexIndex) | ||
{ | ||
if (paramsCanBeLinked) | ||
{ | ||
if (ParameterLink* pl = getLinkedParam(target)) return dynamic_cast<T*>(pl->getLinkedTargetContainer(multiplexIndex).get()); | ||
} | ||
|
||
return dynamic_cast<T*>(target->targetContainer.get()); | ||
} | ||
|
||
virtual void linkParamToMappingIndex(Parameter* p, int mappingIndex); | ||
|
||
static var linkParamToMappingIndexFromScript(const var::NativeFunctionArgs& a); | ||
static var setParamLinkFromScript(const var::NativeFunctionArgs& a); | ||
static var unlinkParamFromScript(const var::NativeFunctionArgs& a); | ||
|
||
static ParameterLink* getLinkedParamFromScript(const var::NativeFunctionArgs& a); | ||
|
||
virtual void setInputNamesFromParams(Array<WeakReference<Parameter>> outParams); | ||
|
||
class ParamLinkContainerListener | ||
{ | ||
public: | ||
virtual ~ParamLinkContainerListener() {} | ||
virtual void linkUpdated(ParamLinkContainer* container, ParameterLink* pLink) {} | ||
virtual void listItemUpdated(ParamLinkContainer * container, ParameterLink* pLink, int multiplexIndex) {} | ||
}; | ||
|
||
|
||
DECLARE_INSPECTACLE_SAFE_LISTENER(ParamLinkContainer, paramLinkContainer); | ||
|
||
virtual var getJSONData() override; | ||
virtual void loadJSONDataInternal(var data) override; | ||
|
||
virtual InspectableEditor* getEditorInternal(bool isRoot, Array<Inspectable*> inspectables = Array<Inspectable*>()) override; | ||
|
||
}; |
Oops, something went wrong.