Browse Source

Implement new Befaco input/output ports

* some code cleanup
* Percall strength should be calculated every sample
tags/v1.1.0^2
hemmer 4 years ago
parent
commit
ecb4165abb
8 changed files with 567 additions and 27848 deletions
  1. +209
    -0
      res/BefacoInputPort.svg
  2. +209
    -0
      res/BefacoOutputPort.svg
  3. +5
    -7
      res/ChoppingKinky.svg
  4. +3
    -27714
      res/HexmixVCA.svg
  5. +54
    -54
      src/ChoppingKinky.cpp
  6. +27
    -0
      src/Common.hpp
  7. +23
    -37
      src/HexmixVCA.cpp
  8. +37
    -36
      src/Percall.cpp

+ 209
- 0
res/BefacoInputPort.svg View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="8.3556204mm"
height="8.3556299mm"
viewBox="0 0 8.3556203 8.3556298"
version="1.1"
id="svg15246"
sodipodi:docname="BefacoInputPort.svg"
inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)">
<defs
id="defs15240">
<clipPath
id="clip89">
<rect
y="0"
x="0"
width="18"
height="19"
id="rect4864" />
</clipPath>
<clipPath
id="clip90">
<path
inkscape:connector-curvature="0"
d="m 0.898438,0.128906 h 16.25 v 17.882813 h -16.25 z m 0,0"
id="path4861" />
</clipPath>
<mask
id="mask44">
<g
style="filter:url(#alpha)"
id="g4858"
transform="matrix(0.26458333,0,0,0.26458333,89.358789,128.57765)">
<rect
x="0"
y="0"
width="3052.8701"
height="3351.5"
style="fill:#000000;fill-opacity:0.14999402;stroke:none"
id="rect4856" />
</g>
</mask>
<filter
id="alpha"
filterUnits="objectBoundingBox"
x="0"
y="0"
width="1"
height="1">
<feColorMatrix
type="matrix"
in="SourceGraphic"
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"
id="feColorMatrix4149" />
</filter>
<clipPath
id="clipPath17821">
<rect
y="0"
x="0"
width="18"
height="19"
id="rect17819" />
</clipPath>
<clipPath
id="clipPath17825">
<path
inkscape:connector-curvature="0"
d="m 0.898438,0.128906 h 16.25 v 17.882813 h -16.25 z m 0,0"
id="path17823" />
</clipPath>
<clipPath
id="clip87">
<rect
y="0"
x="0"
width="24"
height="26"
id="rect4848" />
</clipPath>
<clipPath
id="clip88">
<path
inkscape:connector-curvature="0"
d="m 0.683594,0.921875 h 22.679687 v 24.9375 H 0.683594 Z m 0,0"
id="path4845" />
</clipPath>
<mask
id="mask43">
<g
style="filter:url(#alpha)"
id="g4842"
transform="matrix(0.26458333,0,0,0.26458333,89.358789,128.57765)">
<rect
x="0"
y="0"
width="3052.8701"
height="3351.5"
style="fill:#000000;fill-opacity:0.14999402;stroke:none"
id="rect4840" />
</g>
</mask>
<filter
id="filter17836"
filterUnits="objectBoundingBox"
x="0"
y="0"
width="1"
height="1">
<feColorMatrix
type="matrix"
in="SourceGraphic"
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"
id="feColorMatrix17834" />
</filter>
<clipPath
id="clipPath17840">
<rect
y="0"
x="0"
width="24"
height="26"
id="rect17838" />
</clipPath>
<clipPath
id="clipPath17844">
<path
inkscape:connector-curvature="0"
d="m 0.683594,0.921875 h 22.679687 v 24.9375 H 0.683594 Z m 0,0"
id="path17842" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.2"
inkscape:cx="8.7220802"
inkscape:cy="-10.120793"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2560"
inkscape:window-height="1361"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
units="px"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:document-rotation="0" />
<metadata
id="metadata15243">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-88.611154,-119.19859)">
<path
inkscape:connector-curvature="0"
id="path7255"
d="m 92.788964,127.42922 c -2.235179,0 -4.05281,-1.81762 -4.05281,-4.05282 0,-2.23516 1.817631,-4.05281 4.05281,-4.05281 2.235176,0 4.05281,1.81765 4.05281,4.05281 0,2.2352 -1.817634,4.05282 -4.05281,4.05282"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#bfbfbf;fill-opacity:1;stroke:none;stroke-width:0.108444;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect883"
width="1.2277683"
height="8.059844"
x="92.175079"
y="119.35728" />
<path
inkscape:connector-curvature="0"
id="path7261"
d="m 92.788964,126.29511 c -1.609548,0 -2.918685,-1.30916 -2.918685,-2.91871 0,-1.60954 1.309137,-2.91867 2.918685,-2.91867 1.609549,0 2.918682,1.30913 2.918682,2.91867 0,1.60955 -1.309133,2.91871 -2.918682,2.91871"
style="fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:#636663;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7265"
d="m 94.588681,123.3764 c 0,0.99357 -0.806153,1.79974 -1.799717,1.79974 -0.993567,0 -1.79972,-0.80617 -1.79972,-1.79974 0,-0.99356 0.806153,-1.79969 1.79972,-1.79969 0.993564,0 1.799717,0.80613 1.799717,1.79969"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.35277775" />
<path
inkscape:connector-curvature="0"
id="path7255-6"
d="m 92.788964,127.42922 c -2.235179,0 -4.05281,-1.81762 -4.05281,-4.05282 0,-2.23516 1.817631,-4.05281 4.05281,-4.05281 2.235176,0 4.05281,1.81765 4.05281,4.05281 0,2.2352 -1.817634,4.05282 -4.05281,4.05282"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#636663;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

