Skip to content
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
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -28,4 +28,4 @@
]
}
]
}
}
21 changes: 13 additions & 8 deletions src/Chaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
Expand Down Expand Up @@ -394,4 +399,4 @@ struct ChaosWidget : ModuleWidget {
};


Model* modelChaos = createModel<ChaosModule, ChaosWidget>("Chaos");
Model* modelChaos = createModel<ChaosModule, ChaosWidget>("Chaos");
34 changes: 21 additions & 13 deletions src/Tex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
Expand Down Expand Up @@ -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);
Expand All @@ -344,4 +352,4 @@ struct TexModuleWidget : ModuleWidget {
};


Model* modelTex = createModel<TexModule, TexModuleWidget>("Tex");
Model* modelTex = createModel<TexModule, TexModuleWidget>("Tex");