diff --git a/src/common/SurgeStorage.h b/src/common/SurgeStorage.h index 3e9d6bcfe55..efeb624e725 100644 --- a/src/common/SurgeStorage.h +++ b/src/common/SurgeStorage.h @@ -181,11 +181,16 @@ enum NoiseColorChannels enum RingModMode { rmm_ring = 0, - rmm_cxor = 1, - rmm_cxor_f1 = 2, - rmm_cxor_f2 = 3, - rmm_cxor_f3 = 4, - rmm_cxor_f4 = 5 + rmm_cxor43_0 = 1, + rmm_cxor43_1 = 2, + rmm_cxor43_2 = 3, + rmm_cxor43_3 = 4, + rmm_cxor43_4 = 5, + rmm_cxor93_0 = 6, + rmm_cxor93_1 = 7, + rmm_cxor93_2 = 8, + rmm_cxor93_3 = 9, + rmm_cxor93_4 = 10 }; enum lfo_trigger_mode diff --git a/src/common/dsp/SurgeVoice.cpp b/src/common/dsp/SurgeVoice.cpp index 6b18dce3562..f98f1770c68 100644 --- a/src/common/dsp/SurgeVoice.cpp +++ b/src/common/dsp/SurgeVoice.cpp @@ -843,25 +843,45 @@ inline void all_ring_modes_block(float *__restrict src1_l, float *__restrict src mul_block(src1_l, src2_l, dst_l, nquads); mul_block(src1_r, src2_r, dst_r, nquads); break; - case RingModMode::rmm_cxor: - cxor_block(src1_l, src2_l, dst_l, nquads); - cxor_block(src1_r, src2_r, dst_r, nquads); + case RingModMode::rmm_cxor43_0: + cxor43_0_block(src1_l, src2_l, dst_l, nquads); + cxor43_0_block(src1_r, src2_r, dst_r, nquads); break; - case RingModMode::rmm_cxor_f1: - cxor_f1_block(src1_l, src2_l, dst_l, nquads); - cxor_f1_block(src1_r, src2_r, dst_r, nquads); + case RingModMode::rmm_cxor43_1: + cxor43_1_block(src1_l, src2_l, dst_l, nquads); + cxor43_1_block(src1_r, src2_r, dst_r, nquads); break; - case RingModMode::rmm_cxor_f2: - cxor_f2_block(src1_l, src2_l, dst_l, nquads); - cxor_f2_block(src1_r, src2_r, dst_r, nquads); + case RingModMode::rmm_cxor43_2: + cxor43_2_block(src1_l, src2_l, dst_l, nquads); + cxor43_2_block(src1_r, src2_r, dst_r, nquads); break; - case RingModMode::rmm_cxor_f3: - cxor_f3_block(src1_l, src2_l, dst_l, nquads); - cxor_f3_block(src1_r, src2_r, dst_r, nquads); + case RingModMode::rmm_cxor43_3: + cxor43_3_block(src1_l, src2_l, dst_l, nquads); + cxor43_3_block(src1_r, src2_r, dst_r, nquads); break; - case RingModMode::rmm_cxor_f4: - cxor_f4_block(src1_l, src2_l, dst_l, nquads); - cxor_f4_block(src1_r, src2_r, dst_r, nquads); + case RingModMode::rmm_cxor43_4: + cxor43_4_block(src1_l, src2_l, dst_l, nquads); + cxor43_4_block(src1_r, src2_r, dst_r, nquads); + break; + case RingModMode::rmm_cxor93_0: + cxor93_0_block(src1_l, src2_l, dst_l, nquads); + cxor93_0_block(src1_r, src2_r, dst_r, nquads); + break; + case RingModMode::rmm_cxor93_1: + cxor93_1_block(src1_l, src2_l, dst_l, nquads); + cxor93_1_block(src1_r, src2_r, dst_r, nquads); + break; + case RingModMode::rmm_cxor93_2: + cxor93_2_block(src1_l, src2_l, dst_l, nquads); + cxor93_2_block(src1_r, src2_r, dst_r, nquads); + break; + case RingModMode::rmm_cxor93_3: + cxor93_3_block(src1_l, src2_l, dst_l, nquads); + cxor93_3_block(src1_r, src2_r, dst_r, nquads); + break; + case RingModMode::rmm_cxor93_4: + cxor93_4_block(src1_l, src2_l, dst_l, nquads); + cxor93_4_block(src1_r, src2_r, dst_r, nquads); break; default: mul_block(src1_l, src2_l, dst_l, nquads); @@ -877,20 +897,35 @@ inline void all_ring_modes_block(float *__restrict src1_l, float *__restrict src case RingModMode::rmm_ring: mul_block(src1_l, src2_l, dst_l, nquads); break; - case RingModMode::rmm_cxor: - cxor_block(src1_l, src2_l, dst_l, nquads); + case RingModMode::rmm_cxor43_0: + cxor43_0_block(src1_l, src2_l, dst_l, nquads); + break; + case RingModMode::rmm_cxor43_1: + cxor43_1_block(src1_l, src2_l, dst_l, nquads); + break; + case RingModMode::rmm_cxor43_2: + cxor43_2_block(src1_l, src2_l, dst_l, nquads); + break; + case RingModMode::rmm_cxor43_3: + cxor43_3_block(src1_l, src2_l, dst_l, nquads); + break; + case RingModMode::rmm_cxor43_4: + cxor43_4_block(src1_l, src2_l, dst_l, nquads); + break; + case RingModMode::rmm_cxor93_0: + cxor93_0_block(src1_l, src2_l, dst_l, nquads); break; - case RingModMode::rmm_cxor_f1: - cxor_f1_block(src1_l, src2_l, dst_l, nquads); + case RingModMode::rmm_cxor93_1: + cxor93_1_block(src1_l, src2_l, dst_l, nquads); break; - case RingModMode::rmm_cxor_f2: - cxor_f2_block(src1_l, src2_l, dst_l, nquads); + case RingModMode::rmm_cxor93_2: + cxor93_2_block(src1_l, src2_l, dst_l, nquads); break; - case RingModMode::rmm_cxor_f3: - cxor_f3_block(src1_l, src2_l, dst_l, nquads); + case RingModMode::rmm_cxor93_3: + cxor93_3_block(src1_l, src2_l, dst_l, nquads); break; - case RingModMode::rmm_cxor_f4: - cxor_f4_block(src1_l, src2_l, dst_l, nquads); + case RingModMode::rmm_cxor93_4: + cxor93_4_block(src1_l, src2_l, dst_l, nquads); break; default: mul_block(src1_l, src2_l, dst_l, nquads); diff --git a/src/common/dsp/vembertech/basic_dsp.h b/src/common/dsp/vembertech/basic_dsp.h index 1d93de92eaf..33b845b09cf 100644 --- a/src/common/dsp/vembertech/basic_dsp.h +++ b/src/common/dsp/vembertech/basic_dsp.h @@ -54,164 +54,107 @@ inline void mul_block(float *__restrict src1, float scalar, float *__restrict ds } } -inline void cxor_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, - unsigned int nquads) +inline void cxor43_0_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { dst[i] = fmin(fmax(src1[i], src2[i]), -fmin(src1[i], src2[i])); } } -inline void cxor_block(float *__restrict src1, float scalar, float *__restrict dst, - unsigned int nquads) -{ - for (auto i = 0U; i < nquads << 2; ++i) - { - dst[i] = fmin(fmax(src1[i], scalar), -fmin(src1[i], scalar)); - } -} -inline void cxor_f1_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, - unsigned int nquads) +inline void cxor43_1_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { const auto v1 = fmax(src1[i], src2[i]); const auto cx = fmin(v1, -fmin(src1[i], src2[i])); - const auto v2 = -fmin(cx, v1); - dst[i] = fmin(v1, v2); - } -} -inline void cxor_f1_block(float *__restrict src1, float scalar, float *__restrict dst, - unsigned int nquads) -{ - for (auto i = 0U; i < nquads << 2; ++i) - { - const auto v1 = fmax(src1[i], scalar); - const auto cx = fmin(v1, -fmin(src1[i], scalar)); - const auto v2 = -fmin(cx, v1); - dst[i] = fmin(v1, v2); + dst[i] = fmin(v1, -fmin(cx, v1)); } } -inline void cxor_f2_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, - unsigned int nquads) +inline void cxor43_2_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { const auto v1 = fmax(src1[i], src2[i]); const auto cx = fmin(v1, -fmin(src1[i], src2[i])); - const auto v2 = -fmin(cx, v1); - dst[i] = fmin(src1[i], v2); - } -} -inline void cxor_f2_block(float *__restrict src1, float scalar, float *__restrict dst, - unsigned int nquads) -{ - for (auto i = 0U; i < nquads << 2; ++i) - { - const auto v1 = fmax(src1[i], scalar); - const auto cx = fmin(v1, -fmin(src1[i], scalar)); - const auto v2 = -fmin(cx, v1); - dst[i] = fmin(src1[i], v2); + dst[i] = fmin(src1[i], -fmin(cx, v1)); } } -inline void cxor_st12_block(float *__restrict src1, float *__restrict src2, float *__restrict dst_l, - float *__restrict dst_r, unsigned int nquads) -{ - for (auto i = 0U; i < nquads << 2; ++i) - { - const auto v1 = fmax(src1[i], src2[i]); - const auto cx = fmin(v1, -fmin(src1[i], src2[i])); - const auto v2 = -fmin(cx, v1); - dst_l[i] = fmin(v1, v2); - dst_r[i] = fmin(src1[i], v2); - } -} -inline void cxor_st12_block(float *__restrict src1, float scalar, float *__restrict dst_l, - float *__restrict dst_r, unsigned int nquads) +inline void cxor43_3_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto v1 = fmax(src1[i], scalar); - const auto cx = fmin(v1, -fmin(src1[i], scalar)); - const auto v2 = -fmin(cx, v1); - dst_l[i] = fmin(v1, v2); - dst_r[i] = fmin(src1[i], v2); + const auto cx = fmin(fmax(src1[i], src2[i]), -fmin(src1[i], src2[i])); + dst[i] = fmin(-fmin(cx, src2[i]), fmax(src1[i], -src2[i])); } } -inline void cxor_f3_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, - unsigned int nquads) +inline void cxor43_4_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { const auto cx = fmin(fmax(src1[i], src2[i]), -fmin(src1[i], src2[i])); - const auto v1 = -fmin(cx, src2[i]); - const auto v2 = fmax(src1[i], -src2[i]); - dst[i] = fmin(v1, v2); + dst[i] = fmin(-fmin(cx, src2[i]), fmax(src1[i], -cx)); } } -inline void cxor_f3_block(float *__restrict src1, float scalar, float *__restrict dst, - unsigned int nquads) + +inline void cxor93_0_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto cx = fmin(fmax(src1[i], scalar), -fmin(src1[i], scalar)); - const auto v1 = -fmin(cx, scalar); - const auto v2 = fmax(src1[i], -scalar); - dst[i] = fmin(v1, v2); + auto p = src1[i] + src2[i]; + auto m = src1[i] - src2[i]; + dst[i] = fmin(fmax(p, m), -fmin(p, m)); } } -inline void cxor_f4_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, - unsigned int nquads) +inline void cxor93_1_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto cx = fmin(fmax(src1[i], src2[i]), -fmin(src1[i], src2[i])); - const auto v1 = -fmin(cx, src2[i]); - const auto v3 = fmax(src1[i], -cx); - dst[i] = fmin(v1, v3); + dst[i] = src1[i] - fmin(fmax(src2[i], fmin(src1[i], 0)), fmax(src1[i], 0)); } } -inline void cxor_f4_block(float *__restrict src1, float scalar, float *__restrict dst, - unsigned int nquads) + +inline void cxor93_2_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto cx = fmin(fmax(src1[i], scalar), -fmin(src1[i], scalar)); - const auto v1 = -fmin(cx, scalar); - const auto v3 = fmax(src1[i], -cx); - dst[i] = fmin(v1, v3); + auto p = src2[i] + src1[i]; + auto mf = src2[i] - src1[i]; + dst[i] = fmin(src2[i], fmax(0, fmin(p, mf))); } } -inline void cxor_st34_block(float *__restrict src1, float *__restrict src2, float *__restrict dst_l, - float *__restrict dst_r, unsigned int nquads) +inline void cxor93_3_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto cx = fmin(fmax(src1[i], src2[i]), -fmin(src1[i], src2[i])); - const auto v1 = -fmin(cx, src2[i]); - const auto v2 = fmax(src1[i], -src2[i]); - const auto v3 = fmax(src1[i], -cx); - dst_l[i] = fmin(v1, v2); - dst_r[i] = fmin(v1, v3); + auto p = src2[i] + src1[i]; + auto mf = src2[i] - src1[i]; + dst[i] = fmin(fmax(src2[i], p), fmax(0, fmin(p, mf))); } } -inline void cxor_st34_block(float *__restrict src1, float scalar, float *__restrict dst_l, - float *__restrict dst_r, unsigned int nquads) + +inline void cxor93_4_block(float *__restrict src1, float *__restrict src2, float *__restrict dst, + unsigned int nquads) { for (auto i = 0U; i < nquads << 2; ++i) { - const auto cx = fmin(fmax(src1[i], scalar), -fmin(src1[i], scalar)); - const auto v1 = -fmin(cx, scalar); - const auto v2 = fmax(src1[i], -scalar); - const auto v3 = fmax(src1[i], -cx); - dst_l[i] = fmin(v1, v2); - dst_r[i] = fmin(v1, v3); + auto p = src2[i] + src1[i]; + auto mf = src2[i] - src1[i]; + dst[i] = fmax(fmin(fmax(-src1[i], src2[i]), mf), fmin(p, -p)); } } diff --git a/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp b/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp index 793d37a09f9..2edd30665c6 100644 --- a/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp +++ b/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp @@ -2367,45 +2367,96 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c synth->storage.getPatch().isDirty = true; frame->repaint(); }); - contextMenu.addItem("CXOR", true, dt == RingModMode::rmm_cxor, [this, p]() { - undoManager()->pushParameterChange(p->id, p, p->val); + contextMenu.addItem("CXOR: cx4,3-bc-ba-bc-ba (0)", true, + dt == RingModMode::rmm_cxor43_0, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); - p->deform_type = RingModMode::rmm_cxor, - synth->storage.getPatch().isDirty = true; - frame->repaint(); - }); - contextMenu.addItem( - "CXOR func1", true, dt == RingModMode::rmm_cxor_f1, [this, p]() { - undoManager()->pushParameterChange(p->id, p, p->val); + p->deform_type = RingModMode::rmm_cxor43_0, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx4,3-bc-ba-ba-bc (1)", true, + dt == RingModMode::rmm_cxor43_1, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); - p->deform_type = RingModMode::rmm_cxor_f1, - synth->storage.getPatch().isDirty = true; - frame->repaint(); - }); - contextMenu.addItem( - "CXOR func2", true, dt == RingModMode::rmm_cxor_f2, [this, p]() { - undoManager()->pushParameterChange(p->id, p, p->val); + p->deform_type = RingModMode::rmm_cxor43_1, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx4,3-bc-ba-aa-bc (2)", true, + dt == RingModMode::rmm_cxor43_2, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); - p->deform_type = RingModMode::rmm_cxor_f2, - synth->storage.getPatch().isDirty = true; - frame->repaint(); - }); - contextMenu.addItem( - "CXOR func3", true, dt == RingModMode::rmm_cxor_f3, [this, p]() { - undoManager()->pushParameterChange(p->id, p, p->val); + p->deform_type = RingModMode::rmm_cxor43_2, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx4,3-bc-cc-ba-bc (3)", true, + dt == RingModMode::rmm_cxor43_3, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); - p->deform_type = RingModMode::rmm_cxor_f3, - synth->storage.getPatch().isDirty = true; - frame->repaint(); - }); - contextMenu.addItem( - "CXOR func4", true, dt == RingModMode::rmm_cxor_f4, [this, p]() { - undoManager()->pushParameterChange(p->id, p, p->val); + p->deform_type = RingModMode::rmm_cxor43_3, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx4,3-bc-bc-ba-bc (4)", true, + dt == RingModMode::rmm_cxor43_4, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); - p->deform_type = RingModMode::rmm_cxor_f4, - synth->storage.getPatch().isDirty = true; - frame->repaint(); - }); + p->deform_type = RingModMode::rmm_cxor43_4, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx9,3-cb-ab-cb-ab (0)", true, + dt == RingModMode::rmm_cxor93_0, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); + + p->deform_type = RingModMode::rmm_cxor93_0, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx9,3-bb-cc-bb-aa (1)", true, + dt == RingModMode::rmm_cxor93_1, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); + + p->deform_type = RingModMode::rmm_cxor93_1, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx9,3-cb-ba-aa-bb (2)", true, + dt == RingModMode::rmm_cxor93_2, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); + + p->deform_type = RingModMode::rmm_cxor93_2, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx9,3-cb-bb-aa-bb (3)", true, + dt == RingModMode::rmm_cxor93_3, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); + + p->deform_type = RingModMode::rmm_cxor93_3, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("CXOR: cx9,3-cb-ab-ab-cc (4)", true, + dt == RingModMode::rmm_cxor93_4, [this, p]() { + undoManager()->pushParameterChange(p->id, p, + p->val); + + p->deform_type = RingModMode::rmm_cxor93_4, + synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); } default: {