+ 209
- 0
res/BefacoOutputPort.svg View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="8.3556204mm"
height="8.3556299mm"
viewBox="0 0 8.3556203 8.3556298"
version="1.1"
id="svg15246"
sodipodi:docname="BefacoOutputPort.svg"
inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)">
<defs
id="defs15240">
<clipPath
id="clip89">
<rect
y="0"
x="0"
width="18"
height="19"
id="rect4864" />
</clipPath>
<clipPath
id="clip90">
<path
inkscape:connector-curvature="0"
d="m 0.898438,0.128906 h 16.25 v 17.882813 h -16.25 z m 0,0"
id="path4861" />
</clipPath>
<mask
id="mask44">
<g
style="filter:url(#alpha)"
id="g4858"
transform="matrix(0.26458333,0,0,0.26458333,89.358789,128.57765)">
<rect
x="0"
y="0"
width="3052.8701"
height="3351.5"
style="fill:#000000;fill-opacity:0.14999402;stroke:none"
id="rect4856" />
</g>
</mask>
<filter
id="alpha"
filterUnits="objectBoundingBox"
x="0"
y="0"
width="1"
height="1">
<feColorMatrix
type="matrix"
in="SourceGraphic"
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"
id="feColorMatrix4149" />
</filter>
<clipPath
id="clipPath17821">
<rect
y="0"
x="0"
width="18"
height="19"
id="rect17819" />
</clipPath>
<clipPath
id="clipPath17825">
<path
inkscape:connector-curvature="0"
d="m 0.898438,0.128906 h 16.25 v 17.882813 h -16.25 z m 0,0"
id="path17823" />
</clipPath>
<clipPath
id="clip87">
<rect
y="0"
x="0"
width="24"
height="26"
id="rect4848" />
</clipPath>
<clipPath
id="clip88">
<path
inkscape:connector-curvature="0"
d="m 0.683594,0.921875 h 22.679687 v 24.9375 H 0.683594 Z m 0,0"
id="path4845" />
</clipPath>
<mask
id="mask43">
<g
style="filter:url(#alpha)"
id="g4842"
transform="matrix(0.26458333,0,0,0.26458333,89.358789,128.57765)">
<rect
x="0"
y="0"
width="3052.8701"
height="3351.5"
style="fill:#000000;fill-opacity:0.14999402;stroke:none"
id="rect4840" />
</g>
</mask>
<filter
id="filter17836"
filterUnits="objectBoundingBox"
x="0"
y="0"
width="1"
height="1">
<feColorMatrix
type="matrix"
in="SourceGraphic"
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"
id="feColorMatrix17834" />
</filter>
<clipPath
id="clipPath17840">
<rect
y="0"
x="0"
width="24"
height="26"
id="rect17838" />
</clipPath>
<clipPath
id="clipPath17844">
<path
inkscape:connector-curvature="0"
d="m 0.683594,0.921875 h 22.679687 v 24.9375 H 0.683594 Z m 0,0"
id="path17842" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.839192"
inkscape:cx="13.52797"
inkscape:cy="9.4899316"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1274"
inkscape:window-height="1393"
inkscape:window-x="231"
inkscape:window-y="98"
inkscape:window-maximized="0"
units="px"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:document-rotation="0" />
<metadata
id="metadata15243">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-88.611154,-119.19859)">
<path
inkscape:connector-curvature="0"
id="path7255"
d="m 92.788964,127.42922 c -2.235179,0 -4.05281,-1.81762 -4.05281,-4.05282 0,-2.23516 1.817631,-4.05281 4.05281,-4.05281 2.235176,0 4.05281,1.81765 4.05281,4.05281 0,2.2352 -1.817634,4.05282 -4.05281,4.05282"
style="fill:#f11e1e;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#f8a0a0;fill-opacity:1;stroke:none;stroke-width:0.108454;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect883"
width="1.228"
height="8.059844"
x="92.175156"
y="119.35728" />
<path
inkscape:connector-curvature="0"
id="path7261"
d="m 92.788964,126.29511 c -1.609548,0 -2.918685,-1.30916 -2.918685,-2.91871 0,-1.60954 1.309137,-2.91867 2.918685,-2.91867 1.609549,0 2.918682,1.30913 2.918682,2.91867 0,1.60955 -1.309133,2.91871 -2.918682,2.91871"
style="fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:#636663;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7265"
d="m 94.588681,123.3764 c 0,0.99357 -0.806153,1.79974 -1.799717,1.79974 -0.993567,0 -1.79972,-0.80617 -1.79972,-1.79974 0,-0.99356 0.806153,-1.79969 1.79972,-1.79969 0.993564,0 1.799717,0.80613 1.799717,1.79969"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.35277775" />
<path
inkscape:connector-curvature="0"
id="path7255-6"
d="m 92.788964,127.42922 c -2.235179,0 -4.05281,-1.81762 -4.05281,-4.05282 0,-2.23516 1.817631,-4.05281 4.05281,-4.05281 2.235176,0 4.05281,1.81765 4.05281,4.05281 0,2.2352 -1.817634,4.05282 -4.05281,4.05282"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#636663;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

