computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 001f7737e4f4a4582def3abdc03c85297414442d
parent 31875379286c4c00a793527586676caa5675898d
Author: Adam M <[email protected]>
Date:   Sun, 27 Dec 2020 11:32:57 -0600

penerator algorithms, put algo name in knob

Diffstat:
Msrc/ComputerscareGolyPenerator.cpp | 14+++++++++++---
Msrc/golyFunctions.cpp | 2+-
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/ComputerscareGolyPenerator.cpp b/src/ComputerscareGolyPenerator.cpp @@ -11,6 +11,14 @@ struct ComputerscareGolyPenerator; knob2: algorithm knob3: param 1 */ +const std::string GolyPeneratorAvailableAlgorithmsArr[5] = {"Linear", "Sigmoid","Hump","Sinusoid","Pseudo-Random"}; + +struct EnumParamQuantity : ParamQuantity { + std::string getDisplayValueString() override { + int val = getValue(); + return GolyPeneratorAvailableAlgorithmsArr[val]; + } +}; struct ComputerscareGolyPenerator : ComputerscarePolyModule { int counter = 0; @@ -46,7 +54,7 @@ struct ComputerscareGolyPenerator : ComputerscarePolyModule { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - configParam(ALGORITHM , 0.f, 4.f, 0.f, "Algorithm"); + configParam<EnumParamQuantity>(ALGORITHM , 0.f, 4.f, 0.f, "Algorithm"); configParam(IN_OFFSET, -1.f, 1.f, 0.f, "Channel Center"); configParam(IN_SCALE, -2.f, 2.f, 1.f, "Channel Spread"); @@ -60,7 +68,7 @@ struct ComputerscareGolyPenerator : ComputerscarePolyModule { availableAlgorithms.push_back("Hump"); availableAlgorithms.push_back("Sinusoid"); availableAlgorithms.push_back("Pseudo-Random"); - + goly = Goly(); @@ -138,7 +146,7 @@ struct AlgorithmChildMenu : MenuItem { for (unsigned int i = 0; i < penerator->availableAlgorithms.size(); i++) { setAlgoItem *menuItem = new setAlgoItem(i); //ParamSettingItem *menuItem = new ParamSettingItem(i,ComputerscareGolyPenerator::ALGORITHM); - + menuItem->text = penerator->availableAlgorithms[i]; menuItem->penerator = penerator; menu->addChild(menuItem); diff --git a/src/golyFunctions.cpp b/src/golyFunctions.cpp @@ -54,7 +54,7 @@ void Goly::invoke(int algorithm, std::vector<float> gp, int num = 16) { for (int i = 0; i < num; i++) { float ip = (float)i / num; float d = trigFactor*(ip - gp[0]); - currentValues[i] = gp[2] * (1+sinf(d*exp(-2*gp[1]+2)))/2 + gp[3]; + currentValues[i] = gp[2] * (1+sinf(d*exp(-1.5*(gp[1]-3))))/2 + gp[3]; } break; case 4: