Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v2 API #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RACK_DIR ?= ../..
# FLAGS will be passed to both the C and C++ compiler
FLAGS +=
CFLAGS +=
CXXFLAGS += -Idep
CXXFLAGS += -Idep/QuickJS

# Careful about linking to shared libraries, since you can't assume much about the user's environment and library search path.
# Static libraries are fine, but they should be added to this plugin's build system.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hiya hello hey hi what’s hip love, I’m Aria Salvatrice. I’m a French expat
I make [Gay Baroque Technopop](https://soundcloud.com/ariasalvatrice) and [Pastoral Industrial](https://ariasalvatrice.bandcamp.com/) music happen, and made a buncha virtual synth modules for my own use.
They are the Aria Salvatrice Signature Series. They’re growing into an integrated system for performing aleatoric techno. Lotsa artists found them inspiring for many genres of music. You can grab them for free!

They are part of [Cardinal](https://github.com/DISTRHO/Cardinal), which is currently the only supportedh ost.
They are part of [Cardinal](https://github.com/DISTRHO/Cardinal), which is currently the only supported host.

They are not supported in VCV Rack 2, due to [their behavior towards third-party contributors, and inclusion of women](https://aria.dog/barks/why-i-will-never-create-modules-for-vcv-rack-anymore/). Bug reports you cannot reproduce in a supported host will not be accepted.

Expand Down
24 changes: 14 additions & 10 deletions src/Darius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ struct Darius : Module {
configParam(KEY_PARAM, 0.f, 11.f, 0.f, "Key");
configParam(SCALE_PARAM, 0.f, (float) Quantizer::NUM_SCALES - 1, 2.f, "Scale");
configParam(SLIDE_PARAM, 0.f, 10.f, 0.f, "Slide");
for (size_t i = 0; i < STEP9START; i++)
for (size_t i = 0; i < 36; i++)
configParam(CV_PARAM + i, 0.f, 10.f, 5.f, "CV");
for (size_t i = 0; i < STEP8START; i++)
for (size_t i = 0; i < 36; i++)
configParam(ROUTE_PARAM + i, 0.f, 1.f, 0.5f, "Random route");
displayDivider.setDivision(DISPLAYDIVIDER);
processDivider.setDivision(PROCESSDIVIDER);
Expand Down Expand Up @@ -1024,40 +1024,44 @@ struct Darius : Module {

struct KnobLcd : W::Knob {
void onDragMove(const event::DragMove& e) override {
dynamic_cast<Darius*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Darius*>(paramQuantity->module)->lcdStatus.dirty = true;
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Darius*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Darius*>(paramQuantity->module)->lcdStatus.dirty = true;
W::Knob::onDragMove(e);
}
};


struct KnobMinMax : KnobLcd {
void onDragMove(const event::DragMove& e) override {
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = MINMAX_MODE;
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = MINMAX_MODE;
KnobLcd::onDragMove(e);
}
};

struct KnobScale : KnobLcd {
KnobScale() {
snap = true;
KnobLcd();
}
void onDragMove(const event::DragMove& e) override {
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = SCALE_MODE;
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = SCALE_MODE;
KnobLcd::onDragMove(e);
}
};

struct KnobSlide : KnobLcd {
void onDragMove(const event::DragMove& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = SLIDE_MODE;
KnobLcd::onDragMove(e);
}
};

struct RockerSwitchHorizontalModeReset : W::RockerSwitchHorizontal {
void onDragStart(const event::DragStart& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Darius*>(paramQuantity->module)->lcdMode = DEFAULT_MODE;
dynamic_cast<Darius*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Darius*>(paramQuantity->module)->lcdStatus.dirty = true;
Expand All @@ -1078,9 +1082,9 @@ template <class TParamWidget>
TParamWidget* createMainParam(math::Vec pos, Darius* module, int paramId, int lastChanged) {
TParamWidget* o = new TParamWidget(module, lastChanged);
o->box.pos = pos;
if (module) {
o->paramQuantity = module->paramQuantities[paramId];
}
o->app::ParamWidget::module = module;
o->app::ParamWidget::paramId = paramId;
o->initParamQuantity();
return o;
}

Expand Down
24 changes: 14 additions & 10 deletions src/Psychopump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,10 @@ struct PsychopumpWidget : W::ModuleWidget {
GateLabelButton* gateLabelButton = new GateLabelButton;
gateLabelButton->box.pos = mm2px(Vec(xOffset + 4.1f, yOffset + i * 10.f));
gateLabelButton->channel = i;
if (module) {
gateLabelButton->module = module;
gateLabelButton->paramQuantity = module->paramQuantities[Psychopump::CHANNEL_LABEL_PARAM + i];
}
gateLabelButton->module = module;
gateLabelButton->app::ParamWidget::module = module;
gateLabelButton->app::ParamWidget::paramId = Psychopump::CHANNEL_LABEL_PARAM + i;
gateLabelButton->initParamQuantity();
addParam(gateLabelButton);
addStaticInput(mm2px(Vec(xOffset, yOffset + i * 10.f)), module, Psychopump::GATE_INPUT + i);
}
Expand All @@ -1116,7 +1116,9 @@ struct PsychopumpWidget : W::ModuleWidget {
gateLengthKnob->module = module;
gateLengthKnob->box.pos = mm2px(Vec(xOffset, yOffset + i * 10.f));
gateLengthKnob->channel = i;
if (module) gateLengthKnob->paramQuantity = module->paramQuantities[Psychopump::GATE_LENGTH_PARAM + i];
gateLengthKnob->app::ParamWidget::module = module;
gateLengthKnob->app::ParamWidget::paramId = Psychopump::GATE_LENGTH_PARAM + i;
gateLengthKnob->initParamQuantity();
addParam(gateLengthKnob);
}
}
Expand Down Expand Up @@ -1166,7 +1168,9 @@ struct PsychopumpWidget : W::ModuleWidget {
CvKnob* cvKnob = new CvKnob;
cvKnob->module = module;
cvKnob->box.pos = mm2px(Vec(xOffset, yOffset));
if (module) cvKnob->paramQuantity = module->paramQuantities[cvParam];
cvKnob->app::ParamWidget::module = module;
cvKnob->app::ParamWidget::paramId = cvParam;
cvKnob->initParamQuantity();
cvKnob->channel = channel;
cvKnob->output = output;
addParam(cvKnob);
Expand Down Expand Up @@ -1206,10 +1210,10 @@ struct PsychopumpWidget : W::ModuleWidget {
OutputLabelButton* outputLabelButton = new OutputLabelButton;
outputLabelButton->box.pos = mm2px(Vec(xOffset + i * 14.f, yOffset + 4.1f));
outputLabelButton->output = i;
if (module) {
outputLabelButton->module = module;
outputLabelButton->paramQuantity = module->paramQuantities[Psychopump::OUTPUT_LABEL_PARAM + i];
}
outputLabelButton->module = module;
outputLabelButton->app::ParamWidget::module = module;
outputLabelButton->app::ParamWidget::paramId = Psychopump::OUTPUT_LABEL_PARAM + i;
outputLabelButton->initParamQuantity();
addParam(outputLabelButton);
}

Expand Down
18 changes: 15 additions & 3 deletions src/Qqqq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,9 @@ namespace QqqqWidgets {
// The LCD knobs
struct LcdKnob : W::Knob {
void onDragMove(const event::DragMove& e) override {
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdStatus.dirty = true;
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdStatus.dirty = true;
W::Knob::onDragMove(e);
}
};
Expand All @@ -783,19 +784,22 @@ struct ScaleKnob : LcdKnob {
LcdKnob();
}
void onDragMove(const event::DragMove& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = SCALE_MODE;
LcdKnob::onDragMove(e);
}
};
struct ScalingKnob : LcdKnob {
void onDragMove(const event::DragMove& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = SCALING_MODE;
dynamic_cast<Qqqq*>(paramQuantity->module)->lastScalingKnobTouchedId = paramQuantity->paramId;
LcdKnob::onDragMove(e);
}
};
struct OffsetKnob : LcdKnob {
void onDragMove(const event::DragMove& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = OFFSET_MODE;
dynamic_cast<Qqqq*>(paramQuantity->module)->lastOffsetKnobTouchedId = paramQuantity->paramId;
LcdKnob::onDragMove(e);
Expand All @@ -807,6 +811,7 @@ struct TransposeKnob : LcdKnob {
LcdKnob();
}
void onDragMove(const event::DragMove& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = TRANSPOSE_MODE;
dynamic_cast<Qqqq*>(paramQuantity->module)->lastTransposeKnobTouchedId = paramQuantity->paramId;
LcdKnob::onDragMove(e);
Expand All @@ -815,6 +820,7 @@ struct TransposeKnob : LcdKnob {
// The LCD buttons. They're not sending ongoing events so no point setting Lcd dirty from here.
struct TransposeButton : W::SmallButton {
void onDragStart(const event::DragStart& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = TRANSPOSE_TYPE_MODE;
dynamic_cast<Qqqq*>(paramQuantity->module)->lastTransposeModeTouchedId = paramQuantity->paramId;
Expand All @@ -823,6 +829,7 @@ struct TransposeButton : W::SmallButton {
};
struct ShButton : W::SmallButton {
void onDragStart(const event::DragStart& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = SH_MODE;
dynamic_cast<Qqqq*>(paramQuantity->module)->lastShTouchedId = paramQuantity->paramId;
Expand All @@ -831,6 +838,7 @@ struct ShButton : W::SmallButton {
};
struct VisualizeButton : W::ButtonPink {
void onDragStart(const event::DragStart& e) override {
ParamQuantity* const paramQuantity = getParamQuantity();
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdLastInteraction = 0.f;
dynamic_cast<Qqqq*>(paramQuantity->module)->lcdMode = VISUALIZE_MODE;
W::ButtonPink::onDragStart(e);
Expand All @@ -845,7 +853,7 @@ struct PianoKey : W::LitSvgSwitchUnshadowed {
int note = 0;

void step() override {
if (paramQuantity){
if (ParamQuantity* const paramQuantity = getParamQuantity()){
currentPianoDisplay = dynamic_cast<Qqqq*>(paramQuantity->module)->litKeys[note];
if (currentPianoDisplay == true && currentPianoDisplay != lastPianoDisplay) {
lsw->setSvg(frames[2]);
Expand Down Expand Up @@ -982,6 +990,8 @@ struct PushButtonKeyboard : W::SvgSwitchUnshadowed {

ui::Menu* menu = createMenu();

ParamQuantity* const paramQuantity = getParamQuantity();

LeadSheetField* lsf = new LeadSheetField();
lsf->module = dynamic_cast<Qqqq*>(paramQuantity->module);
menu->addChild(createMenuLabel("Import chords (lead sheet notation):"));
Expand Down Expand Up @@ -1028,6 +1038,8 @@ struct SceneButton : W::LitSvgSwitchUnshadowed {
if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
ui::Menu* menu = createMenu();

ParamQuantity* const paramQuantity = getParamQuantity();

CopyScenePortableSequenceItem *copyScenePortableSequenceItem = new CopyScenePortableSequenceItem();
copyScenePortableSequenceItem->text = "Copy Scene";
copyScenePortableSequenceItem->slot = paramQuantity->paramId - Qqqq::SCENE_BUTTON_PARAM;
Expand Down
5 changes: 5 additions & 0 deletions src/Smerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ struct Smerge : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
ledDivider.setDivision(256);
configParam(SORT_PARAM, 0.f, 1.f, 0.f, "Sort voltages");
configInput(LINK_INPUT, "Link");
for (int i = 0; i < 16; i++)
configInput(MERGE_INPUT + i, string::f("Channel %d", i + 1));
configOutput(POLY_OUTPUT, "Poly");
configOutput(LINK_OUTPUT, "Link");
}

// Merge without sorting, faster
Expand Down
42 changes: 37 additions & 5 deletions src/Solomon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,35 @@ struct Solomon : Module {
Solomon() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);

configInput(EXT_SCALE_INPUT, "External scale");
configInput(STEP_QUEUE_INPUT, "Step: Queue");
configInput(STEP_TELEPORT_INPUT, "Step: Teleport");
configInput(STEP_WALK_INPUT, "Step: Walk");
configInput(STEP_BACK_INPUT, "Step: Back");
configInput(STEP_FORWARD_INPUT, "Step: Forward");
configInput(RESET_INPUT, "Reset");

configOutput(GLOBAL_TRIG_OUTPUT, "Trigger");
configOutput(GLOBAL_CV_OUTPUT, "1V/Octave pitch");

for (unsigned i=0; i<NODES; i++) {
configInput(NODE_SUB_1_SD_INPUT + i, string::f("Step %d: Sub 1", i + 1));
configInput(NODE_SUB_2_SD_INPUT + i, string::f("Step %d: Sub 2", i + 1));
configInput(NODE_SUB_3_SD_INPUT + i, string::f("Step %d: Sub 3", i + 1));
configInput(NODE_SUB_1_OCT_INPUT + i, string::f("Step %d: Sub Oct", i + 1));
configInput(NODE_ADD_1_SD_INPUT + i, string::f("Step %d: Add 1", i + 1));
configInput(NODE_ADD_2_SD_INPUT + i, string::f("Step %d: Add 2", i + 1));
configInput(NODE_ADD_3_SD_INPUT + i, string::f("Step %d: Add 3", i + 1));
configInput(NODE_ADD_1_OCT_INPUT + i, string::f("Step %d: Add Oct", i + 1));
configInput(NODE_QUEUE_INPUT + i, string::f("Step %d: Queue", i + 1));

configOutput(NODE_GATE_OUTPUT + i, string::f("Step %d: Gate", i + 1));
configOutput(NODE_RANDOM_OUTPUT + i, string::f("Step %d: Random", i + 1));
configOutput(NODE_LATCH_OUTPUT + i, string::f("Step %d: Latch", i + 1));
configOutput(NODE_DELAY_OUTPUT + i, string::f("Step %d: Delay", i + 1));
configOutput(NODE_CV_OUTPUT + i, string::f("Step %d: CV", i + 1));
}

configParam(MIN_PARAM, 1.f, 9.f, 3.f, "Minimum Note");
configParam(MAX_PARAM, 1.f, 9.f, 5.f, "Maximum Note");
configParam(SLIDE_PARAM, 0.f, 10.f, 0.f, "Slide");
Expand Down Expand Up @@ -787,7 +816,7 @@ struct Solomon : Module {
template <typename TModule>
struct TotalNodesKnob : W::KnobSnap {
void onDragMove(const event::DragMove& e) override {
TModule* module = dynamic_cast<TModule*>(paramQuantity->module);
TModule* module = dynamic_cast<TModule*>(getParamQuantity()->module);

module->lcdStatus.lastInteraction = 0.f;
module->lcdStatus.dirty = true;
Expand All @@ -803,7 +832,7 @@ struct TotalNodesKnob : W::KnobSnap {
template <typename TModule>
struct ScaleKnob : W::KnobSnap {
void onDragMove(const event::DragMove& e) override {
TModule* module = dynamic_cast<TModule*>(paramQuantity->module);
TModule* module = dynamic_cast<TModule*>(getParamQuantity()->module);

module->lcdStatus.lastInteraction = 0.f;
module->lcdStatus.dirty = true;
Expand Down Expand Up @@ -831,7 +860,7 @@ struct ScaleKnob : W::KnobSnap {
template <typename TModule>
struct MinMaxKnob : W::Knob {
void onDragMove(const event::DragMove& e) override {
TModule* module = dynamic_cast<TModule*>(paramQuantity->module);
TModule* module = dynamic_cast<TModule*>(getParamQuantity()->module);

module->lcdStatus.lastInteraction = 0.f;
module->lcdStatus.dirty = true;
Expand All @@ -847,7 +876,7 @@ struct MinMaxKnob : W::Knob {
template <typename TModule>
struct SlideKnob : W::Knob {
void onDragMove(const event::DragMove& e) override {
TModule* module = dynamic_cast<TModule*>(paramQuantity->module);
TModule* module = dynamic_cast<TModule*>(getParamQuantity()->module);

module->lcdStatus.lastInteraction = 0.f;
module->lcdStatus.dirty = true;
Expand Down Expand Up @@ -885,7 +914,10 @@ struct SegmentDisplay : LightWidget {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/dseg/DSEG14ClassicMini-Italic.ttf"));
}

void draw(const DrawArgs& args) override {
void drawLayer(const DrawArgs& args, int layer) override {
if (layer != 1)
return;

nvgFontSize(args.vg, 20);
nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, 2.0);
Expand Down
6 changes: 6 additions & 0 deletions src/Spleet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ struct Spleet : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
ledDivider.setDivision(4096);
configParam(SORT_PARAM, 0.f, 1.f, 0.f, "Sort voltages on both banks");
for (int i = 0; i < 2; i++)
configInput(POLY_INPUT + i, string::f("Channel %d", i + 1));
for (int i = 0; i < 4; i++) {
configOutput(SPLIT_OUTPUT + i, string::f("Channel 1-%d", i + 1));
configOutput(SPLIT_OUTPUT + 4 + i, string::f("Channel 2-%d", i + 1));
}
}

// Split without sorting, faster
Expand Down
6 changes: 6 additions & 0 deletions src/Splirge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ struct Splirge : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
ledDivider.setDivision(4096);
configParam(SORT_PARAM, 0.f, 1.f, 0.f, "Sort voltages on both banks");
configInput(POLY_INPUT, "Poly");
for (int i = 0; i < 4; i++)
configInput(MERGE_INPUT + i, string::f("Channel %d", i + 1));
configOutput(POLY_OUTPUT, "Poly");
for (int i = 0; i < 4; i++)
configOutput(SPLIT_OUTPUT + i, string::f("Channel %d", i + 1));
}

// Merge without sorting, faster
Expand Down
5 changes: 5 additions & 0 deletions src/Splort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ struct Splort : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
ledDivider.setDivision(256);
configParam(SORT_PARAM, 0.f, 1.f, 0.f, "Sort voltages");
configInput(POLY_INPUT, "Poly");
configInput(LINK_INPUT, "Link");
for (int i = 0; i < 16; i++)
configOutput(SPLIT_OUTPUT + i, string::f("Channel %d", i + 1));
configOutput(LINK_OUTPUT, "Link");
}

// Split without sorting, faster
Expand Down
6 changes: 6 additions & 0 deletions src/Swerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ struct Swerge : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
ledDivider.setDivision(4096);
configParam(SORT_PARAM, 0.f, 1.f, 0.f, "Sort voltages on both banks");
for (int i = 0; i < 4; i++) {
configInput(MERGE_INPUT + i, string::f("Channel 1-%d", i + 1));
configInput(MERGE_INPUT + 4 + i, string::f("Channel 2-%d", i + 1));
}
for (int i = 0; i < 2; i++)
configOutput(POLY_OUTPUT + i, string::f("Channel %d", i + 1));
}

// Merge without sorting, faster
Expand Down
2 changes: 1 addition & 1 deletion src/Undular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct Undular : Module {
zActivated = (inputs[Z_INPUT].isConnected() and initialized) ? true : false;

if (positionChanged and initialized) APP->scene->rackScroll->offset = position;
if (zoomChanged and initialized) settings::zoom = newZoom;
if (zoomChanged and initialized) APP->scene->rackScroll->setZoom(std::pow(2.f, newZoom));
}

void processCableInputs() {
Expand Down
Loading