+ 5
- 7
res/ChoppingKinky.svg View File

@@ -192,7 +192,7 @@
viewbox-width="209.8"
inkscape:window-width="2560"
inkscape:window-height="1361"
inkscape:window-x="2551"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:document-rotation="0"
@@ -205,7 +205,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -561,8 +561,7 @@
id="path3189-9"
sodipodi:nodetypes="cccc" />
<g
aria-label="CHOPPING
KINKY"
aria-label="CHOPPING KINKY"
transform="translate(0,168.5)"
id="text3213"
style="font-size:4.30503px;line-height:0.82;font-family:Miso;-inkscape-font-specification:Miso;letter-spacing:0.0449792px;word-spacing:0px;display:inline;stroke-width:0.230626">
@@ -730,8 +729,7 @@ KINKY"
id="path3559" />
</g>
<g
aria-label="CHOPP
OUT"
aria-label="CHOPP OUT"
id="text3333"
style="font-size:3.52777px;line-height:0.85;font-family:Miso;-inkscape-font-specification:Miso;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583">
<path
@@ -857,7 +855,7 @@ OUT"
inkscape:groupmode="layer"
id="layer3"
inkscape:label="tracer"
style="display:inline;opacity:0.428115"
style="display:none;opacity:0.428115"
sodipodi:insensitive="true">
<image
y="0"


+ 3
- 27714
res/HexmixVCA.svg
File diff suppressed because it is too large
View File


+ 54
- 54
src/ChoppingKinky.cpp View File

