@@ -58,6 +58,7 @@ struct ShadesWidget : ModuleWidget { | |||||
struct BranchesWidget : ModuleWidget { | struct BranchesWidget : ModuleWidget { | ||||
BranchesWidget(); | BranchesWidget(); | ||||
Menu *createContextMenu() override; | |||||
}; | }; | ||||
struct BlindsWidget : ModuleWidget { | struct BlindsWidget : ModuleWidget { | ||||
@@ -33,10 +33,10 @@ struct Blinds : Module { | |||||
NUM_OUTPUTS | NUM_OUTPUTS | ||||
}; | }; | ||||
enum LightIds { | enum LightIds { | ||||
IN1_POS_LIGHT, IN1_NEG_LIGHT, | |||||
IN2_POS_LIGHT, IN2_NEG_LIGHT, | |||||
IN3_POS_LIGHT, IN3_NEG_LIGHT, | |||||
IN4_POS_LIGHT, IN4_NEG_LIGHT, | |||||
CV1_POS_LIGHT, CV1_NEG_LIGHT, | |||||
CV2_POS_LIGHT, CV2_NEG_LIGHT, | |||||
CV3_POS_LIGHT, CV3_NEG_LIGHT, | |||||
CV4_POS_LIGHT, CV4_NEG_LIGHT, | |||||
OUT1_POS_LIGHT, OUT1_NEG_LIGHT, | OUT1_POS_LIGHT, OUT1_NEG_LIGHT, | ||||
OUT2_POS_LIGHT, OUT2_NEG_LIGHT, | OUT2_POS_LIGHT, OUT2_NEG_LIGHT, | ||||
OUT3_POS_LIGHT, OUT3_NEG_LIGHT, | OUT3_POS_LIGHT, OUT3_NEG_LIGHT, | ||||
@@ -55,11 +55,12 @@ void Blinds::step() { | |||||
for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
float g = params[GAIN1_PARAM + i].value; | float g = params[GAIN1_PARAM + i].value; | ||||
g += params[MOD1_PARAM + i].value * inputs[CV1_INPUT + i].value / 5.0; | g += params[MOD1_PARAM + i].value * inputs[CV1_INPUT + i].value / 5.0; | ||||
lights[IN1_POS_LIGHT + 2*i].setBrightness(fmaxf(0.0, g)); | |||||
lights[IN1_NEG_LIGHT + 2*i].setBrightness(fmaxf(0.0, -g)); | |||||
g = clampf(g, -2.0, 2.0); | |||||
lights[CV1_POS_LIGHT + 2*i].setBrightnessSmooth(fmaxf(0.0, g)); | |||||
lights[CV1_NEG_LIGHT + 2*i].setBrightnessSmooth(fmaxf(0.0, -g)); | |||||
out += g * inputs[IN1_INPUT + i].normalize(5.0); | out += g * inputs[IN1_INPUT + i].normalize(5.0); | ||||
lights[OUT1_POS_LIGHT + 2*i].setBrightness(fmaxf(0.0, out)); | |||||
lights[OUT1_NEG_LIGHT + 2*i].setBrightness(fmaxf(0.0, -out)); | |||||
lights[OUT1_POS_LIGHT + 2*i].setBrightnessSmooth(fmaxf(0.0, out / 5.0)); | |||||
lights[OUT1_NEG_LIGHT + 2*i].setBrightnessSmooth(fmaxf(0.0, -out / 5.0)); | |||||
if (outputs[OUT1_OUTPUT + i].active) { | if (outputs[OUT1_OUTPUT + i].active) { | ||||
outputs[OUT1_OUTPUT + i].value = out; | outputs[OUT1_OUTPUT + i].value = out; | ||||
out = 0.0; | out = 0.0; | ||||
@@ -110,13 +111,13 @@ BlindsWidget::BlindsWidget() { | |||||
addOutput(createOutput<PJ301MPort>(Vec(144, 198), module, Blinds::OUT3_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(144, 198), module, Blinds::OUT3_OUTPUT)); | ||||
addOutput(createOutput<PJ301MPort>(Vec(144, 277), module, Blinds::OUT4_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(144, 277), module, Blinds::OUT4_OUTPUT)); | ||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 87), module, Blinds::IN1_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 166), module, Blinds::IN2_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 245), module, Blinds::IN3_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 324), module, Blinds::IN4_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 96), module, Blinds::CV1_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 175), module, Blinds::CV2_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 254), module, Blinds::CV3_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 333), module, Blinds::CV4_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 96), module, Blinds::OUT1_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 175), module, Blinds::OUT2_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 254), module, Blinds::OUT3_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(77, 333), module, Blinds::OUT4_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 87), module, Blinds::OUT1_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 166), module, Blinds::OUT2_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 245), module, Blinds::OUT3_POS_LIGHT)); | |||||
addChild(createLight<MediumLight<GreenRedLight>>(Vec(150, 324), module, Blinds::OUT4_POS_LIGHT)); | |||||
} | } |
@@ -1,4 +1,5 @@ | |||||
#include "AudibleInstruments.hpp" | #include "AudibleInstruments.hpp" | ||||
#include "dsp/digital.hpp" | |||||
struct Branches : Module { | struct Branches : Module { | ||||
@@ -24,41 +25,62 @@ struct Branches : Module { | |||||
NUM_OUTPUTS | NUM_OUTPUTS | ||||
}; | }; | ||||
enum LightIds { | enum LightIds { | ||||
STATE1_LIGHT, | |||||
STATE2_LIGHT, | |||||
MODE1_LIGHT, | |||||
MODE2_LIGHT, | |||||
STATE1_POS_LIGHT, STATE1_NEG_LIGHT, | |||||
STATE2_POS_LIGHT, STATE2_NEG_LIGHT, | |||||
NUM_LIGHTS | NUM_LIGHTS | ||||
}; | }; | ||||
bool lastGate[2] = {}; | |||||
SchmittTrigger gateTrigger[2]; | |||||
SchmittTrigger modeTrigger[2]; | |||||
bool mode[2] = {}; | |||||
bool outcome[2] = {}; | bool outcome[2] = {}; | ||||
Branches() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} | Branches() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} | ||||
void step() override; | void step() override; | ||||
void reset() override { | |||||
for (int i = 0; i < 2; i++) { | |||||
mode[i] = false; | |||||
outcome[i] = false; | |||||
} | |||||
} | |||||
}; | }; | ||||
void Branches::step() { | void Branches::step() { | ||||
for (int i = 0; i < 2; i++) { | for (int i = 0; i < 2; i++) { | ||||
float out = inputs[IN1_INPUT + i].value; | |||||
bool gate = (out >= 1.0); | |||||
if (gate && !lastGate[i]) { | |||||
// mode button | |||||
if (modeTrigger[i].process(params[MODE1_PARAM + i].value)) | |||||
mode[i] = !mode[i]; | |||||
float gate = inputs[IN1_INPUT + i].value; | |||||
if (gateTrigger[i].process(gate)) { | |||||
// trigger | // trigger | ||||
float r = randomf(); | float r = randomf(); | ||||
bool toss = (r < params[THRESHOLD1_PARAM + i].value + inputs[P1_INPUT + i].value); | bool toss = (r < params[THRESHOLD1_PARAM + i].value + inputs[P1_INPUT + i].value); | ||||
if (params[MODE1_PARAM + i].value < 0.5) { | |||||
if (!mode[i]) { | |||||
// direct mode | // direct mode | ||||
outcome[i] = toss; | outcome[i] = toss; | ||||
} | } | ||||
else { | else { | ||||
// toggle mode | // toggle mode | ||||
outcome[i] = outcome[i] != toss; | |||||
outcome[i] = (outcome[i] != toss); | |||||
} | } | ||||
if (!outcome[i]) | |||||
lights[STATE1_POS_LIGHT + 2*i].value = 1.0; | |||||
else | |||||
lights[STATE1_NEG_LIGHT + 2*i].value = 1.0; | |||||
} | } | ||||
lastGate[i] = gate; | |||||
lights[STATE1_LIGHT + i].value = outcome[i] ? out : -out; | |||||
outputs[OUT1A_OUTPUT + i].value = outcome[i] ? 0.0 : out; | |||||
outputs[OUT1B_OUTPUT + i].value = outcome[i] ? out : 0.0; | |||||
lights[STATE1_POS_LIGHT + 2*i].value *= 1.0 - engineGetSampleTime() * 15.0; | |||||
lights[STATE1_NEG_LIGHT + 2*i].value *= 1.0 - engineGetSampleTime() * 15.0; | |||||
lights[MODE1_LIGHT + i].value = mode[i] ? 1.0 : 0.0; | |||||
outputs[OUT1A_OUTPUT + i].value = outcome[i] ? 0.0 : gate; | |||||
outputs[OUT1B_OUTPUT + i].value = outcome[i] ? gate : 0.0; | |||||
} | } | ||||
} | } | ||||
@@ -79,19 +101,44 @@ BranchesWidget::BranchesWidget() { | |||||
addChild(createScrew<ScrewSilver>(Vec(15, 365))); | addChild(createScrew<ScrewSilver>(Vec(15, 365))); | ||||
addParam(createParam<Rogan1PSRed>(Vec(24, 64), module, Branches::THRESHOLD1_PARAM, 0.0, 1.0, 0.5)); | addParam(createParam<Rogan1PSRed>(Vec(24, 64), module, Branches::THRESHOLD1_PARAM, 0.0, 1.0, 0.5)); | ||||
// addParam(createParam<MediumToggleSwitch>(Vec(69, 58), module, Branches::MODE1_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<TL1105>(Vec(69, 58), module, Branches::MODE1_PARAM, 0.0, 1.0, 0.0)); | |||||
addInput(createInput<PJ301MPort>(Vec(9, 122), module, Branches::IN1_INPUT)); | addInput(createInput<PJ301MPort>(Vec(9, 122), module, Branches::IN1_INPUT)); | ||||
addInput(createInput<PJ301MPort>(Vec(55, 122), module, Branches::P1_INPUT)); | addInput(createInput<PJ301MPort>(Vec(55, 122), module, Branches::P1_INPUT)); | ||||
addOutput(createOutput<PJ301MPort>(Vec(9, 160), module, Branches::OUT1A_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(9, 160), module, Branches::OUT1A_OUTPUT)); | ||||
addOutput(createOutput<PJ301MPort>(Vec(55, 160), module, Branches::OUT1B_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(55, 160), module, Branches::OUT1B_OUTPUT)); | ||||
addParam(createParam<Rogan1PSGreen>(Vec(24, 220), module, Branches::THRESHOLD2_PARAM, 0.0, 1.0, 0.5)); | addParam(createParam<Rogan1PSGreen>(Vec(24, 220), module, Branches::THRESHOLD2_PARAM, 0.0, 1.0, 0.5)); | ||||
// addParam(createParam<MediumToggleSwitch>(Vec(69, 214), module, Branches::MODE2_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<TL1105>(Vec(69, 214), module, Branches::MODE2_PARAM, 0.0, 1.0, 0.0)); | |||||
addInput(createInput<PJ301MPort>(Vec(9, 278), module, Branches::IN2_INPUT)); | addInput(createInput<PJ301MPort>(Vec(9, 278), module, Branches::IN2_INPUT)); | ||||
addInput(createInput<PJ301MPort>(Vec(55, 278), module, Branches::P2_INPUT)); | addInput(createInput<PJ301MPort>(Vec(55, 278), module, Branches::P2_INPUT)); | ||||
addOutput(createOutput<PJ301MPort>(Vec(9, 316), module, Branches::OUT2A_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(9, 316), module, Branches::OUT2A_OUTPUT)); | ||||
addOutput(createOutput<PJ301MPort>(Vec(55, 316), module, Branches::OUT2B_OUTPUT)); | addOutput(createOutput<PJ301MPort>(Vec(55, 316), module, Branches::OUT2B_OUTPUT)); | ||||
addChild(createLight<SmallLight<GreenLight>>(Vec(40, 169), module, Branches::STATE1_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenLight>>(Vec(40, 325), module, Branches::STATE2_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(40, 169), module, Branches::STATE1_POS_LIGHT)); | |||||
addChild(createLight<SmallLight<GreenRedLight>>(Vec(40, 325), module, Branches::STATE2_POS_LIGHT)); | |||||
} | |||||
struct BranchesModeItem : MenuItem { | |||||
Branches *branches; | |||||
int channel; | |||||
void onAction() override { | |||||
branches->mode[channel] ^= 1; | |||||
} | |||||
void step() override { | |||||
rightText = branches->mode[channel] ? "Toggle" : "Latch"; | |||||
} | |||||
}; | |||||
Menu *BranchesWidget::createContextMenu() { | |||||
Menu *menu = ModuleWidget::createContextMenu(); | |||||
Branches *branches = dynamic_cast<Branches*>(module); | |||||
assert(branches); | |||||
menu->pushChild(construct<MenuLabel>()); | |||||
menu->pushChild(construct<MenuLabel>(&MenuEntry::text, "Channels")); | |||||
menu->pushChild(construct<BranchesModeItem>(&MenuEntry::text, "Channel 1 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 0)); | |||||
menu->pushChild(construct<BranchesModeItem>(&MenuEntry::text, "Channel 2 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 1)); | |||||
return menu; | |||||
} | } |
@@ -67,6 +67,7 @@ struct Elements : Module { | |||||
NUM_OUTPUTS | NUM_OUTPUTS | ||||
}; | }; | ||||
enum LightIds { | enum LightIds { | ||||
GATE_LIGHT, | |||||
EXCITER_LIGHT, | EXCITER_LIGHT, | ||||
RESONATOR_LIGHT, | RESONATOR_LIGHT, | ||||
NUM_LIGHTS | NUM_LIGHTS | ||||
@@ -198,8 +199,9 @@ void Elements::step() { | |||||
} | } | ||||
// Set lights | // Set lights | ||||
lights[EXCITER_LIGHT].value = part->exciter_level(); | |||||
lights[RESONATOR_LIGHT].value = part->resonator_level(); | |||||
lights[GATE_LIGHT].setBrightness(performance.gate ? 0.5 : 0.0); | |||||
lights[EXCITER_LIGHT].setBrightness(part->exciter_level()); | |||||
lights[RESONATOR_LIGHT].setBrightness(part->resonator_level()); | |||||
} | } | ||||
// Set output | // Set output | ||||
@@ -284,6 +286,10 @@ ElementsWidget::ElementsWidget() { | |||||
addParam(createParam<CKD6>(Vec(36, 116), module, Elements::PLAY_PARAM, 0.0, 1.0, 0.0)); | addParam(createParam<CKD6>(Vec(36, 116), module, Elements::PLAY_PARAM, 0.0, 1.0, 0.0)); | ||||
ModuleLightWidget *gateLight = createLight<YellowLight>(Vec(36+3, 116+3), module, Elements::GATE_LIGHT); | |||||
gateLight->bgColor = COLOR_BLACK_TRANSPARENT; | |||||
gateLight->box.size = Vec(28-6, 28-6); | |||||
addChild(gateLight); | |||||
addChild(createLight<MediumLight<GreenLight>>(Vec(184, 165), module, Elements::EXCITER_LIGHT)); | addChild(createLight<MediumLight<GreenLight>>(Vec(184, 165), module, Elements::EXCITER_LIGHT)); | ||||
addChild(createLight<MediumLight<RedLight>>(Vec(395, 165), module, Elements::RESONATOR_LIGHT)); | addChild(createLight<MediumLight<RedLight>>(Vec(395, 165), module, Elements::RESONATOR_LIGHT)); | ||||
} | } | ||||
@@ -306,9 +312,9 @@ Menu *ElementsWidget::createContextMenu() { | |||||
assert(elements); | assert(elements); | ||||
menu->pushChild(construct<MenuLabel>()); | menu->pushChild(construct<MenuLabel>()); | ||||
menu->pushChild(construct<MenuLabel>(&MenuEntry::text, "Alternative Models")); | |||||
menu->pushChild(construct<MenuLabel>(&MenuEntry::text, "Alternative models")); | |||||
menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Original", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 0)); | menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Original", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 0)); | ||||
menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Non-Linear String", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 1)); | |||||
menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Non-linear string", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 1)); | |||||
menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Chords", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 2)); | menu->pushChild(construct<ElementsModalItem>(&MenuEntry::text, "Chords", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 2)); | ||||
return menu; | return menu; | ||||
@@ -222,7 +222,7 @@ void Frames::step() { | |||||
// Set lights | // Set lights | ||||
for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
lights[GAIN1_LIGHT + i].value = gains[i]; | |||||
lights[GAIN1_LIGHT + i].setBrightness(gains[i]); | |||||
} | } | ||||
if (poly_lfo_mode) { | if (poly_lfo_mode) { | ||||
@@ -240,8 +240,10 @@ void Frames::step() { | |||||
else { | else { | ||||
colors = keyframer.color(); | colors = keyframer.color(); | ||||
} | } | ||||
for (int c = 0; c < 3; c++) { | |||||
lights[FRAME_LIGHT + c].value = colors[c] / 255.0; | |||||
for (int i = 0; i < 3; i++) { | |||||
float c = colors[i] / 255.0; | |||||
c = 1.0 - (1.0 - c) * 1.25; | |||||
lights[FRAME_LIGHT + i].setBrightness(c); | |||||
} | } | ||||
} | } | ||||
@@ -75,13 +75,13 @@ ShadesWidget::ShadesWidget() { | |||||
addChild(createScrew<ScrewSilver>(Vec(15, 0))); | addChild(createScrew<ScrewSilver>(Vec(15, 0))); | ||||
addChild(createScrew<ScrewSilver>(Vec(15, 365))); | addChild(createScrew<ScrewSilver>(Vec(15, 365))); | ||||
addParam(createParam<Rogan1PSRed>(Vec(40, 41), module, Shades::GAIN1_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<Rogan1PSWhite>(Vec(40, 107), module, Shades::GAIN2_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<Rogan1PSGreen>(Vec(40, 173), module, Shades::GAIN3_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<Rogan1PSRed>(Vec(40, 41), module, Shades::GAIN1_PARAM, 0.0, 1.0, 0.5)); | |||||
addParam(createParam<Rogan1PSWhite>(Vec(40, 107), module, Shades::GAIN2_PARAM, 0.0, 1.0, 0.5)); | |||||
addParam(createParam<Rogan1PSGreen>(Vec(40, 173), module, Shades::GAIN3_PARAM, 0.0, 1.0, 0.5)); | |||||
addParam(createParam<CKSS>(Vec(10, 52), module, Shades::MODE1_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<CKSS>(Vec(10, 118), module, Shades::MODE2_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<CKSS>(Vec(10, 184), module, Shades::MODE3_PARAM, 0.0, 1.0, 0.0)); | |||||
addParam(createParam<CKSS>(Vec(10, 52), module, Shades::MODE1_PARAM, 0.0, 1.0, 1.0)); | |||||
addParam(createParam<CKSS>(Vec(10, 118), module, Shades::MODE2_PARAM, 0.0, 1.0, 1.0)); | |||||
addParam(createParam<CKSS>(Vec(10, 184), module, Shades::MODE3_PARAM, 0.0, 1.0, 1.0)); | |||||
addInput(createInput<PJ301MPort>(Vec(9, 245), module, Shades::IN1_INPUT)); | addInput(createInput<PJ301MPort>(Vec(9, 245), module, Shades::IN1_INPUT)); | ||||
addInput(createInput<PJ301MPort>(Vec(9, 281), module, Shades::IN2_INPUT)); | addInput(createInput<PJ301MPort>(Vec(9, 281), module, Shades::IN2_INPUT)); | ||||
@@ -102,16 +102,16 @@ void Tides::step() { | |||||
mode = (tides::GeneratorMode) (((int)mode - 1 + 3) % 3); | mode = (tides::GeneratorMode) (((int)mode - 1 + 3) % 3); | ||||
generator.set_mode(mode); | generator.set_mode(mode); | ||||
} | } | ||||
lights[MODE_GREEN_LIGHT].value = (mode == 0 || mode == 1) ? 1.0 : 0.0; | |||||
lights[MODE_RED_LIGHT].value = (mode == 1 || mode == 2) ? 1.0 : 0.0; | |||||
lights[MODE_GREEN_LIGHT].value = (mode == 2) ? 1.0 : 0.0; | |||||
lights[MODE_RED_LIGHT].value = (mode == 0) ? 1.0 : 0.0; | |||||
tides::GeneratorRange range = generator.range(); | tides::GeneratorRange range = generator.range(); | ||||
if (rangeTrigger.process(params[RANGE_PARAM].value)) { | if (rangeTrigger.process(params[RANGE_PARAM].value)) { | ||||
range = (tides::GeneratorRange) (((int)range - 1 + 3) % 3); | range = (tides::GeneratorRange) (((int)range - 1 + 3) % 3); | ||||
generator.set_range(range); | generator.set_range(range); | ||||
} | } | ||||
lights[RANGE_GREEN_LIGHT].value = (range == 0 || range == 1) ? 1.0 : 0.0; | |||||
lights[RANGE_RED_LIGHT].value = (range == 1 || range == 2) ? 1.0 : 0.0; | |||||
lights[RANGE_GREEN_LIGHT].value = (range == 2) ? 1.0 : 0.0; | |||||
lights[RANGE_RED_LIGHT].value = (range == 0) ? 1.0 : 0.0; | |||||
// Buffer loop | // Buffer loop | ||||
if (++frame >= 16) { | if (++frame >= 16) { | ||||
@@ -52,8 +52,9 @@ void Veils::step() { | |||||
float in = inputs[IN1_INPUT + i].value * params[GAIN1_PARAM + i].value; | float in = inputs[IN1_INPUT + i].value * params[GAIN1_PARAM + i].value; | ||||
if (inputs[CV1_INPUT + i].active) { | if (inputs[CV1_INPUT + i].active) { | ||||
float linear = fmaxf(inputs[CV1_INPUT + i].value / 5.0, 0.0); | float linear = fmaxf(inputs[CV1_INPUT + i].value / 5.0, 0.0); | ||||
const float ex = 200.0; | |||||
float exponential = rescalef(powf(ex, linear), 1.0, ex, 0.0, 1.0); | |||||
linear = clampf(linear, 0.0, 2.0); | |||||
const float base = 200.0; | |||||
float exponential = rescalef(powf(base, linear / 2.0), 1.0, base, 0.0, 10.0); | |||||
in *= crossf(exponential, linear, params[RESPONSE1_PARAM + i].value); | in *= crossf(exponential, linear, params[RESPONSE1_PARAM + i].value); | ||||
} | } | ||||
out += in; | out += in; | ||||
@@ -97,10 +97,10 @@ void Warps::step() { | |||||
{ | { | ||||
// TODO | // TODO | ||||
// Use the correct light color | // Use the correct light color | ||||
NVGcolor algorithmColor = nvgHSL(p->modulation_algorithm, 0.5, 0.5); | |||||
lights[ALGORITHM_LIGHT + 0].value = algorithmColor.r; | |||||
lights[ALGORITHM_LIGHT + 1].value = algorithmColor.g; | |||||
lights[ALGORITHM_LIGHT + 2].value = algorithmColor.b; | |||||
NVGcolor algorithmColor = nvgHSL(p->modulation_algorithm, 0.3, 0.4); | |||||
lights[ALGORITHM_LIGHT + 0].setBrightness(algorithmColor.r); | |||||
lights[ALGORITHM_LIGHT + 1].setBrightness(algorithmColor.g); | |||||
lights[ALGORITHM_LIGHT + 2].setBrightness(algorithmColor.b); | |||||
} | } | ||||
p->modulation_parameter = clampf(params[TIMBRE_PARAM].value + inputs[TIMBRE_INPUT].value / 5.0, 0.0, 1.0); | p->modulation_parameter = clampf(params[TIMBRE_PARAM].value + inputs[TIMBRE_INPUT].value / 5.0, 0.0, 1.0); | ||||