| @@ -54,8 +54,7 @@ struct ABC : Module { | |||||
| configParam(C2_LEVEL_PARAM, -1.0, 1.0, 0.0, "C2 Level"); | configParam(C2_LEVEL_PARAM, -1.0, 1.0, 0.0, "C2 Level"); | ||||
| } | } | ||||
| int processSection(simd::float_4* out, InputIds inputA, InputIds inputB, InputIds inputC, | |||||
| ParamIds levelB, ParamIds levelC) { | |||||
| int processSection(simd::float_4* out, InputIds inputA, InputIds inputB, InputIds inputC, ParamIds levelB, ParamIds levelC) { | |||||
| float_4 inA[4] = {0.f}; | float_4 inA[4] = {0.f}; | ||||
| float_4 inB[4] = {0.f}; | float_4 inB[4] = {0.f}; | ||||
| @@ -139,33 +138,30 @@ struct ABC : Module { | |||||
| // Lights | // Lights | ||||
| float light_1; | |||||
| float light_2; | |||||
| if (activeEngines1 == 1) { | if (activeEngines1 == 1) { | ||||
| light_1 = out1[0].s[0]; | |||||
| lights[OUT1_LIGHT + 0].setSmoothBrightness(light_1 / 5.f, args.sampleTime); | |||||
| lights[OUT1_LIGHT + 1].setSmoothBrightness(-light_1 / 5.f, args.sampleTime); | |||||
| float b = out1[0].s[0]; | |||||
| lights[OUT1_LIGHT + 0].setSmoothBrightness(b / 5.f, args.sampleTime); | |||||
| lights[OUT1_LIGHT + 1].setSmoothBrightness(-b / 5.f, args.sampleTime); | |||||
| lights[OUT1_LIGHT + 2].setBrightness(0.f); | lights[OUT1_LIGHT + 2].setBrightness(0.f); | ||||
| } | } | ||||
| else { | else { | ||||
| light_1 = 10.f; | |||||
| float b = 10.f; | |||||
| lights[OUT1_LIGHT + 0].setBrightness(0.0f); | lights[OUT1_LIGHT + 0].setBrightness(0.0f); | ||||
| lights[OUT1_LIGHT + 1].setBrightness(0.0f); | lights[OUT1_LIGHT + 1].setBrightness(0.0f); | ||||
| lights[OUT1_LIGHT + 2].setBrightness(light_1); | |||||
| lights[OUT1_LIGHT + 2].setBrightness(b); | |||||
| } | } | ||||
| if (activeEngines2 == 1) { | if (activeEngines2 == 1) { | ||||
| light_2 = out2[0].s[0]; | |||||
| lights[OUT2_LIGHT + 0].setSmoothBrightness(light_2 / 5.f, args.sampleTime); | |||||
| lights[OUT2_LIGHT + 1].setSmoothBrightness(-light_2 / 5.f, args.sampleTime); | |||||
| float b = out2[0].s[0]; | |||||
| lights[OUT2_LIGHT + 0].setSmoothBrightness(b / 5.f, args.sampleTime); | |||||
| lights[OUT2_LIGHT + 1].setSmoothBrightness(-b / 5.f, args.sampleTime); | |||||
| lights[OUT2_LIGHT + 2].setBrightness(0.f); | lights[OUT2_LIGHT + 2].setBrightness(0.f); | ||||
| } | } | ||||
| else { | else { | ||||
| light_2 = 10.f; | |||||
| float b = 10.f; | |||||
| lights[OUT2_LIGHT + 0].setBrightness(0.0f); | lights[OUT2_LIGHT + 0].setBrightness(0.0f); | ||||
| lights[OUT2_LIGHT + 1].setBrightness(0.0f); | lights[OUT2_LIGHT + 1].setBrightness(0.0f); | ||||
| lights[OUT2_LIGHT + 2].setBrightness(light_2); | |||||
| lights[OUT2_LIGHT + 2].setBrightness(b); | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -44,9 +44,9 @@ struct ChoppingKinky : Module { | |||||
| float waveshapeBNegative[WAVESHAPE_CACHE_SIZE + 1] = {0.f}; | float waveshapeBNegative[WAVESHAPE_CACHE_SIZE + 1] = {0.f}; | ||||
| dsp::SchmittTrigger trigger; | dsp::SchmittTrigger trigger; | ||||
| bool outputAToChopp; | |||||
| bool outputAToChopp = false; | |||||
| float previousA = 0.0; | float previousA = 0.0; | ||||
| chowdsp::VariableOversampling<> oversampler[NUM_CHANNELS]; | chowdsp::VariableOversampling<> oversampler[NUM_CHANNELS]; | ||||
| int oversamplingIndex = 2; // default is 2^oversamplingIndex == x4 oversampling | int oversamplingIndex = 2; // default is 2^oversamplingIndex == x4 oversampling | ||||
| @@ -66,7 +66,7 @@ struct ChoppingKinky : Module { | |||||
| onSampleRateChange(); | onSampleRateChange(); | ||||
| } | } | ||||
| void onSampleRateChange() override { | |||||
| void onSampleRateChange() override { | |||||
| float sampleRate = APP->engine->getSampleRate(); | float sampleRate = APP->engine->getSampleRate(); | ||||
| blockDCFilter.setParameters(dsp::BiquadFilter::HIGHPASS, 10.3f / sampleRate, M_SQRT1_2, 1.0f); | blockDCFilter.setParameters(dsp::BiquadFilter::HIGHPASS, 10.3f / sampleRate, M_SQRT1_2, 1.0f); | ||||
| @@ -98,7 +98,7 @@ struct ChoppingKinky : Module { | |||||
| // TODO: check rescale? | // TODO: check rescale? | ||||
| trigger.process(rescale(inputs[IN_GATE_INPUT].getVoltage(), 0.1f, 2.f, 0.f, 1.f)); | trigger.process(rescale(inputs[IN_GATE_INPUT].getVoltage(), 0.1f, 2.f, 0.f, 1.f)); | ||||
| outputAToChopp = trigger.isHigh(); | outputAToChopp = trigger.isHigh(); | ||||
| } | |||||
| } | |||||
| // else zero-crossing detector on input A switches between A and B | // else zero-crossing detector on input A switches between A and B | ||||
| else { | else { | ||||
| if (previousA > 0 && inA < 0) { | if (previousA > 0 && inA < 0) { | ||||
| @@ -186,7 +186,6 @@ struct ChoppingKinky : Module { | |||||
| } | } | ||||
| static float wavefolderAResponse(float x) { | static float wavefolderAResponse(float x) { | ||||
| if (x < 0) { | if (x < 0) { | ||||
| return -wavefolderAResponse(-x); | return -wavefolderAResponse(-x); | ||||
| } | } | ||||
| @@ -278,14 +277,14 @@ struct ChoppingKinky : Module { | |||||
| } | } | ||||
| void dataFromJson(json_t* rootJ) override { | void dataFromJson(json_t* rootJ) override { | ||||
| json_t* modeJ = json_object_get(rootJ, "filterDC"); | |||||
| if (modeJ) { | |||||
| blockDC = json_boolean_value(modeJ); | |||||
| json_t* filterDCJ = json_object_get(rootJ, "filterDC"); | |||||
| if (filterDCJ) { | |||||
| blockDC = json_boolean_value(filterDCJ); | |||||
| } | } | ||||
| json_t* modeJOS = json_object_get(rootJ, "oversamplingIndex"); | |||||
| if (modeJOS) { | |||||
| oversamplingIndex = json_integer_value(modeJOS); | |||||
| json_t* oversamplingIndexJ = json_object_get(rootJ, "oversamplingIndex"); | |||||
| if (oversamplingIndexJ) { | |||||
| oversamplingIndex = json_integer_value(oversamplingIndexJ); | |||||
| onSampleRateChange(); | onSampleRateChange(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -323,34 +322,32 @@ struct ChoppingKinkyWidget : ModuleWidget { | |||||
| addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(26.057, 51.53)), module, ChoppingKinky::LED_B_LIGHT)); | addChild(createLightCentered<SmallLight<RedLight>>(mm2px(Vec(26.057, 51.53)), module, ChoppingKinky::LED_B_LIGHT)); | ||||
| } | } | ||||
| struct DCMenuItem : MenuItem { | |||||
| ChoppingKinky* module; | |||||
| void onAction(const event::Action& e) override { | |||||
| module->blockDC ^= true; | |||||
| } | |||||
| }; | |||||
| struct ModeItem : MenuItem { | |||||
| ChoppingKinky* module; | |||||
| int oversamplingIndex; | |||||
| void onAction(const event::Action& e) override { | |||||
| module->oversamplingIndex = oversamplingIndex; | |||||
| module->onSampleRateChange(); | |||||
| } | |||||
| }; | |||||
| void appendContextMenu(Menu* menu) override { | void appendContextMenu(Menu* menu) override { | ||||
| ChoppingKinky* module = dynamic_cast<ChoppingKinky*>(this->module); | ChoppingKinky* module = dynamic_cast<ChoppingKinky*>(this->module); | ||||
| assert(module); | assert(module); | ||||
| menu->addChild(new MenuSeparator()); | menu->addChild(new MenuSeparator()); | ||||
| struct DCMenuItem : MenuItem { | |||||
| ChoppingKinky* module; | |||||
| void onAction(const event::Action& e) override { | |||||
| module->blockDC ^= true; | |||||
| } | |||||
| }; | |||||
| DCMenuItem* dcItem = createMenuItem<DCMenuItem>("Block DC on Chopp", CHECKMARK(module->blockDC)); | DCMenuItem* dcItem = createMenuItem<DCMenuItem>("Block DC on Chopp", CHECKMARK(module->blockDC)); | ||||
| dcItem->module = module; | dcItem->module = module; | ||||
| menu->addChild(dcItem); | menu->addChild(dcItem); | ||||
| menu->addChild(createMenuLabel("Oversampling mode")); | menu->addChild(createMenuLabel("Oversampling mode")); | ||||
| struct ModeItem : MenuItem { | |||||
| ChoppingKinky* module; | |||||
| int oversamplingIndex; | |||||
| void onAction(const event::Action& e) override { | |||||
| module->oversamplingIndex = oversamplingIndex; | |||||
| module->onSampleRateChange(); | |||||
| } | |||||
| }; | |||||
| for (int i = 0; i < 5; i++) { | for (int i = 0; i < 5; i++) { | ||||
| ModeItem* modeItem = createMenuItem<ModeItem>(std::to_string(int (1 << i)) + "x"); | ModeItem* modeItem = createMenuItem<ModeItem>(std::to_string(int (1 << i)) + "x"); | ||||
| modeItem->rightText = CHECKMARK(module->oversamplingIndex == i); | modeItem->rightText = CHECKMARK(module->oversamplingIndex == i); | ||||
| @@ -35,8 +35,8 @@ struct DualAtenuverter : Module { | |||||
| void process(const ProcessArgs& args) override { | void process(const ProcessArgs& args) override { | ||||
| using simd::float_4; | using simd::float_4; | ||||
| float_4 out1[4]; | |||||
| float_4 out2[4]; | |||||
| float_4 out1[4] = {}; | |||||
| float_4 out2[4] = {}; | |||||
| int channels1 = inputs[IN1_INPUT].getChannels(); | int channels1 = inputs[IN1_INPUT].getChannels(); | ||||
| channels1 = channels1 > 0 ? channels1 : 1; | channels1 = channels1 > 0 ? channels1 : 1; | ||||
| @@ -51,8 +51,8 @@ struct EvenVCO : Module { | |||||
| configParam(PWM_PARAM, -1.0, 1.0, 0.0, "Pulse width"); | configParam(PWM_PARAM, -1.0, 1.0, 0.0, "Pulse width"); | ||||
| for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
| phase[i] = float_4(0.0f); | |||||
| tri[i] = float_4(0.0f); | |||||
| phase[i] = 0.f; | |||||
| tri[i] = 0.f; | |||||
| } | } | ||||
| for (int c = 0; c < PORT_MAX_CHANNELS; c++) | for (int c = 0; c < PORT_MAX_CHANNELS; c++) | ||||
| halfPhase[c] = false; | halfPhase[c] = false; | ||||
| @@ -84,7 +84,7 @@ struct EvenVCO : Module { | |||||
| pitch[c / 4] += inputs[PITCH2_INPUT].getPolyVoltageSimd<float_4>(c); | pitch[c / 4] += inputs[PITCH2_INPUT].getPolyVoltageSimd<float_4>(c); | ||||
| } | } | ||||
| if (inputs[FM_INPUT].isConnected()) { | |||||
| if (inputs[FM_INPUT].isConnected()) { | |||||
| for (int c = 0; c < channels; c += 4) | for (int c = 0; c < channels; c += 4) | ||||
| pitch[c / 4] += inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) / 4.f; | pitch[c / 4] += inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) / 4.f; | ||||
| } | } | ||||
| @@ -44,7 +44,6 @@ struct Kickall : Module { | |||||
| static const int UPSAMPLE = 8; | static const int UPSAMPLE = 8; | ||||
| chowdsp::Oversampling<UPSAMPLE> oversampler; | chowdsp::Oversampling<UPSAMPLE> oversampler; | ||||
| float shaperBuf[UPSAMPLE]; | |||||
| Kickall() { | Kickall() { | ||||
| config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); | config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); | ||||
| @@ -66,13 +65,11 @@ struct Kickall : Module { | |||||
| onSampleRateChange(); | onSampleRateChange(); | ||||
| } | } | ||||
| void onSampleRateChange() override { | |||||
| void onSampleRateChange() override { | |||||
| oversampler.reset(APP->engine->getSampleRate()); | oversampler.reset(APP->engine->getSampleRate()); | ||||
| } | } | ||||
| void process(const ProcessArgs& args) override { | void process(const ProcessArgs& args) override { | ||||
| // TODO: check values | // TODO: check values | ||||
| if (trigger.process(inputs[TRIGG_INPUT].getVoltage() / 2.0f + params[TRIGG_BUTTON_PARAM].getValue() * 10.0)) { | if (trigger.process(inputs[TRIGG_INPUT].getVoltage() / 2.0f + params[TRIGG_BUTTON_PARAM].getValue() * 10.0)) { | ||||
| volume.trigger(); | volume.trigger(); | ||||
| @@ -97,8 +94,7 @@ struct Kickall : Module { | |||||
| const float kickFrequency = std::max(10.0f, freq + bend * pitch.env); | const float kickFrequency = std::max(10.0f, freq + bend * pitch.env); | ||||
| const float phaseInc = clamp(args.sampleTime * kickFrequency / UPSAMPLE, 1e-6, 0.35f); | const float phaseInc = clamp(args.sampleTime * kickFrequency / UPSAMPLE, 1e-6, 0.35f); | ||||
| const float shape = clamp(inputs[SHAPE_INPUT].getVoltage() / 10.f + params[SHAPE_PARAM].getValue(), 0.0f, 1.0f) * 0.99f; | |||||
| const float shape = clamp(inputs[SHAPE_INPUT].getVoltage() / 10.f + params[SHAPE_PARAM].getValue(), 0.0f, 1.0f) * 0.99f; | |||||
| const float shapeB = (1.0f - shape) / (1.0f + shape); | const float shapeB = (1.0f - shape) / (1.0f + shape); | ||||
| const float shapeA = (4.0f * shape) / ((1.0f - shape) * (1.0f + shape)); | const float shapeA = (4.0f * shape) / ((1.0f - shape) * (1.0f + shape)); | ||||
| @@ -54,9 +54,7 @@ struct Mixer : Module { | |||||
| float_4 mult3 = float_4(params[CH3_PARAM].getValue()); | float_4 mult3 = float_4(params[CH3_PARAM].getValue()); | ||||
| float_4 mult4 = float_4(params[CH4_PARAM].getValue()); | float_4 mult4 = float_4(params[CH4_PARAM].getValue()); | ||||
| float_4 out[4]; | |||||
| std::memset(out, 0, sizeof(out)); | |||||
| float_4 out[4] = {}; | |||||
| if (inputs[IN1_INPUT].isConnected()) { | if (inputs[IN1_INPUT].isConnected()) { | ||||
| for (int c = 0; c < channels1; c += 4) | for (int c = 0; c < channels1; c += 4) | ||||