@@ -1,5 +1,5 @@
#include "plugin.hpp"
#include "VariableOversampling.hpp"
#include "Common.hpp"
static const size_t BUF_LEN = 32;
@@ -66,8 +66,8 @@ struct ChoppingKinky : Module {
};
dsp::SchmittTrigger trigger;
bool output_a_to_chopp;
float previous_a = 0.0;
bool outputAToChopp;
float previousA = 0.0;
VariableOversampling<> oversampler[NUM_CHANNELS];
int oversamplingIndex = 2;
@@ -101,65 +101,65 @@ struct ChoppingKinky : Module {
void process(const ProcessArgs& args) override {
float gain_a = params[FOLD_A_PARAM].getValue();
float gainA = params[FOLD_A_PARAM].getValue();
if (inputs[CV_A_INPUT].isConnected()) {
gain_a += params[CV_A_PARAM].getValue() * inputs[CV_A_INPUT].getVoltage() / 10.f;
gainA += params[CV_A_PARAM].getValue() * inputs[CV_A_INPUT].getVoltage() / 10.f;
}
if (inputs[VCA_CV_A_INPUT].isConnected()) {
gain_a += inputs[VCA_CV_A_INPUT].getVoltage() / 10.f;
gainA += inputs[VCA_CV_A_INPUT].getVoltage() / 10.f;
}
float gain_b = params[FOLD_B_PARAM].getValue();
float gainB = params[FOLD_B_PARAM].getValue();
if (inputs[CV_B_INPUT].isConnected()) {
gain_b += params[CV_B_PARAM].getValue() * inputs[CV_B_INPUT].getVoltage() / 10.f;
gainB += params[CV_B_PARAM].getValue() * inputs[CV_B_INPUT].getVoltage() / 10.f;
}
if (inputs[VCA_CV_B_INPUT].isConnected()) {
gain_b += inputs[VCA_CV_B_INPUT].getVoltage() / 10.f;
gainB += inputs[VCA_CV_B_INPUT].getVoltage() / 10.f;
}
float in_a = 0;
float in_b = 0;
float inA = 0;
float inB = 0;
if (inputs[IN_A_INPUT].isConnected()) {
in_a = inputs[IN_A_INPUT].getVoltage() / 5.0f;
inA = inputs[IN_A_INPUT].getVoltage() / 5.0f;
}
if (inputs[IN_B_INPUT].isConnected()) {
in_b = inputs[IN_B_INPUT].getVoltage() / 5.0f;
inB = inputs[IN_B_INPUT].getVoltage() / 5.0f;
}
else if (inputs[IN_A_INPUT].isConnected()) {
in_b = in_a;
inB = inA;
}
// if the CHOPP gate is wired in, do chop logic
if (inputs[IN_GATE_INPUT].isConnected()) {
// TODO: check rescale?
trigger.process(rescale(inputs[IN_GATE_INPUT].getVoltage(), 0.1f, 2.f, 0.f, 1.f));
output_a_to_chopp = trigger.isHigh();
outputAToChopp = trigger.isHigh();
}
else {
if (previous_a > 0 && in_a < 0) {
output_a_to_chopp = false;
if (previousA > 0 && inA < 0) {
outputAToChopp = false;
}
else if (previous_a < 0 && in_a > 0) {
output_a_to_chopp = true;
else if (previousA < 0 && inA > 0) {
outputAToChopp = true;
}
}
bool chopp_is_required = outputs[OUT_CHOPP_OUTPUT].isConnected();
bool a_is_required = outputs[OUT_A_OUTPUT].isConnected() || chopp_is_required;
bool b_is_required = outputs[OUT_B_OUTPUT].isConnected() || chopp_is_required;
bool choppIsRequired = outputs[OUT_CHOPP_OUTPUT].isConnected();
bool aIsRequired = outputs[OUT_A_OUTPUT].isConnected() || choppIsRequired;
bool bIsRequired = outputs[OUT_B_OUTPUT].isConnected() || choppIsRequired;
in_a = in_a * gain_a;
in_b = in_b * gain_b;
float in_chopp = output_a_to_chopp ? 1.f : 0.f;
inA = inA * gainA;
inB = inB * gainB;
float inChopp = outputAToChopp ? 1.f : 0.f;
if (a_is_required) {
oversampler[CHANNEL_A].upsample(in_a);
if (aIsRequired) {
oversampler[CHANNEL_A].upsample(inA);
}
if (b_is_required) {
oversampler[CHANNEL_B].upsample(in_b);
if (bIsRequired) {
oversampler[CHANNEL_B].upsample(inB);
}
if (chopp_is_required) {
oversampler[CHANNEL_CHOPP].upsample(in_chopp);
if (choppIsRequired) {
oversampler[CHANNEL_CHOPP].upsample(inChopp);
}
float* osBufferA = oversampler[CHANNEL_A].getOSBuffer();
@@ -167,33 +167,33 @@ struct ChoppingKinky : Module {
float* osBufferChopp = oversampler[CHANNEL_CHOPP].getOSBuffer();
for (int i = 0; i < oversampler[0].getOversamplingRatio(); i++) {
if (a_is_required) {
if (aIsRequired) {
osBufferA[i] = foldResponse(4.0f * osBufferA[i], -0.2);
}
if (b_is_required) {
if (bIsRequired) {
osBufferB[i] = foldResponseSin(4.0f * osBufferB[i]);
}
if (chopp_is_required) {
if (choppIsRequired) {
osBufferChopp[i] = osBufferChopp[i] * osBufferA[i] + (1.f - osBufferChopp[i]) * osBufferB[i];
}
}
float out_a = a_is_required ? oversampler[CHANNEL_A].downsample() : 0.f;
float out_b = b_is_required ? oversampler[CHANNEL_B].downsample() : 0.f;
float out_chopp = chopp_is_required ? oversampler[CHANNEL_CHOPP].downsample() : 0.f;
float outA = aIsRequired ? oversampler[CHANNEL_A].downsample() : 0.f;
float outB = bIsRequired ? oversampler[CHANNEL_B].downsample() : 0.f;
float outChopp = choppIsRequired ? oversampler[CHANNEL_CHOPP].downsample() : 0.f;
if (blockDC) {
out_chopp = blockDCFilter.process(out_chopp);
outChopp = blockDCFilter.process(outChopp);
}
previous_a = in_a;
previousA = inA;
outputs[OUT_A_OUTPUT].setVoltage(out_a * 5.0f);
outputs[OUT_B_OUTPUT].setVoltage(out_b * 5.0f);
outputs[OUT_CHOPP_OUTPUT].setVoltage(out_chopp * 5.0f);
outputs[OUT_A_OUTPUT].setVoltage(outA * 5.0f);
outputs[OUT_B_OUTPUT].setVoltage(outB * 5.0f);
outputs[OUT_CHOPP_OUTPUT].setVoltage(outChopp * 5.0f);
if (inputs[IN_GATE_INPUT].isConnected()) {
lights[LED_A_LIGHT].setSmoothBrightness((float) output_a_to_chopp, args.sampleTime);
lights[LED_B_LIGHT].setSmoothBrightness((float)(!output_a_to_chopp), args.sampleTime);
lights[LED_A_LIGHT].setSmoothBrightness((float) outputAToChopp, args.sampleTime);
lights[LED_B_LIGHT].setSmoothBrightness((float)(!outputAToChopp), args.sampleTime);
}
else {
lights[LED_A_LIGHT].setBrightness(0.f);
@@ -239,19 +239,19 @@ struct ChoppingKinkyWidget : ModuleWidget {
addParam(createParamCentered<BefacoTinyKnob>(mm2px(Vec(10.515, 83.321)), module, ChoppingKinky::CV_A_PARAM));
addParam(createParamCentered<BefacoTinyKnob>(mm2px(Vec(30.583, 83.321)), module, ChoppingKinky::CV_B_PARAM));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.35, 28.391)), module, ChoppingKinky::IN_A_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.35, 56.551)), module, ChoppingKinky::IN_B_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.35, 28.391)), module, ChoppingKinky::IN_A_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.35, 56.551)), module, ChoppingKinky::IN_B_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(26.106, 42.613)), module, ChoppingKinky::IN_GATE_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(26.106, 42.613)), module, ChoppingKinky::IN_GATE_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(5.189, 98.957)), module, ChoppingKinky::CV_A_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(15.19, 98.957)), module, ChoppingKinky::VCA_CV_A_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(25.19, 98.957)), module, ChoppingKinky::CV_B_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(35.19, 98.957)), module, ChoppingKinky::VCA_CV_B_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(5.189, 98.957)), module, ChoppingKinky::CV_A_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(15.19, 98.957)), module, ChoppingKinky::VCA_CV_A_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(25.19, 98.957)), module, ChoppingKinky::CV_B_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(35.19, 98.957)), module, ChoppingKinky::VCA_CV_B_INPUT));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(9.982, 111.076)), module, ChoppingKinky::OUT_A_OUTPUT));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(31.558, 111.076)), module, ChoppingKinky::OUT_B_OUTPUT));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(20.638, 110.15)), module, ChoppingKinky::OUT_CHOPP_OUTPUT));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(9.982, 111.076)), module, ChoppingKinky::OUT_A_OUTPUT));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(31.558, 111.076)), module, ChoppingKinky::OUT_B_OUTPUT));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(20.638, 110.15)), module, ChoppingKinky::OUT_CHOPP_OUTPUT));
addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(26.106, 33.342)), module, ChoppingKinky::LED_A_LIGHT));
addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(26.106, 51.717)), module, ChoppingKinky::LED_B_LIGHT));


