commit eaa953579c31741f37b95a9319c065ba1afcce8f
parent 3ed7e3ab3e82c440248a719b933c2892d7e2d0c5
Author: Adam M <aemalone@gmail.com>
Date: Sun, 5 Jan 2020 20:33:59 -0600
Goly Penerator
Diffstat:
7 files changed, 183 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -30,10 +30,12 @@ SOURCES += $(wildcard src/ComputerscareSolyPequencer.cpp)
SOURCES += $(wildcard src/ComputerscareFolyPace.cpp)
SOURCES += $(wildcard src/ComputerscareBlank.cpp)
SOURCES += $(wildcard src/ComputerscareStolyFickPigure.cpp)
-
+SOURCES += $(wildcard src/ComputerscareGolyPenerator.cpp)
SOURCES += $(wildcard src/Computerscare.cpp)
SOURCES += $(wildcard src/dtpulse.cpp)
+SOURCES += $(wildcard src/golyFunctions.cpp)
+
# Add files to the ZIP package when running `make dist`
# The compiled plugin is automatically added.
diff --git a/plugin.json b/plugin.json
@@ -79,6 +79,11 @@
"name":"Stoly Fick Pigure",
"description":"Draw a stick figure",
"tags":["Visual","Polyphonic"]
+ },
+ {"slug":"computerscare-goly-penerator",
+ "name":"Goly Penerator",
+ "description":"Polyphonic constant CV signal generation",
+ "tags":["Polyphonic","Utility"]
}
]
}
\ No newline at end of file
diff --git a/src/Computerscare.cpp b/src/Computerscare.cpp
@@ -21,5 +21,7 @@ void init(Plugin *p) {
p->addModel(modelComputerscareFolyPace);
p->addModel(modelComputerscareBlank);
p->addModel(modelComputerscareStolyFickPigure);
+
+ p->addModel(modelComputerscareGolyPenerator);
}
diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp
@@ -39,6 +39,7 @@ extern Model *modelComputerscareSolyPequencer;
extern Model *modelComputerscareFolyPace;
extern Model *modelComputerscareStolyFickPigure;
extern Model *modelComputerscareBlank;
+extern Model *modelComputerscareGolyPenerator;
static const NVGcolor COLOR_COMPUTERSCARE_LIGHT_GREEN = nvgRGB(0xC0, 0xE7, 0xDE);
static const NVGcolor COLOR_COMPUTERSCARE_GREEN = nvgRGB(0x24, 0xc9, 0xa6);
diff --git a/src/ComputerscareGolyPenerator.cpp b/src/ComputerscareGolyPenerator.cpp
@@ -0,0 +1,130 @@
+#include "Computerscare.hpp"
+
+#include "dtpulse.hpp"
+#include "golyFunctions.hpp"
+
+struct ComputerscareGolyPenerator;
+
+const int numKnobs = 16;
+
+const int numToggles = 16;
+const int numOutputs = 16;
+
+
+/*
+ knob1: number of channels output 1-16
+ knob2: algorithm
+ knob3: param 1
+*/
+
+struct ComputerscareGolyPenerator : Module {
+ int counter = 0;
+ int numChannels=16;
+ ComputerscareSVGPanel* panelRef;
+ float currentValues[16]={0.f};
+ enum ParamIds {
+ KNOB,
+ TOGGLES = KNOB + numKnobs,
+ NUM_PARAMS = TOGGLES + numToggles
+
+ };
+ enum InputIds {
+ CHANNEL_INPUT,
+ NUM_INPUTS
+ };
+ enum OutputIds {
+ POLY_OUTPUT,
+ NUM_OUTPUTS = POLY_OUTPUT + numOutputs
+ };
+ enum LightIds {
+ NUM_LIGHTS
+ };
+
+
+ ComputerscareGolyPenerator() {
+
+ config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
+
+ configParam(KNOB,1.f,16.f,16.f,"Number of Output Channels");
+ configParam(KNOB +1,0.f,10.f,1.f,"Algorithm");
+
+
+ for (int i = 2; i < numKnobs; i++) {
+ configParam(KNOB + i, 0.0f, 10.0f, 0.0f);
+ configParam(KNOB + i, 0.f, 10.f, 0.f, "Channel " + std::to_string(i + 1) + " Voltage", " Volts");
+ }
+
+ }
+ void updateCurrents() {
+ for(int i = 0; i < numChannels; i++) {
+ currentValues[i]=(float)i;
+ }
+ }
+ void process(const ProcessArgs &args) override {
+ counter++;
+ if (counter > 5012) {
+ //printf("%f \n",random::uniform());
+ counter = 0;
+ //rect4032
+ //south facing high wall
+ updateCurrents();
+ numChannels=(params[KNOB].getValue());
+ }
+
+
+ outputs[POLY_OUTPUT].setChannels(numChannels);
+ for (int i = 0; i < 16; i++) {
+ outputs[POLY_OUTPUT].setVoltage(currentValues[i], i);
+ }
+ }
+
+};
+
+struct ComputerscareGolyPeneratorWidget : ModuleWidget {
+ ComputerscareGolyPeneratorWidget(ComputerscareGolyPenerator *module) {
+
+ setModule(module);
+ //setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareGolyPeneratorPanel.svg")));
+ box.size = Vec(4 * 15, 380);
+ {
+ ComputerscareSVGPanel *panel = new ComputerscareSVGPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareGolyPeneratorPanel.svg")));
+
+ //module->panelRef = panel;
+
+ addChild(panel);
+
+ }
+ float xx;
+ float yy;
+ for (int i = 0; i < numKnobs; i++) {
+ xx = 1.4f + 24.3 * (i-i % 8)/8;
+ yy = 64 + 37.5 * (i % 8) + 14.3 * (i - i % 8)/8;
+ addLabeledKnob(std::to_string(i + 1), xx, yy, module, i, (i-i%8)*1.2-2, 0);
+ }
+
+
+
+ addOutput(createOutput<PointingUpPentagonPort>(Vec(28, 24), module, ComputerscareGolyPenerator::POLY_OUTPUT));
+
+ }
+ void addLabeledKnob(std::string label, int x, int y, ComputerscareGolyPenerator *module, int index, float labelDx, float labelDy) {
+
+ smallLetterDisplay = new SmallLetterDisplay();
+ smallLetterDisplay->box.size = Vec(5, 10);
+ smallLetterDisplay->fontSize = 16;
+ smallLetterDisplay->value = label;
+ smallLetterDisplay->textAlign = 1;
+
+ addParam(createParam<SmoothKnob>(Vec(x, y), module, ComputerscareGolyPenerator::KNOB + index));
+ smallLetterDisplay->box.pos = Vec(x + labelDx, y - 12 + labelDy);
+
+
+ addChild(smallLetterDisplay);
+
+ }
+ SmallLetterDisplay* smallLetterDisplay;
+};
+
+Model *modelComputerscareGolyPenerator = createModel<ComputerscareGolyPenerator, ComputerscareGolyPeneratorWidget>("computerscare-goly-penerator");
diff --git a/src/golyFunctions.cpp b/src/golyFunctions.cpp
@@ -0,0 +1,11 @@
+#include "golyFunctions.hpp"
+
+
+void Goly(std::string t, std::string v) {
+ printf("gee golly horse\n");
+
+}
+
+int myHorse(int x, int p) {
+ return 33;
+}
+\ No newline at end of file
diff --git a/src/golyFunctions.hpp b/src/golyFunctions.hpp
@@ -0,0 +1,30 @@
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <typeinfo>
+#include <stdexcept>
+#include <math.h>
+
+#ifndef MY_GLOBALS_H
+#define MY_GLOBALS_H
+extern std::string b64lookup;
+extern std::string integerlookup;
+extern std::string knoblookup;
+extern std::string inputlookup;
+extern std::string knobandinputlookup;
+#endif
+
+class Goly {
+ public:
+ std::string type;
+ std::string value;
+ int index;
+ int duration;
+ Goly(std::string t, std::string v);
+
+};
+
+int myHorse(int x, int p);