diff --git a/plugin.json b/plugin.json index 0f4e2e6..cdc03dd 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "slug": "Loco", "name": "LocoMods", - "version": "1.1.1", + "version": "2.1.1", "license": "Creative Commons - Reuse and modify with attribution", "brand": "Loco", "author": "Luke Perkin", @@ -28,4 +28,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/src/Chaos.cpp b/src/Chaos.cpp index ded2629..6407aa3 100644 --- a/src/Chaos.cpp +++ b/src/Chaos.cpp @@ -87,10 +87,15 @@ struct ChaosModule : Module { ChaosModule() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - configParam(GRAVITY_PARAM, 0.01f, 6.f, 1.0f, "timewarp", "x"); - configParam(LENGTH_RATIO_PARAM, 0.1f, 1.0f - 0.1f, 0.5f, "ratio", ""); - configParam(DAMPING_PARAM, 0.0f, 1.f, 0.0f, "dampen", ""); + configParam(GRAVITY_PARAM, 0.01f, 6.f, 1.0f, "Timewarp", "x"); + configParam(LENGTH_RATIO_PARAM, 0.1f, 1.0f - 0.1f, 0.5f, "Ratio", ""); + configParam(DAMPING_PARAM, 0.0f, 1.f, 0.0f, "Dampen", ""); configParam(KICK_PARAM, 0.f, 1.f, 0.f); + configInput(GRAVITY_IN, "Timewarp CV"); + configInput(RATIO_IN, "Ratio CV"); + configInput(DAMPING_IN, "Damping CV"); + configInput(KICK_TRIG_IN, "Kick trigger"); + configOutput(POLY_CHAOS_OUTPUT, "Poly chaos"); integrationMode = IntegrationMode::RK4; kickMode = KickMode::ClearVelocity; } @@ -253,9 +258,8 @@ struct ChaosModule : Module { struct PendulumWidget : OpaqueWidget { ChaosModule* module; - void draw(const DrawArgs &args) override { - OpaqueWidget::draw(args); - if (module) { + void drawLayer(const DrawArgs& args, int layer) override { + if (module && layer == 1) { const float maxLen = 80.0f; const float center = 105.f; float p0_x = (module->p0.x * maxLen) + center; @@ -281,13 +285,14 @@ struct PendulumWidget : OpaqueWidget { nvgClosePath(args.vg); nvgStroke(args.vg); } + Widget::drawLayer(args, layer); } }; struct ChaosWidget : ModuleWidget { ChaosWidget(ChaosModule* module) { setModule(module); - setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Chaos.svg"))); + setPanel(createPanel(asset::plugin(pluginInstance, "res/Chaos.svg"))); addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); @@ -394,4 +399,4 @@ struct ChaosWidget : ModuleWidget { }; -Model* modelChaos = createModel("Chaos"); \ No newline at end of file +Model* modelChaos = createModel("Chaos"); diff --git a/src/Tex.cpp b/src/Tex.cpp index 875a199..05d5d1e 100644 --- a/src/Tex.cpp +++ b/src/Tex.cpp @@ -55,9 +55,18 @@ struct TexModule : Module { TexModule() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - configParam(X_OFFSET, 0.f, VOLT_MAX, 0.f, "x offset", "volts"); - configParam(Y_OFFSET, 0.f, VOLT_MAX, 0.f, "y offset", "volts"); - configParam(AUTO, 0.f, 1.f, 0.f); + configParam(X_OFFSET, 0.f, VOLT_MAX, 0.f, "X offset", " volts"); + configParam(Y_OFFSET, 0.f, VOLT_MAX, 0.f, "Y offset", " volts"); + configSwitch(AUTO, 0.f, 1.f, 0.f, "Auto"); + configInput(X_INPUT, "X"); + configInput(Y_INPUT, "Y"); + configInput(TRIG_INPUT, "Trigger"); + configOutput(RED_OUTPUT, "Red"); + configOutput(GREEN_OUTPUT, "Green"); + configOutput(BLUE_OUTPUT, "Blue"); + configOutput(HUE_OUTPUT, "Hue"); + configOutput(SATURATION_OUTPUT, "Saturation"); + configOutput(LEVEL_OUTPUT, "Level"); } json_t *dataToJson() override { @@ -88,7 +97,6 @@ struct TexModule : Module { uint uncroppedImageHeight; uint error = lodepng::decode(uncroppedImage, uncroppedImageWidth, uncroppedImageHeight, path, LCT_RGB); if (error != 0) { - std::cout << "error " << error << ": " << lodepng_error_text(error) << std::endl; lastImagePath = ""; bImageLoaded = false; } else { @@ -223,9 +231,8 @@ struct TexModuleImageDisplay : OpaqueWidget { bool bLoadedImage = false; - void draw(const DrawArgs &args) override { - OpaqueWidget::draw(args); - if (module) { + void drawLayer(const DrawArgs& args, int layer) override { + if (module && layer == 1) { if (module->bImageLoaded && (imagePath != module->lastImagePath)) { imageHandle = nvgCreateImage(args.vg, module->lastImagePath.c_str(), 0); imagePath = module->lastImagePath; @@ -241,15 +248,15 @@ struct TexModuleImageDisplay : OpaqueWidget { nvgFill(args.vg); nvgClosePath(args.vg); } + Widget::drawLayer(args, layer); } }; struct TexModuleCrosshair : OpaqueWidget { TexModule* module; - void draw(const DrawArgs &args) override { - OpaqueWidget::draw(args); - if (module) { + void drawLayer(const DrawArgs& args, int layer) override { + if (layer == 1) { const float size = IMG_WIDTH; nvgBeginPath(args.vg); nvgStrokeWidth(args.vg, 1); @@ -263,13 +270,14 @@ struct TexModuleCrosshair : OpaqueWidget { nvgClosePath(args.vg); nvgStroke(args.vg); } + Widget::drawLayer(args, layer); } }; struct TexModuleWidget : ModuleWidget { TexModuleWidget(TexModule* module) { setModule(module); - setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Tex.svg"))); + setPanel(createPanel(asset::plugin(pluginInstance, "res/Tex.svg"))); addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); @@ -326,7 +334,7 @@ struct TexModuleWidget : ModuleWidget { TexModule *module; void onAction(const event::Action &e) override { MenuItem::onAction(e); - std::string dir = module->lastImagePath.empty() ? asset::user("") : rack::string::directory(module->lastImagePath); + std::string dir = module->lastImagePath.empty() ? asset::user("") : system::getDirectory(module->lastImagePath); char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, NULL); if (path) { module->loadImage(path); @@ -344,4 +352,4 @@ struct TexModuleWidget : ModuleWidget { }; -Model* modelTex = createModel("Tex"); \ No newline at end of file +Model* modelTex = createModel("Tex");