diff --git a/README.md b/README.md index 4428086..128b84b 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,4 @@ All **source code** is copyright © 2019 Andrew Belt and licensed under the [BSD The **VCV logo and icon** are copyright © 2017 Andrew Belt and may not be used in derivative works. The **panel graphics** in the `res` directory are copyright © 2019 [Grayscale](http://grayscale.info/) and licensed under [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/). +You may not create modified adaptations of these graphics. diff --git a/src/Merge.cpp b/src/Merge.cpp index ca07341..13cf63d 100644 --- a/src/Merge.cpp +++ b/src/Merge.cpp @@ -18,12 +18,12 @@ struct Merge : Module { NUM_LIGHTS }; - dsp::Counter lightCounter; + dsp::ClockDivider lightDivider; int channels; Merge() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - lightCounter.setPeriod(512); + lightDivider.setDivision(512); onReset(); } @@ -45,7 +45,7 @@ struct Merge : Module { outputs[POLY_OUTPUT].setChannels((channels >= 0) ? channels : (lastChannel + 1)); // Set channel lights infrequently - if (lightCounter.process()) { + if (lightDivider.process()) { for (int c = 0; c < 16; c++) { bool active = (c < outputs[POLY_OUTPUT].getChannels()); lights[CHANNEL_LIGHTS + c].setBrightness(active); diff --git a/src/SequentialSwitch.cpp b/src/SequentialSwitch.cpp index 1c0fd55..0172a0e 100644 --- a/src/SequentialSwitch.cpp +++ b/src/SequentialSwitch.cpp @@ -26,7 +26,7 @@ struct SequentialSwitch : Module { dsp::SchmittTrigger clockTrigger; dsp::SchmittTrigger resetTrigger; int index = 0; - dsp::Counter lightCounter; + dsp::ClockDivider lightDivider; dsp::SlewLimiter clickFilters[4]; SequentialSwitch() { @@ -37,7 +37,7 @@ struct SequentialSwitch : Module { clickFilters[i].rise = 400.f; // Hz clickFilters[i].fall = 400.f; // Hz } - lightCounter.setPeriod(512); + lightDivider.setDivision(512); } void process(const ProcessArgs &args) override { @@ -102,7 +102,7 @@ struct SequentialSwitch : Module { } // Set lights - if (lightCounter.process()) { + if (lightDivider.process()) { for (int i = 0; i < 4; i++) { lights[CHANNEL_LIGHT + i].setBrightness(index == i); } diff --git a/src/Split.cpp b/src/Split.cpp index 81c3443..88352ab 100644 --- a/src/Split.cpp +++ b/src/Split.cpp @@ -18,11 +18,11 @@ struct Split : Module { NUM_LIGHTS }; - dsp::Counter lightCounter; + dsp::ClockDivider lightDivider; Split() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - lightCounter.setPeriod(512); + lightDivider.setDivision(512); } void process(const ProcessArgs &args) override { @@ -33,7 +33,7 @@ struct Split : Module { } // Set channel lights infrequently - if (lightCounter.process()) { + if (lightDivider.process()) { for (int c = 0; c < 16; c++) { bool active = (c < inputs[POLY_INPUT].getChannels()); lights[CHANNEL_LIGHTS + c].setBrightness(active); diff --git a/src/Sum.cpp b/src/Sum.cpp index f070036..6470023 100644 --- a/src/Sum.cpp +++ b/src/Sum.cpp @@ -21,16 +21,16 @@ struct Sum : Module { }; dsp::VuMeter2 vuMeter; - dsp::Counter vuCounter; - dsp::Counter lightCounter; + dsp::ClockDivider vuDivider; + dsp::ClockDivider lightDivider; Sum() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(LEVEL_PARAM, 0.f, 1.f, 1.f, "Level", "%", 0.f, 100.f); vuMeter.lambda = 1 / 0.1f; - vuCounter.setPeriod(16); - lightCounter.setPeriod(256); + vuDivider.setDivision(16); + lightDivider.setDivision(256); } void process(const ProcessArgs &args) override { @@ -43,12 +43,12 @@ struct Sum : Module { sum *= params[LEVEL_PARAM].getValue(); outputs[MONO_OUTPUT].setVoltage(sum); - if (vuCounter.process()) { - vuMeter.process(args.sampleTime * vuCounter.period, sum / 10.f); + if (vuDivider.process()) { + vuMeter.process(args.sampleTime * vuDivider.getDivision(), sum / 10.f); } // Set channel lights infrequently - if (lightCounter.process()) { + if (lightDivider.process()) { for (int c = 0; c < 16; c++) { bool active = (c < inputs[POLY_INPUT].getChannels()); lights[CHANNEL_LIGHTS + c].setBrightness(active); diff --git a/src/Unity.cpp b/src/Unity.cpp index 7758638..fd95d14 100644 --- a/src/Unity.cpp +++ b/src/Unity.cpp @@ -25,14 +25,14 @@ struct Unity : Module { bool merge = false; dsp::VuMeter2 vuMeters[2]; - dsp::Counter lightCounter; + dsp::ClockDivider lightDivider; Unity() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(AVG1_PARAM, 0.0, 1.0, 0.0, "Ch 1 average mode"); configParam(AVG2_PARAM, 0.0, 1.0, 0.0, "Ch 2 average mode"); - lightCounter.setPeriod(256); + lightDivider.setDivision(256); } void process(const ProcessArgs &args) override { @@ -67,7 +67,7 @@ struct Unity : Module { vuMeters[i].process(args.sampleTime, mix[i] / 10.f); } - if (lightCounter.process()) { + if (lightDivider.process()) { // Lights for (int i = 0; i < 2; i++) { lights[VU_LIGHTS + 5 * i + 0].setBrightness(vuMeters[i].getBrightness(0.f, 0.f)); diff --git a/src/Viz.cpp b/src/Viz.cpp index 3351adf..0d459c0 100644 --- a/src/Viz.cpp +++ b/src/Viz.cpp @@ -18,17 +18,17 @@ struct Viz : Module { }; int lastChannels = 0; - dsp::Counter lightCounter; + dsp::ClockDivider lightDivider; Viz() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - lightCounter.setPeriod(16); + lightDivider.setDivision(16); } void process(const ProcessArgs &args) override { - if (lightCounter.process()) { + if (lightDivider.process()) { lastChannels = inputs[POLY_INPUT].getChannels(); - float deltaTime = args.sampleTime * lightCounter.period; + float deltaTime = args.sampleTime * lightDivider.getDivision(); for (int c = 0; c < 16; c++) { float v = inputs[POLY_INPUT].getVoltage(c) / 10.f;