commit a9a9a2670d61b88bffd6a67d141616c230d9d683
parent a8e358b2771aa00b533f52e91f405dceabdcd804
Author: Matt Demanett <matt@demanett.net>
Date: Sun, 26 Sep 2021 23:37:19 -0400
Rack2: get plugin to build.
Diffstat:
5 files changed, 78 insertions(+), 74 deletions(-)
diff --git a/src/dsp/filters/multimode.hpp b/src/dsp/filters/multimode.hpp
@@ -5,7 +5,7 @@
#include "filters/filter.hpp"
#ifdef RACK_SIMD
-#include "simd/vector.hpp"
+#include "simd/Vector.hpp"
using rack::simd::float_4;
#endif
diff --git a/src/mixer.cpp b/src/mixer.cpp
@@ -99,11 +99,12 @@ void DimmableMixerWidget::contextMenu(Menu* menu) {
}
-void MuteButton::randomize() {
- if (_randomize) {
- ToggleButton::randomize();
- }
-}
+// FIXME: this callback removed in rack2.
+// void MuteButton::randomize() {
+// if (_randomize) {
+// ToggleButton::randomize();
+// }
+// }
void MuteButton::onButton(const event::Button& e) {
if (!(e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0)) {
@@ -139,33 +140,34 @@ SoloMuteButton::SoloMuteButton() {
shadow->box.pos = Vec(0.0, 1.0);
}
-void SoloMuteButton::reset() {
- if (paramQuantity) {
- paramQuantity->setValue(0.0f);
- }
-}
-
-void SoloMuteButton::randomize() {
- if (paramQuantity) {
- paramQuantity->setValue(random::uniform() > 0.5f ? 1.0f : 0.0f);
- }
-}
+// FIXME: these callbacks removed in rack2.
+// void SoloMuteButton::reset() {
+// if (paramQuantity) {
+// getParamQuantity()->setValue(0.0f);
+// }
+// }
+//
+// void SoloMuteButton::randomize() {
+// if (paramQuantity) {
+// getParamQuantity()->setValue(random::uniform() > 0.5f ? 1.0f : 0.0f);
+// }
+// }
void SoloMuteButton::onButton(const event::Button& e) {
- if (!paramQuantity || !(e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0)) {
+ if (!getParamQuantity() || !(e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0)) {
ParamWidget::onButton(e);
return;
}
- float value = paramQuantity->getValue();
+ float value = getParamQuantity()->getValue();
if (value >= 2.0f) {
- paramQuantity->setValue(value - 2.0f);
+ getParamQuantity()->setValue(value - 2.0f);
}
else if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
- paramQuantity->setValue(value + 2.0f);
+ getParamQuantity()->setValue(value + 2.0f);
}
else {
- paramQuantity->setValue(value > 0.5f ? 0.0f : 1.0f);
+ getParamQuantity()->setValue(value > 0.5f ? 0.0f : 1.0f);
}
if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
@@ -177,8 +179,8 @@ void SoloMuteButton::onButton(const event::Button& e) {
void SoloMuteButton::onChange(const event::Change& e) {
assert(_frames.size() == 4);
- if (paramQuantity) {
- float value = paramQuantity->getValue();
+ if (getParamQuantity()) {
+ float value = getParamQuantity()->getValue();
assert(value >= 0.0f && value <= 3.0f);
_svgWidget->setSvg(_frames[(int)value]);
}
diff --git a/src/mixer.hpp b/src/mixer.hpp
@@ -80,7 +80,7 @@ struct MuteButton : ToggleButton {
}
inline void setRandomize(bool randomize) { _randomize = randomize; }
- void randomize() override;
+ // void randomize() override;
void onButton(const event::Button& e) override;
};
@@ -90,8 +90,8 @@ struct SoloMuteButton : ParamWidget {
CircularShadow* shadow = NULL;
SoloMuteButton();
- void reset() override;
- void randomize() override;
+ // void reset() override;
+ // void randomize() override;
void onButton(const event::Button& e) override;
void onChange(const event::Change& e) override;
};
diff --git a/src/widgets.cpp b/src/widgets.cpp
@@ -216,8 +216,8 @@ void IndicatorKnob::onHover(const event::Hover& e) {
void IndicatorKnob::onChange(const event::Change& e) {
fb->dirty = true;
- if (paramQuantity) {
- w->setAngle(paramQuantity->getValue());
+ if (getParamQuantity()) {
+ w->setAngle(getParamQuantity()->getValue());
}
Knob::onChange(e);
}
@@ -301,29 +301,30 @@ StatefulButton::StatefulButton(const char* offSvgPath, const char* onSvgPath) {
shadow->box.pos = Vec(0.0, 1.0);
}
-void StatefulButton::reset() {
- if (paramQuantity) {
- paramQuantity->reset();
- }
-}
-
-void StatefulButton::randomize() {
- if (paramQuantity) {
- float min = paramQuantity->getMinValue();
- float max = paramQuantity->getMaxValue();
- float value = roundf(min + (max - min) * random::uniform());
- paramQuantity->setValue(value);
- }
-}
+// FIXME: these callbacks removed in rack2.
+// void StatefulButton::reset() {
+// if (getParamQuantity()) {
+// getParamQuantity()->reset();
+// }
+// }
+//
+// void StatefulButton::randomize() {
+// if (getParamQuantity()) {
+// float min = getParamQuantity()->getMinValue();
+// float max = getParamQuantity()->getMaxValue();
+// float value = roundf(min + (max - min) * random::uniform());
+// getParamQuantity()->setValue(value);
+// }
+// }
void StatefulButton::onDragStart(const event::DragStart& e) {
- if (paramQuantity) {
+ if (getParamQuantity()) {
_svgWidget->setSvg(_frames[1]);
- if (paramQuantity->getValue() >= paramQuantity->getMaxValue()) {
- paramQuantity->setValue(paramQuantity->getMinValue());
+ if (getParamQuantity()->getValue() >= getParamQuantity()->getMaxValue()) {
+ getParamQuantity()->setValue(getParamQuantity()->getMinValue());
}
else {
- paramQuantity->setValue(paramQuantity->getValue() + 1.0);
+ getParamQuantity()->setValue(getParamQuantity()->getValue() + 1.0);
}
}
}
@@ -448,17 +449,18 @@ InvertingIndicatorButton::InvertingIndicatorButton(int dim) {
fb->addChild(w);
}
-void InvertingIndicatorButton::reset() {
- if (paramQuantity) {
- paramQuantity->reset();
- }
-}
-
-void InvertingIndicatorButton::randomize() {
- if (paramQuantity) {
- paramQuantity->setValue(roundf(2.0f * random::uniform()) - 1.0f);
- }
-}
+// FIXME: these callbacks removed in rack2.
+// void InvertingIndicatorButton::reset() {
+// if (getParamQuantity()) {
+// getParamQuantity()->reset();
+// }
+// }
+//
+// void InvertingIndicatorButton::randomize() {
+// if (getParamQuantity()) {
+// getParamQuantity()->setValue(roundf(2.0f * random::uniform()) - 1.0f);
+// }
+// }
void InvertingIndicatorButton::onHover(const event::Hover& e) {
math::Vec c = box.size.div(2);
@@ -470,32 +472,32 @@ void InvertingIndicatorButton::onHover(const event::Hover& e) {
void InvertingIndicatorButton::onButton(const event::Button& e) {
ParamWidget::onButton(e);
- if (!paramQuantity || !(e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0) || e.button == GLFW_MOUSE_BUTTON_RIGHT) {
+ if (!getParamQuantity() || !(e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0) || e.button == GLFW_MOUSE_BUTTON_RIGHT) {
return;
}
- float value = paramQuantity->getValue();
+ float value = getParamQuantity()->getValue();
if (value <= -1.0f) {
- paramQuantity->setValue(0.0f);
+ getParamQuantity()->setValue(0.0f);
}
else if (value < 1.0f) {
- paramQuantity->setValue(1.0f);
+ getParamQuantity()->setValue(1.0f);
}
- else if (paramQuantity->minValue < 0.0f && (!clickToInvertCB || clickToInvertCB())) {
- paramQuantity->setValue(-1.0f);
+ else if (getParamQuantity()->minValue < 0.0f && (!clickToInvertCB || clickToInvertCB())) {
+ getParamQuantity()->setValue(-1.0f);
}
else {
- paramQuantity->setValue(0.0f);
+ getParamQuantity()->setValue(0.0f);
}
}
void InvertingIndicatorButton::onChange(const event::Change& e) {
fb->dirty = true;
- if (paramQuantity) {
- float v = paramQuantity->getValue();
+ if (getParamQuantity()) {
+ float v = getParamQuantity()->getValue();
w->setValue(v);
if (onChangeCB) {
- onChangeCB(paramQuantity->paramId, v);
+ onChangeCB(getParamQuantity()->paramId, v);
}
}
ParamWidget::onChange(e);
@@ -518,8 +520,8 @@ NVGcolor bogaudio::decibelsToColor(float db) {
void VUSlider::draw(const DrawArgs& args) {
float level = 0.0f;
- if (paramQuantity) {
- level = paramQuantity->getValue();
+ if (getParamQuantity()) {
+ level = getParamQuantity()->getValue();
}
else {
float minDb = -60.0f;
diff --git a/src/widgets.hpp b/src/widgets.hpp
@@ -118,8 +118,8 @@ struct StatefulButton : ParamWidget {
CircularShadow* shadow = NULL;
StatefulButton(const char* offSvgPath, const char* onSvgPath);
- void reset() override;
- void randomize() override;
+ // void reset() override;
+ // void randomize() override;
void onDragStart(const event::DragStart& e) override;
void onDragEnd(const event::DragEnd& e) override;
void onDoubleClick(const event::DoubleClick& e) override {}
@@ -165,8 +165,8 @@ struct InvertingIndicatorButton : ParamWidget {
inline void setClickToInvertCallback(std::function<bool()> fn) { clickToInvertCB = fn; }
inline void setOnChangeCallback(std::function<void(int, float)> fn) { onChangeCB = fn; }
- void reset() override;
- void randomize() override;
+ // void reset() override;
+ // void randomize() override;
void onHover(const event::Hover& e) override;
void onDoubleClick(const event::DoubleClick& e) override {}
void onButton(const event::Button& e) override;