commit 2fe941205261c06fb373a97485756a2af7b6f0bc
parent eaa953579c31741f37b95a9319c065ba1afcce8f
Author: Adam M <aemalone@gmail.com>
Date: Sun, 5 Jan 2020 20:55:32 -0600
Penerator algorithms for constant, scale
Diffstat:
3 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/src/ComputerscareGolyPenerator.cpp b/src/ComputerscareGolyPenerator.cpp
@@ -21,6 +21,7 @@ struct ComputerscareGolyPenerator : Module {
int counter = 0;
int numChannels=16;
ComputerscareSVGPanel* panelRef;
+ Goly goly;
float currentValues[16]={0.f};
enum ParamIds {
KNOB,
@@ -54,11 +55,12 @@ struct ComputerscareGolyPenerator : Module {
configParam(KNOB + i, 0.f, 10.f, 0.f, "Channel " + std::to_string(i + 1) + " Voltage", " Volts");
}
+ goly = Goly();
+
}
void updateCurrents() {
- for(int i = 0; i < numChannels; i++) {
- currentValues[i]=(float)i;
- }
+ std::vector<float> golyParams = {params[KNOB+2].getValue(),params[KNOB+3].getValue()};
+ goly.invoke((int)params[KNOB+1].getValue(),golyParams);
}
void process(const ProcessArgs &args) override {
counter++;
@@ -74,7 +76,7 @@ struct ComputerscareGolyPenerator : Module {
outputs[POLY_OUTPUT].setChannels(numChannels);
for (int i = 0; i < 16; i++) {
- outputs[POLY_OUTPUT].setVoltage(currentValues[i], i);
+ outputs[POLY_OUTPUT].setVoltage(goly.currentValues[i], i);
}
}
diff --git a/src/golyFunctions.cpp b/src/golyFunctions.cpp
@@ -1,11 +1,33 @@
#include "golyFunctions.hpp"
-void Goly(std::string t, std::string v) {
- printf("gee golly horse\n");
+Goly::Goly() {
+ for (int i = 0; i < 16; i++) {
+ currentValues[i] = 0.f;
+ }
}
+void Goly::invoke(int algorithm, std::vector<float> params) {
+ switch (algorithm)
+ {
+ case 0: // code to be executed if n = 1;
+ for (int i = 0; i < 16; i++) {
+ currentValues[i] = params[0];
+ }
+ break;
+
+ case 1:
+
+ for (int i = 0; i < 16; i++) {
+ currentValues[i] = (float) i * (params[0]);
+ }
+ break;
+
+ default:
+ for (int i = 0; i < 16; i++) {
+ currentValues[i] = (float) i ;
+ }
+
+ }
+}
-int myHorse(int x, int p) {
- return 33;
-}
-\ No newline at end of file
diff --git a/src/golyFunctions.hpp b/src/golyFunctions.hpp
@@ -19,12 +19,9 @@ extern std::string knobandinputlookup;
class Goly {
public:
- std::string type;
- std::string value;
- int index;
- int duration;
- Goly(std::string t, std::string v);
+ float currentValues[16];
+
+ Goly();
+ void invoke(int algorithm,std::vector<float> pararms);
};
-
-int myHorse(int x, int p);