src/VariableOversampling.hpp → src/Common.hpp View File

@@ -3,6 +3,33 @@
#include <rack.hpp>
#include <dsp/common.hpp>

struct BefacoTinyKnobRed : app::SvgKnob {
BefacoTinyKnobRed() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg")));
}
};

struct BefacoTinyKnobWhite : app::SvgKnob {
BefacoTinyKnobWhite() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg")));
}
};

struct BefacoOutputPort : app::SvgPort {
BefacoOutputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg")));
}
};

struct BefacoInputPort : app::SvgPort {
BefacoInputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg")));
}
};

/**
High-order filter to be used for anti-aliasing or anti-imaging.

+ 23
- 37
src/HexmixVCA.cpp View File

@@ -1,20 +1,6 @@
#include "plugin.hpp"
#include "Common.hpp"
struct BefacoTinyKnobRed : app::SvgKnob {
BefacoTinyKnobRed() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg")));
}
};
struct BefacoTinyKnobWhite : app::SvgKnob {
BefacoTinyKnobWhite() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg")));
}
};
static float gainFunction(float x, float shape) {
float lin = x;
@@ -77,8 +63,8 @@ struct HexmixVCA : Module {
int channels = 1;
simd::float_4 in[4] = {};
bool input_is_connected = inputs[IN_INPUT + row].isConnected();
if (input_is_connected) {
bool inputIsConnected = inputs[IN_INPUT + row].isConnected();
if (inputIsConnected) {
channels = inputs[row].getChannels();
maxChannels = std::max(maxChannels, channels);
@@ -151,26 +137,26 @@ struct HexmixVCAWidget : ModuleWidget {
addParam(createParamCentered<BefacoTinyKnobRed>(mm2px(Vec(35.458, 89.93)), module, HexmixVCA::VOL_PARAM + 4));
addParam(createParamCentered<BefacoTinyKnobRed>(mm2px(Vec(35.458, 108.536)), module, HexmixVCA::VOL_PARAM + 5));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 15.51)), module, HexmixVCA::IN_INPUT + 0));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 34.115)), module, HexmixVCA::IN_INPUT + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 52.72)), module, HexmixVCA::IN_INPUT + 2));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 71.325)), module, HexmixVCA::IN_INPUT + 3));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 89.93)), module, HexmixVCA::IN_INPUT + 4));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.581, 108.536)), module, HexmixVCA::IN_INPUT + 5));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 15.51)), module, HexmixVCA::CV_INPUT + 0));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 34.115)), module, HexmixVCA::CV_INPUT + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 52.72)), module, HexmixVCA::CV_INPUT + 2));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 71.325)), module, HexmixVCA::CV_INPUT + 3));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 89.93)), module, HexmixVCA::CV_INPUT + 4));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(52.083, 108.536)), module, HexmixVCA::CV_INPUT + 5));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 15.51)), module, HexmixVCA::OUT_OUTPUT + 0));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 34.115)), module, HexmixVCA::OUT_OUTPUT + 1));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 52.72)), module, HexmixVCA::OUT_OUTPUT + 2));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 71.325)), module, HexmixVCA::OUT_OUTPUT + 3));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 89.93)), module, HexmixVCA::OUT_OUTPUT + 4));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(64.222, 108.536)), module, HexmixVCA::OUT_OUTPUT + 5));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 15.51)), module, HexmixVCA::IN_INPUT + 0));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 34.115)), module, HexmixVCA::IN_INPUT + 1));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 52.72)), module, HexmixVCA::IN_INPUT + 2));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 71.325)), module, HexmixVCA::IN_INPUT + 3));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 89.93)), module, HexmixVCA::IN_INPUT + 4));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(6.581, 108.536)), module, HexmixVCA::IN_INPUT + 5));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 15.51)), module, HexmixVCA::CV_INPUT + 0));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 34.115)), module, HexmixVCA::CV_INPUT + 1));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 52.72)), module, HexmixVCA::CV_INPUT + 2));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 71.325)), module, HexmixVCA::CV_INPUT + 3));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 89.93)), module, HexmixVCA::CV_INPUT + 4));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(52.083, 108.536)), module, HexmixVCA::CV_INPUT + 5));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 15.51)), module, HexmixVCA::OUT_OUTPUT + 0));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 34.115)), module, HexmixVCA::OUT_OUTPUT + 1));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 52.72)), module, HexmixVCA::OUT_OUTPUT + 2));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 71.325)), module, HexmixVCA::OUT_OUTPUT + 3));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 89.93)), module, HexmixVCA::OUT_OUTPUT + 4));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(64.222, 108.536)), module, HexmixVCA::OUT_OUTPUT + 5));
}
};


+ 37
- 36
src/Percall.cpp View File

@@ -1,4 +1,5 @@
#include "plugin.hpp"
#include "Common.hpp"
static float expDelta(float delta, float tau) {
@@ -38,7 +39,7 @@ struct Percall : Module {
STAGE_DECAY
};
int stage[4] = {};
Stage stage[4] = {};
float env[4] = {};
float gains[4] = {};
float fallTimes[4] = {};
@@ -65,12 +66,13 @@ struct Percall : Module {
void process(const ProcessArgs& args) override {
strength = 1.0f;
if (inputs[STRENGTH_INPUT].isConnected()) {
strength = clamp(inputs[STRENGTH_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}
// only calculate gains/decays every 16 samples
if (cvDivider.process()) {
strength = 1.0f;
if (inputs[STRENGTH_INPUT].isConnected()) {
strength = clamp(inputs[STRENGTH_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}
for (int i = 0; i < 4; i++) {
gains[i] = std::pow(params[VOL_PARAMS + i].getValue(), 2.f) * strength;
@@ -95,8 +97,8 @@ struct Percall : Module {
stage[i] = STAGE_OFF;
}
float target_voltage = (stage[i] == STAGE_ATTACK) ? 10.0f : 0.0f;
float delta = target_voltage - env[i];
float targetVoltage = (stage[i] == STAGE_ATTACK) ? 10.0f : 0.0f;
float delta = targetVoltage - env[i];
if (stage[i] == STAGE_OFF) {
env[i] = 0.0f;
@@ -119,10 +121,10 @@ struct Percall : Module {
int channels = 1;
simd::float_4 in[4] = {};
bool input_is_connected = inputs[CH_INPUTS + i].isConnected();
bool input_is_normed = !input_is_connected && (i % 2) && inputs[CH_INPUTS + i - 1].isConnected();
if ((input_is_connected || input_is_normed)) {
int channel_to_read_from = input_is_normed ? CH_INPUTS + i - 1 : CH_INPUTS + i;
bool inputIsConnected = inputs[CH_INPUTS + i].isConnected();
bool inputIsNormed = !inputIsConnected && (i % 2) && inputs[CH_INPUTS + i - 1].isConnected();
if ((inputIsConnected || inputIsNormed)) {
int channel_to_read_from = inputIsNormed ? CH_INPUTS + i - 1 : CH_INPUTS + i;
channels = inputs[channel_to_read_from].getChannels();
maxChannels = std::max(maxChannels, channels);
@@ -202,31 +204,30 @@ struct PercallWidget : ModuleWidget {
addParam(createParam<CKSS>(mm2px(Vec(13.365, 58.672)), module, Percall::CHOKE_PARAMS + 0));
addParam(createParam<CKSS>(mm2px(Vec(42.993, 58.672)), module, Percall::CHOKE_PARAMS + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(7.173, 12.894)), module, Percall::CH_INPUTS + 0));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(20.335, 12.894)), module, Percall::CH_INPUTS + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(40.347, 12.894)), module, Percall::CH_INPUTS + 2));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(53.492, 12.894)), module, Percall::CH_INPUTS + 3));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(30.341, 18.236)), module, Percall::STRENGTH_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(7.173, 24.834)), module, Percall::TRIG_INPUTS + 0));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(18.547, 23.904)), module, Percall::TRIG_INPUTS + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(42.218, 23.904)), module, Percall::TRIG_INPUTS + 2));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(53.453, 24.834)), module, Percall::TRIG_INPUTS + 3));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(5.093, 101.799)), module, Percall::CV_INPUTS + 0));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(15.22, 101.799)), module, Percall::CV_INPUTS + 1));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(25.347, 101.799)), module, Percall::CV_INPUTS + 2));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(35.474, 101.799)), module, Percall::CV_INPUTS + 3));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(45.541, 101.699)), module, Percall::CH_OUTPUTS + 0));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(55.624, 101.699)), module, Percall::CH_OUTPUTS + 1));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(45.541, 113.696)), module, Percall::CH_OUTPUTS + 2));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(55.624, 113.696)), module, Percall::CH_OUTPUTS + 3));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(5.093, 113.74)), module, Percall::ENV_OUTPUTS + 0));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(15.22, 113.74)), module, Percall::ENV_OUTPUTS + 1));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(25.347, 113.74)), module, Percall::ENV_OUTPUTS + 2));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(35.474, 113.74)), module, Percall::ENV_OUTPUTS + 3));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(7.173, 12.894)), module, Percall::CH_INPUTS + 0));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(20.335, 12.894)), module, Percall::CH_INPUTS + 1));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(40.347, 12.894)), module, Percall::CH_INPUTS + 2));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(53.492, 12.894)), module, Percall::CH_INPUTS + 3));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(30.341, 18.236)), module, Percall::STRENGTH_INPUT));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(7.173, 24.834)), module, Percall::TRIG_INPUTS + 0));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(18.547, 23.904)), module, Percall::TRIG_INPUTS + 1));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(42.218, 23.904)), module, Percall::TRIG_INPUTS + 2));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(53.453, 24.834)), module, Percall::TRIG_INPUTS + 3));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(5.093, 101.799)), module, Percall::CV_INPUTS + 0));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(15.22, 101.799)), module, Percall::CV_INPUTS + 1));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(25.347, 101.799)), module, Percall::CV_INPUTS + 2));
addInput(createInputCentered<BefacoInputPort>(mm2px(Vec(35.474, 101.799)), module, Percall::CV_INPUTS + 3));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(45.541, 101.699)), module, Percall::CH_OUTPUTS + 0));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(55.624, 101.699)), module, Percall::CH_OUTPUTS + 1));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(45.541, 113.696)), module, Percall::CH_OUTPUTS + 2));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(55.624, 113.696)), module, Percall::CH_OUTPUTS + 3));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(5.093, 113.74)), module, Percall::ENV_OUTPUTS + 0));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(15.22, 113.74)), module, Percall::ENV_OUTPUTS + 1));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(25.347, 113.74)), module, Percall::ENV_OUTPUTS + 2));
addOutput(createOutputCentered<BefacoOutputPort>(mm2px(Vec(35.474, 113.74)), module, Percall::ENV_OUTPUTS + 3));
addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(8.107, 49.221)), module, Percall::LEDS + 0));
addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(22.934, 49.221)), module, Percall::LEDS + 1));


Loading…
Cancel
Save