@@ -37,6 +37,11 @@ struct ParamWidget : widget::OpaqueWidget { | |||||
void onLeave(const LeaveEvent& e) override; | void onLeave(const LeaveEvent& e) override; | ||||
void createContextMenu(); | void createContextMenu(); | ||||
/** Override to add custom menu items at the bottom of the parameter context menu. | |||||
It is recommended to add a MenuSeparator before other menu items. | |||||
menu->addChild(new MenuSeparator); | |||||
*/ | |||||
virtual void appendContextMenu(ui::Menu* menu) {} | virtual void appendContextMenu(ui::Menu* menu) {} | ||||
void resetAction(); | void resetAction(); | ||||
}; | }; | ||||
@@ -68,6 +68,7 @@ struct TExponentialFilter { | |||||
this->lambda = lambda; | this->lambda = lambda; | ||||
} | } | ||||
/** Sets \f$ \lambda = 1 / \tau \f$. */ | |||||
void setTau(T tau) { | void setTau(T tau) { | ||||
this->lambda = 1 / tau; | this->lambda = 1 / tau; | ||||
} | } | ||||
@@ -127,6 +128,7 @@ struct TPeakFilter { | |||||
typedef TPeakFilter<> PeakFilter; | typedef TPeakFilter<> PeakFilter; | ||||
/** Limits the derivative of the output by a rise and fall speed, in units/s. */ | |||||
template <typename T = float> | template <typename T = float> | ||||
struct TSlewLimiter { | struct TSlewLimiter { | ||||
T out = 0.f; | T out = 0.f; | ||||
@@ -153,6 +155,7 @@ struct TSlewLimiter { | |||||
typedef TSlewLimiter<> SlewLimiter; | typedef TSlewLimiter<> SlewLimiter; | ||||
/** Behaves like ExponentialFilter but with different lambas when the RHS of the ODE is positive or negative. */ | |||||
template <typename T = float> | template <typename T = float> | ||||
struct TExponentialSlewLimiter { | struct TExponentialSlewLimiter { | ||||
T out = 0.f; | T out = 0.f; | ||||
@@ -167,6 +170,10 @@ struct TExponentialSlewLimiter { | |||||
this->riseLambda = riseLambda; | this->riseLambda = riseLambda; | ||||
this->fallLambda = fallLambda; | this->fallLambda = fallLambda; | ||||
} | } | ||||
void setRiseFallTau(T riseTau, T fallTau) { | |||||
this->riseLambda = 1 / riseTau; | |||||
this->fallLambda = 1 / fallTau; | |||||
} | |||||
T process(T deltaTime, T in) { | T process(T deltaTime, T in) { | ||||
T lambda = simd::ifelse(in > out, riseLambda, fallLambda); | T lambda = simd::ifelse(in > out, riseLambda, fallLambda); | ||||
T y = out + (in - out) * lambda * deltaTime; | T y = out + (in - out) * lambda * deltaTime; | ||||
@@ -29,7 +29,6 @@ struct VuMeter { | |||||
} | } | ||||
}; | }; | ||||
DEPRECATED typedef VuMeter VUMeter; | DEPRECATED typedef VuMeter VUMeter; | ||||
@@ -83,6 +83,10 @@ struct Module { | |||||
void* producerMessage = NULL; | void* producerMessage = NULL; | ||||
void* consumerMessage = NULL; | void* consumerMessage = NULL; | ||||
bool messageFlipRequested = false; | bool messageFlipRequested = false; | ||||
void requestMessageFlip() { | |||||
messageFlipRequested = true; | |||||
} | |||||
}; | }; | ||||
Expander leftExpander; | Expander leftExpander; | ||||
@@ -280,6 +284,7 @@ struct Module { | |||||
Expander& getRightExpander() { | Expander& getRightExpander() { | ||||
return rightExpander; | return rightExpander; | ||||
} | } | ||||
/** Returns the left Expander if `side` is false, andright Expander if `side` is true. */ | |||||
Expander& getExpander(bool side) { | Expander& getExpander(bool side) { | ||||
return side ? rightExpander : leftExpander; | return side ? rightExpander : leftExpander; | ||||
} | } | ||||
@@ -327,6 +332,9 @@ struct Module { | |||||
virtual json_t* dataToJson() { | virtual json_t* dataToJson() { | ||||
return NULL; | return NULL; | ||||
} | } | ||||
/** Override to load internal data from the "data" property of the module's JSON object. | |||||
Not called if "data" property is not present. | |||||
*/ | |||||
virtual void dataFromJson(json_t* rootJ) {} | virtual void dataFromJson(json_t* rootJ) {} | ||||
/////////////////////// | /////////////////////// | ||||
@@ -64,7 +64,7 @@ struct ParamQuantity : Quantity { | |||||
bool snapEnabled = false; | bool snapEnabled = false; | ||||
Param* getParam(); | Param* getParam(); | ||||
/** If smoothEnabled is true, requests to the engine to smoothly set the value. */ | |||||
/** If smoothEnabled is true, requests to the engine to smoothly move to a target value each sample. */ | |||||
void setSmoothValue(float value); | void setSmoothValue(float value); | ||||
float getSmoothValue(); | float getSmoothValue(); | ||||
@@ -21,7 +21,7 @@ struct Port { | |||||
}; | }; | ||||
union { | union { | ||||
/** Number of polyphonic channels | /** Number of polyphonic channels | ||||
Unstable API. Use set/getChannels() instead. | |||||
DEPRECATED. Unstable API. Use set/getChannels() instead. | |||||
May be 0 to PORT_MAX_CHANNELS. | May be 0 to PORT_MAX_CHANNELS. | ||||
*/ | */ | ||||
uint8_t channels = 0; | uint8_t channels = 0; | ||||
@@ -28,6 +28,9 @@ struct Module; | |||||
namespace plugin { | namespace plugin { | ||||
/** Type information for a module. | |||||
Factory for Module and ModuleWidget. | |||||
*/ | |||||
struct Model { | struct Model { | ||||
Plugin* plugin = NULL; | Plugin* plugin = NULL; | ||||