MCPcopy Create free account
hub / github.com/VCVRack/Befaco / Atte

Class Atte

src/Atte.cpp:5–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using simd::float_4;
4
5struct Atte : Module {
6 enum ParamId {
7 GAIN_A_PARAM,
8 GAIN_B_PARAM,
9 GAIN_C_PARAM,
10 GAIN_D_PARAM,
11 MODE_A_PARAM,
12 MODE_B_PARAM,
13 MODE_C_PARAM,
14 MODE_D_PARAM,
15 PARAMS_LEN
16 };
17 enum InputId {
18 A_INPUT,
19 B_INPUT,
20 C_INPUT,
21 D_INPUT,
22 INPUTS_LEN
23 };
24 enum OutputId {
25 A_OUTPUT,
26 B_OUTPUT,
27 C_OUTPUT,
28 D_OUTPUT,
29 OUTPUTS_LEN
30 };
31 enum LightId {
32 ENUMS(A_LIGHT, 3),
33 ENUMS(B_LIGHT, 3),
34 ENUMS(C_LIGHT, 3),
35 ENUMS(D_LIGHT, 3),
36 LIGHTS_LEN
37 };
38 const int NUM_CHANNELS = 4;
39
40 dsp::ClockDivider lightDivider;
41 int normalledVoltageIdx = 2; // 0 - +1V, 1 - +5V, 2 - +10V
42 const float normalledVoltages[3] = {1.f, 5.f, 10.f};
43
44 Atte() {
45 config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);
46 configParam(GAIN_A_PARAM, 0.f, 1.f, 1.f, "Gain A");
47 configParam(GAIN_B_PARAM, 0.f, 1.f, 1.f, "Gain B");
48 configParam(GAIN_C_PARAM, 0.f, 1.f, 1.f, "Gain C");
49 configParam(GAIN_D_PARAM, 0.f, 1.f, 1.f, "Gain D");
50 configSwitch(MODE_A_PARAM, 0.f, 1.f, 1.f, "Mode A", {"Inverse Attenutation", "Attenuation"});
51 configSwitch(MODE_B_PARAM, 0.f, 1.f, 1.f, "Mode B", {"Inverse Attenutation", "Attenuation"});
52 configSwitch(MODE_C_PARAM, 0.f, 1.f, 1.f, "Mode C", {"Inverse Attenutation", "Attenuation"});
53 configSwitch(MODE_D_PARAM, 0.f, 1.f, 1.f, "Mode D", {"Inverse Attenutation", "Attenuation"});
54
55 auto inputA = configInput(A_INPUT, "A");
56 inputA->description = "Normalled to +10V";
57 auto inputB = configInput(B_INPUT, "B");
58 inputB->description = "Normalled to input A";
59 auto inputC = configInput(C_INPUT, "C");
60 inputC->description = "Normalled to input B";
61 auto inputD = configInput(D_INPUT, "D");
62 inputD->description = "Normalled to input C";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected