Browse Source

Update Rack v1 API. Clarity license of panels.

tags/v1.0.1
Andrew Belt 6 years ago
parent
commit
cad65743d5
7 changed files with 24 additions and 23 deletions
  1. +1
    -0
      README.md
  2. +3
    -3
      src/Merge.cpp
  3. +3
    -3
      src/SequentialSwitch.cpp
  4. +3
    -3
      src/Split.cpp
  5. +7
    -7
      src/Sum.cpp
  6. +3
    -3
      src/Unity.cpp
  7. +4
    -4
      src/Viz.cpp

+ 1
- 0
README.md View File

@@ -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 **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/). 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.

+ 3
- 3
src/Merge.cpp View File

@@ -18,12 +18,12 @@ struct Merge : Module {
NUM_LIGHTS NUM_LIGHTS
}; };


dsp::Counter lightCounter;
dsp::ClockDivider lightDivider;
int channels; int channels;


Merge() { Merge() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
lightCounter.setPeriod(512);
lightDivider.setDivision(512);
onReset(); onReset();
} }


@@ -45,7 +45,7 @@ struct Merge : Module {
outputs[POLY_OUTPUT].setChannels((channels >= 0) ? channels : (lastChannel + 1)); outputs[POLY_OUTPUT].setChannels((channels >= 0) ? channels : (lastChannel + 1));


// Set channel lights infrequently // Set channel lights infrequently
if (lightCounter.process()) {
if (lightDivider.process()) {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
bool active = (c < outputs[POLY_OUTPUT].getChannels()); bool active = (c < outputs[POLY_OUTPUT].getChannels());
lights[CHANNEL_LIGHTS + c].setBrightness(active); lights[CHANNEL_LIGHTS + c].setBrightness(active);


+ 3
- 3
src/SequentialSwitch.cpp View File

@@ -26,7 +26,7 @@ struct SequentialSwitch : Module {
dsp::SchmittTrigger clockTrigger; dsp::SchmittTrigger clockTrigger;
dsp::SchmittTrigger resetTrigger; dsp::SchmittTrigger resetTrigger;
int index = 0; int index = 0;
dsp::Counter lightCounter;
dsp::ClockDivider lightDivider;
dsp::SlewLimiter clickFilters[4]; dsp::SlewLimiter clickFilters[4];


SequentialSwitch() { SequentialSwitch() {
@@ -37,7 +37,7 @@ struct SequentialSwitch : Module {
clickFilters[i].rise = 400.f; // Hz clickFilters[i].rise = 400.f; // Hz
clickFilters[i].fall = 400.f; // Hz clickFilters[i].fall = 400.f; // Hz
} }
lightCounter.setPeriod(512);
lightDivider.setDivision(512);
} }


void process(const ProcessArgs &args) override { void process(const ProcessArgs &args) override {
@@ -102,7 +102,7 @@ struct SequentialSwitch : Module {
} }


// Set lights // Set lights
if (lightCounter.process()) {
if (lightDivider.process()) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
lights[CHANNEL_LIGHT + i].setBrightness(index == i); lights[CHANNEL_LIGHT + i].setBrightness(index == i);
} }


+ 3
- 3
src/Split.cpp View File

@@ -18,11 +18,11 @@ struct Split : Module {
NUM_LIGHTS NUM_LIGHTS
}; };


dsp::Counter lightCounter;
dsp::ClockDivider lightDivider;


Split() { Split() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
lightCounter.setPeriod(512);
lightDivider.setDivision(512);
} }


void process(const ProcessArgs &args) override { void process(const ProcessArgs &args) override {
@@ -33,7 +33,7 @@ struct Split : Module {
} }


// Set channel lights infrequently // Set channel lights infrequently
if (lightCounter.process()) {
if (lightDivider.process()) {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
bool active = (c < inputs[POLY_INPUT].getChannels()); bool active = (c < inputs[POLY_INPUT].getChannels());
lights[CHANNEL_LIGHTS + c].setBrightness(active); lights[CHANNEL_LIGHTS + c].setBrightness(active);


+ 7
- 7
src/Sum.cpp View File

@@ -21,16 +21,16 @@ struct Sum : Module {
}; };


dsp::VuMeter2 vuMeter; dsp::VuMeter2 vuMeter;
dsp::Counter vuCounter;
dsp::Counter lightCounter;
dsp::ClockDivider vuDivider;
dsp::ClockDivider lightDivider;


Sum() { Sum() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(LEVEL_PARAM, 0.f, 1.f, 1.f, "Level", "%", 0.f, 100.f); configParam(LEVEL_PARAM, 0.f, 1.f, 1.f, "Level", "%", 0.f, 100.f);


vuMeter.lambda = 1 / 0.1f; vuMeter.lambda = 1 / 0.1f;
vuCounter.setPeriod(16);
lightCounter.setPeriod(256);
vuDivider.setDivision(16);
lightDivider.setDivision(256);
} }


void process(const ProcessArgs &args) override { void process(const ProcessArgs &args) override {
@@ -43,12 +43,12 @@ struct Sum : Module {
sum *= params[LEVEL_PARAM].getValue(); sum *= params[LEVEL_PARAM].getValue();
outputs[MONO_OUTPUT].setVoltage(sum); 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 // Set channel lights infrequently
if (lightCounter.process()) {
if (lightDivider.process()) {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
bool active = (c < inputs[POLY_INPUT].getChannels()); bool active = (c < inputs[POLY_INPUT].getChannels());
lights[CHANNEL_LIGHTS + c].setBrightness(active); lights[CHANNEL_LIGHTS + c].setBrightness(active);


+ 3
- 3
src/Unity.cpp View File

@@ -25,14 +25,14 @@ struct Unity : Module {


bool merge = false; bool merge = false;
dsp::VuMeter2 vuMeters[2]; dsp::VuMeter2 vuMeters[2];
dsp::Counter lightCounter;
dsp::ClockDivider lightDivider;


Unity() { Unity() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(AVG1_PARAM, 0.0, 1.0, 0.0, "Ch 1 average mode"); 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"); 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 { void process(const ProcessArgs &args) override {
@@ -67,7 +67,7 @@ struct Unity : Module {
vuMeters[i].process(args.sampleTime, mix[i] / 10.f); vuMeters[i].process(args.sampleTime, mix[i] / 10.f);
} }


if (lightCounter.process()) {
if (lightDivider.process()) {
// Lights // Lights
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
lights[VU_LIGHTS + 5 * i + 0].setBrightness(vuMeters[i].getBrightness(0.f, 0.f)); lights[VU_LIGHTS + 5 * i + 0].setBrightness(vuMeters[i].getBrightness(0.f, 0.f));


+ 4
- 4
src/Viz.cpp View File

@@ -18,17 +18,17 @@ struct Viz : Module {
}; };


int lastChannels = 0; int lastChannels = 0;
dsp::Counter lightCounter;
dsp::ClockDivider lightDivider;


Viz() { Viz() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
lightCounter.setPeriod(16);
lightDivider.setDivision(16);
} }


void process(const ProcessArgs &args) override { void process(const ProcessArgs &args) override {
if (lightCounter.process()) {
if (lightDivider.process()) {
lastChannels = inputs[POLY_INPUT].getChannels(); lastChannels = inputs[POLY_INPUT].getChannels();
float deltaTime = args.sampleTime * lightCounter.period;
float deltaTime = args.sampleTime * lightDivider.getDivision();


for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
float v = inputs[POLY_INPUT].getVoltage(c) / 10.f; float v = inputs[POLY_INPUT].getVoltage(c) / 10.f;


Loading…
Cancel
Save