diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ecee959126d..5b33da8d3ad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,14 +63,6 @@ jobs: cmakeArguments: "-GNinja -DCMAKE_BUILD_TYPE=Debug" cmakeTarget: "code-quality-pipeline-checks" cmakeConfig: "Debug" - linux-clang-juce-lv2: - imageName: 'ubuntu-20.04' - isLinux: True - aptGetExtras: "clang" - needsLV2: True - cmakeArguments: "-GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DJUCE_SUPPORTS_LV2=True -DSURGE_JUCE_PATH=$PWD/libs/JUCE-lv2" - cmakeTarget: "surge-xt_LV2" - cmakeConfig: "Debug" linux-juce-python-targets: imageName: 'ubuntu-22.04' isLinux: True @@ -154,18 +146,6 @@ jobs: condition: variables.isLinux displayName: linux - run apt-get - - bash: | - set -e - cd libs - sudo apt-get install -y lv2-dev - git clone --depth 1 --branch lv2 https://github.com/lv2-porting-project/JUCE JUCE-lv2 - cd JUCE-lv2 - git checkout lv2 - - cd .. - displayName: linux - grab LV2 JUCE - condition: variables.needsLV2 - - bash: | sudo xcode-select -s /Applications/Xcode_13.4.1.app displayName: Select XCode 13.4.1 @@ -180,15 +160,6 @@ jobs: set -e cmake --build build --config $(cmakeConfig) --target $(cmakeTarget) --parallel 8 displayName: all - build with cmake - condition: not(variables.needsLV2) - - - bash: | - set -e - - export SURGE_DATA_HOME=`pwd`/resources/data - cmake --build build --config $(cmakeConfig) --target $(cmakeTarget) --parallel 8 - displayName: all - build with cmake - condition: variables.needsLV2 #- bash: | diff --git a/libs/JUCE b/libs/JUCE index 3d663fad377..813456faf25 160000 --- a/libs/JUCE +++ b/libs/JUCE @@ -1 +1 @@ -Subproject commit 3d663fad37799a8c0091a7e60da220adb469f608 +Subproject commit 813456faf257a3ec13a6dc279aec92b923aacb53 diff --git a/libs/sst/sst-basic-blocks b/libs/sst/sst-basic-blocks index 98ba4587d5c..1843aab5cd6 160000 --- a/libs/sst/sst-basic-blocks +++ b/libs/sst/sst-basic-blocks @@ -1 +1 @@ -Subproject commit 98ba4587d5cdcbb8dee090db814b32ce4c946a44 +Subproject commit 1843aab5cd6f23f78cef4bdee5348feb0a76cfc0 diff --git a/libs/sst/sst-filters b/libs/sst/sst-filters index a0ce9e83534..5fa85393e65 160000 --- a/libs/sst/sst-filters +++ b/libs/sst/sst-filters @@ -1 +1 @@ -Subproject commit a0ce9e835347bf16099901d5f1bbbb2c1d3ae84d +Subproject commit 5fa85393e655dec6de281cf6919319ac5738e26f diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac97d169c35..979fc947d12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,9 @@ option(SURGE_BUILD_XT "Build Surge XT synth" ON) option(SURGE_BUILD_PYTHON_BINDINGS "Build Surge Python bindings with pybind11" OFF) option(SURGE_COPY_TO_PRODUCTS "Copy built plugins to the products directory" ON) option(SURGE_COPY_AFTER_BUILD "Copy JUCE plugins to system plugin area after build" OFF) + +# Currently the JUCE LV2 build crashes in our CI pipeline, so leave it for users to self build +option(SURGE_BUILD_LV2 "Build Surge as an LV2" OFF) if (NOT SURGE_COMPILE_BLOCK_SIZE) set(SURGE_COMPILE_BLOCK_SIZE 32) endif() @@ -95,19 +98,13 @@ if(DEFINED ENV{VST2SDK_DIR}) add_compile_options($<$:/wd4828>) endif() -if(JUCE_SUPPORTS_LV2) +if(JUCE_SUPPORTS_LV2 AND SURGE_BUILD_LV2) list(APPEND SURGE_JUCE_FORMATS LV2) message(STATUS "Including JUCE LV2 support. You will need the LV2 fork of JUCE!") message(STATUS "Turning off deprecation warning to error, since JUCE LV2 uses deprecated APIs") add_compile_options(-Wno-error=deprecated-declarations) endif() -if(EXISTS ${SURGE_JUCE_PATH}/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp) - message(STATUS "JUCE7 LV2 support present; activating LV2") - list(APPEND SURGE_JUCE_FORMATS LV2) - target_compile_definitions(surge-juce INTERFACE SURGE_HAS_JUCE7=1) -endif() - if(DEFINED ENV{ASIOSDK_DIR} OR BUILD_USING_MY_ASIO_LICENSE) if(BUILD_USING_MY_ASIO_LICENSE) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0bcf91049c0..63d5b3c9005 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -31,11 +31,11 @@ else() target_compile_definitions(luajit-5.1 INTERFACE HAS_LUA=0) endif() +surge_add_lib_subdirectory(sst/sst-basic-blocks) surge_add_lib_subdirectory(sst/sst-cpputils) surge_add_lib_subdirectory(sst/sst-plugininfra) surge_add_lib_subdirectory(sst/sst-filters) surge_add_lib_subdirectory(sst/sst-waveshapers) -surge_add_lib_subdirectory(sst/sst-basic-blocks) set(PEGTL_BUILD_TESTS OFF CACHE BOOL "") set(PEGTL_BUILD_EXAMPLES OFF CACHE BOOL "") @@ -279,7 +279,6 @@ add_library(${PROJECT_NAME} dsp/oscillators/WindowOscillator.h dsp/utilities/DSPUtils.cpp dsp/utilities/DSPUtils.h - dsp/utilities/FastMath.h dsp/utilities/SSEComplex.h dsp/utilities/SSESincDelayLine.h dsp/vembertech/basic_dsp.cpp diff --git a/src/common/SurgeStorage.h b/src/common/SurgeStorage.h index 107795b3ae1..0394dd90688 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/Oscillator.cpp b/src/common/dsp/Oscillator.cpp index 10c06314f1e..2d2dc1932dd 100644 --- a/src/common/dsp/Oscillator.cpp +++ b/src/common/dsp/Oscillator.cpp @@ -15,7 +15,7 @@ #include "Oscillator.h" #include "DSPUtils.h" -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" #include #include "AliasOscillator.h" 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/effects/RingModulatorEffect.cpp b/src/common/dsp/effects/RingModulatorEffect.cpp index 06c0b600238..d30e9879e06 100644 --- a/src/common/dsp/effects/RingModulatorEffect.cpp +++ b/src/common/dsp/effects/RingModulatorEffect.cpp @@ -2,7 +2,7 @@ #include "Tunings.h" #include "SineOscillator.h" #include "DebugHelpers.h" -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" // http://recherche.ircam.fr/pub/dafx11/Papers/66_e.pdf @@ -119,8 +119,9 @@ void RingModulatorEffect::process(float *dataL, float *dataR) { // TODO efficiency of course auto vc = SineOscillator::valueFromSinAndCos( - Surge::DSP::fastsin(2.0 * M_PI * (phase[u] - 0.5)), - Surge::DSP::fastcos(2.0 * M_PI * (phase[u] - 0.5)), *pd_int[rm_carrier_shape]); + sst::basic_blocks::dsp::fastsin(2.0 * M_PI * (phase[u] - 0.5)), + sst::basic_blocks::dsp::fastcos(2.0 * M_PI * (phase[u] - 0.5)), + *pd_int[rm_carrier_shape]); phase[u] += dphase[u]; if (phase[u] > 1) diff --git a/src/common/dsp/effects/WaveShaperEffect.cpp b/src/common/dsp/effects/WaveShaperEffect.cpp index 4cc25c21718..a834e773df2 100644 --- a/src/common/dsp/effects/WaveShaperEffect.cpp +++ b/src/common/dsp/effects/WaveShaperEffect.cpp @@ -15,7 +15,7 @@ #include "WaveShaperEffect.h" #include "DebugHelpers.h" -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" // http://recherche.ircam.fr/pub/dafx11/Papers/66_e.pdf diff --git a/src/common/dsp/effects/chowdsp/shared/wdf_sse.h b/src/common/dsp/effects/chowdsp/shared/wdf_sse.h index b107b67ae8a..4c820043dfc 100644 --- a/src/common/dsp/effects/chowdsp/shared/wdf_sse.h +++ b/src/common/dsp/effects/chowdsp/shared/wdf_sse.h @@ -4,7 +4,7 @@ #include #include #include -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" #include "portable_intrinsics.h" namespace chowdsp diff --git a/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.cpp b/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.cpp index 5116bdf51d1..182df584a78 100644 --- a/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.cpp +++ b/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.cpp @@ -1,7 +1,7 @@ #include #include "SpringReverbProc.h" -#include "utilities/FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" namespace { @@ -111,7 +111,7 @@ void SpringReverbProc::processBlock(float *left, float *right, const int numSamp } auto doSpringInput = [=](int ch, float input, int n) -> float { - auto output = Surge::DSP::fasttanh(input - feedbackGain * delay.popSample(ch)); + auto output = sst::basic_blocks::dsp::fasttanh(input - feedbackGain * delay.popSample(ch)); return dcBlocker.processSample(ch, output) + shortShakeBuffer[n]; }; diff --git a/src/common/dsp/effects/chowdsp/tape/HysteresisOps.h b/src/common/dsp/effects/chowdsp/tape/HysteresisOps.h index 516c8fcaf25..e66d73d667b 100644 --- a/src/common/dsp/effects/chowdsp/tape/HysteresisOps.h +++ b/src/common/dsp/effects/chowdsp/tape/HysteresisOps.h @@ -1,7 +1,8 @@ #pragma once #include -#include "FastMath.h" +#include "globals.h" +#include "sst/basic-blocks/dsp/FastMath.h" #define CHOWTAPE_HYSTERESIS_USE_SIMD 1 diff --git a/src/common/dsp/modulators/MSEGModulationHelper.cpp b/src/common/dsp/modulators/MSEGModulationHelper.cpp index 5be0e53fba0..dc4f8678413 100644 --- a/src/common/dsp/modulators/MSEGModulationHelper.cpp +++ b/src/common/dsp/modulators/MSEGModulationHelper.cpp @@ -18,7 +18,7 @@ #include #include "DebugHelpers.h" #include "basic_dsp.h" // for limit_range -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" namespace Surge { diff --git a/src/common/dsp/oscillators/SineOscillator.cpp b/src/common/dsp/oscillators/SineOscillator.cpp index 66ca590b5b0..48df1c0cd12 100644 --- a/src/common/dsp/oscillators/SineOscillator.cpp +++ b/src/common/dsp/oscillators/SineOscillator.cpp @@ -14,7 +14,7 @@ */ #include "SineOscillator.h" -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" #include /* @@ -671,10 +671,10 @@ void SineOscillator::process_block_internal(float pitch, float drift, float fmde auto lv = _mm_load_ps(&lastvalue[u]); auto x = _mm_add_ps(_mm_add_ps(ph, lv), fmpds); - x = Surge::DSP::clampToPiRangeSSE(x); + x = sst::basic_blocks::dsp::clampToPiRangeSSE(x); - auto sxl = Surge::DSP::fastsinSSE(x); - auto cxl = Surge::DSP::fastcosSSE(x); + auto sxl = sst::basic_blocks::dsp::fastsinSSE(x); + auto cxl = sst::basic_blocks::dsp::fastcosSSE(x); auto out_local = valueFromSinAndCosForMode(sxl, cxl, std::min(n_unison - u, 4)); @@ -787,8 +787,9 @@ void SineOscillator::process_block_legacy(float pitch, float drift, bool stereo, for (int u = 0; u < n_unison; u++) { - float out_local = singleValueFromSinAndCos(Surge::DSP::fastsin(phase[u]), - Surge::DSP::fastcos(phase[u])); + float out_local = + singleValueFromSinAndCos(sst::basic_blocks::dsp::fastsin(phase[u]), + sst::basic_blocks::dsp::fastcos(phase[u])); outL += (panL[u] * out_local) * out_attenuation * playingramp[u]; outR += (panR[u] * out_local) * out_attenuation * playingramp[u]; @@ -799,7 +800,7 @@ void SineOscillator::process_block_legacy(float pitch, float drift, bool stereo, playingramp[u] = 1; phase[u] += omega[u] + master_osc[k] * FMdepth.v; - phase[u] = Surge::DSP::clampToPiRange(phase[u]); + phase[u] = sst::basic_blocks::dsp::clampToPiRange(phase[u]); } FMdepth.process(); diff --git a/src/common/dsp/oscillators/StringOscillator.cpp b/src/common/dsp/oscillators/StringOscillator.cpp index 7c68700b22f..6fab749dc51 100644 --- a/src/common/dsp/oscillators/StringOscillator.cpp +++ b/src/common/dsp/oscillators/StringOscillator.cpp @@ -14,7 +14,7 @@ */ #include "globals.h" -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" /* * String oscillator is a self-oscillating delay with various filters and @@ -689,7 +689,8 @@ void StringOscillator::process_block_internal(float pitch, float drift, bool ste if (FM) { - v *= Surge::DSP::fastexp(limit_range(fmdepth.v * master_osc[i] * 3, -6.f, 4.f)); + v *= sst::basic_blocks::dsp::fastexp( + limit_range(fmdepth.v * master_osc[i] * 3, -6.f, 4.f)); } v *= OS; diff --git a/src/common/dsp/utilities/FastMath.h b/src/common/dsp/utilities/FastMath.h deleted file mode 100644 index ab6509f0761..00000000000 --- a/src/common/dsp/utilities/FastMath.h +++ /dev/null @@ -1,225 +0,0 @@ -#pragma once - -#include "globals.h" -#include - -/* -** Fast Math Approximations to various Functions -** -** Documentation on each one -*/ - -/* -** These are directly copied from JUCE6 modules/juce_dsp/mathos/juce_FastMathApproximations.h -** -** Since JUCE6 is GPL3 and Surge is GPL3 that copy is fine, but I did want to explicitly -** acknowledge it -*/ - -namespace Surge -{ -namespace DSP -{ - -// JUCE6 Pade approximation of sin valid from -PI to PI with max error of 1e-5 and average error of -// 5e-7 -inline float fastsin(float x) noexcept -{ - auto x2 = x * x; - auto numerator = -x * (-(float)11511339840 + - x2 * ((float)1640635920 + x2 * (-(float)52785432 + x2 * (float)479249))); - auto denominator = - (float)11511339840 + x2 * ((float)277920720 + x2 * ((float)3177720 + x2 * (float)18361)); - return numerator / denominator; -} - -inline __m128 fastsinSSE(__m128 x) noexcept -{ -#define M(a, b) _mm_mul_ps(a, b) -#define A(a, b) _mm_add_ps(a, b) -#define S(a, b) _mm_sub_ps(a, b) -#define F(a) _mm_set_ps1(a) -#define C(x) __m128 m##x = F((float)x) - - /* - auto numerator = -x * (-(float)11511339840 + - x2 * ((float)1640635920 + x2 * (-(float)52785432 + x2 * (float)479249))); - auto denominator = - (float)11511339840 + x2 * ((float)277920720 + x2 * ((float)3177720 + x2 * (float)18361)); - */ - C(11511339840); - C(1640635920); - C(52785432); - C(479249); - C(277920720); - C(3177720); - C(18361); - auto mnegone = F(-1); - - auto x2 = M(x, x); - - auto num = M(mnegone, - M(x, S(M(x2, A(m1640635920, M(x2, S(M(x2, m479249), m52785432)))), m11511339840))); - auto den = A(m11511339840, M(x2, A(m277920720, M(x2, A(m3177720, M(x2, m18361)))))); - -#undef C -#undef M -#undef A -#undef S -#undef F - return _mm_div_ps(num, den); -} - -// JUCE6 Pade approximation of cos valid from -PI to PI with max error of 1e-5 and average error of -// 5e-7 -inline float fastcos(float x) noexcept -{ - auto x2 = x * x; - auto numerator = -(-(float)39251520 + x2 * ((float)18471600 + x2 * (-1075032 + 14615 * x2))); - auto denominator = (float)39251520 + x2 * (1154160 + x2 * (16632 + x2 * 127)); - return numerator / denominator; -} - -inline __m128 fastcosSSE(__m128 x) noexcept -{ -#define M(a, b) _mm_mul_ps(a, b) -#define A(a, b) _mm_add_ps(a, b) -#define S(a, b) _mm_sub_ps(a, b) -#define F(a) _mm_set_ps1(a) -#define C(x) __m128 m##x = F((float)x) - - // auto x2 = x * x; - auto x2 = M(x, x); - - C(39251520); - C(18471600); - C(1075032); - C(14615); - C(1154160); - C(16632); - C(127); - - // auto numerator = -(-(float)39251520 + x2 * ((float)18471600 + x2 * (-1075032 + 14615 * x2))); - auto num = S(m39251520, M(x2, A(m18471600, M(x2, S(M(m14615, x2), m1075032))))); - - // auto denominator = (float)39251520 + x2 * (1154160 + x2 * (16632 + x2 * 127)); - auto den = A(m39251520, M(x2, A(m1154160, M(x2, A(m16632, M(x2, m127)))))); -#undef C -#undef M -#undef A -#undef S -#undef F - return _mm_div_ps(num, den); -} - -/* -** Push x into -PI, PI periodically. There is probably a faster way to do this -*/ -inline float clampToPiRange(float x) -{ - if (x <= M_PI && x >= -M_PI) - return x; - float y = x + M_PI; // so now I am 0,2PI - - // float p = fmod( y, 2.0 * M_PI ); - - constexpr float oo2p = 1.0 / (2.0 * M_PI); - float p = y - 2.0 * M_PI * (int)(y * oo2p); - - if (p < 0) - p += 2.0 * M_PI; - return p - M_PI; -} - -inline __m128 clampToPiRangeSSE(__m128 x) -{ - const auto mpi = _mm_set1_ps(M_PI); - const auto m2pi = _mm_set1_ps(2.0 * M_PI); - const auto oo2p = _mm_set1_ps(1.0 / (2.0 * M_PI)); - const auto mz = _mm_setzero_ps(); - - auto y = _mm_add_ps(x, mpi); - auto yip = _mm_cvtepi32_ps(_mm_cvttps_epi32(_mm_mul_ps(y, oo2p))); - auto p = _mm_sub_ps(y, _mm_mul_ps(m2pi, yip)); - auto off = _mm_and_ps(_mm_cmplt_ps(p, mz), m2pi); - p = _mm_add_ps(p, off); - - return _mm_sub_ps(p, mpi); -} - -/* -** Valid in range -5, 5 -*/ -inline float fasttanh(float x) noexcept -{ - auto x2 = x * x; - auto numerator = x * (135135 + x2 * (17325 + x2 * (378 + x2))); - auto denominator = 135135 + x2 * (62370 + x2 * (3150 + 28 * x2)); - return numerator / denominator; -} - -// Valid in range (-PI/2, PI/2) -inline float fasttan(float x) noexcept -{ - auto x2 = x * x; - auto numerator = x * (-135135 + x2 * (17325 + x2 * (-378 + x2))); - auto denominator = -135135 + x2 * (62370 + x2 * (-3150 + 28 * x2)); - return numerator / denominator; -} - -inline __m128 fasttanhSSE(__m128 x) -{ - const __m128 m135135 = _mm_set_ps1(135135), m17325 = _mm_set_ps1(17325), - m378 = _mm_set_ps1(378), m62370 = _mm_set_ps1(62370), m3150 = _mm_set_ps1(3150), - m28 = _mm_set_ps1(28); - -#define M(a, b) _mm_mul_ps(a, b) -#define A(a, b) _mm_add_ps(a, b) - - auto x2 = M(x, x); - auto num = M(x, A(m135135, M(x2, A(m17325, M(x2, A(m378, x2)))))); - auto den = A(m135135, M(x2, A(m62370, M(x2, A(m3150, M(m28, x2)))))); - -#undef M -#undef A - - return _mm_div_ps(num, den); -} - -inline __m128 fasttanhSSEclamped(__m128 x) -{ - auto xc = _mm_min_ps(_mm_set_ps1(5), _mm_max_ps(_mm_set_ps1(-5), x)); - return fasttanhSSE(xc); -} - -/* -** Valid in range -6, 4 -*/ -inline float fastexp(float x) noexcept -{ - auto numerator = 1680 + x * (840 + x * (180 + x * (20 + x))); - auto denominator = 1680 + x * (-840 + x * (180 + x * (-20 + x))); - return numerator / denominator; -} - -inline __m128 fastexpSSE(__m128 x) noexcept -{ -#define M(a, b) _mm_mul_ps(a, b) -#define A(a, b) _mm_add_ps(a, b) -#define F(a) _mm_set_ps1(a) - - const __m128 m1680 = F(1680), m840 = F(840), mneg840 = F(-840), m180 = F(180), m20 = F(20), - mneg20 = F(-20); - - auto num = A(m1680, M(x, A(m840, M(x, A(m180, M(x, A(m20, x))))))); - auto den = A(m1680, M(x, A(mneg840, M(x, A(m180, M(x, A(mneg20, x))))))); - - return _mm_div_ps(num, den); - -#undef M -#undef A -#undef F -} - -} // namespace DSP -} // namespace Surge diff --git a/src/common/dsp/utilities/SSEComplex.h b/src/common/dsp/utilities/SSEComplex.h index 94e715c2c0d..ac4c31ce150 100644 --- a/src/common/dsp/utilities/SSEComplex.h +++ b/src/common/dsp/utilities/SSEComplex.h @@ -26,7 +26,7 @@ #include "globals.h" #include #include -#include "FastMath.h" +#include "sst/basic-blocks/dsp/FastMath.h" struct SSEComplex { @@ -79,8 +79,9 @@ struct SSEComplex inline static SSEComplex fastExp(__m128 angle) { - angle = Surge::DSP::clampToPiRangeSSE(angle); - return {Surge::DSP::fastcosSSE(angle), Surge::DSP::fastsinSSE(angle)}; + angle = sst::basic_blocks::dsp::clampToPiRangeSSE(angle); + return {sst::basic_blocks::dsp::fastcosSSE(angle), + sst::basic_blocks::dsp::fastsinSSE(angle)}; } inline SSEComplex map(std::function(const std::complex &)> f) 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-fx/SurgeFXProcessor.cpp b/src/surge-fx/SurgeFXProcessor.cpp index 61521cc6811..93be128916a 100644 --- a/src/surge-fx/SurgeFXProcessor.cpp +++ b/src/surge-fx/SurgeFXProcessor.cpp @@ -13,6 +13,12 @@ #include "DebugHelpers.h" #include "UserDefaults.h" +#if LINUX +// getCurrentPosition is deprecated in J7 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + //============================================================================== SurgefxAudioProcessor::SurgefxAudioProcessor() : AudioProcessor(BusesProperties() diff --git a/src/surge-testrunner/UnitTestsDSP.cpp b/src/surge-testrunner/UnitTestsDSP.cpp index ec62dd77510..3fdf75a9247 100644 --- a/src/surge-testrunner/UnitTestsDSP.cpp +++ b/src/surge-testrunner/UnitTestsDSP.cpp @@ -7,7 +7,6 @@ #include "catch2/catch2.hpp" #include "UnitTestUtilities.h" -#include "FastMath.h" #include "SSESincDelayLine.h" @@ -358,237 +357,6 @@ TEST_CASE("lipol_ps class", "[dsp]") } } -TEST_CASE("Check FastMath Functions", "[dsp]") -{ - SECTION("Clamp to -PI,PI") - { - for (float f = -2132.7; f < 37424.3; f += 0.741) - { - float q = Surge::DSP::clampToPiRange(f); - INFO("Clamping " << f << " to " << q); - REQUIRE(q > -M_PI); - REQUIRE(q < M_PI); - } - } - - SECTION("fastSin and fastCos in range -PI, PI") - { - float sds = 0, md = 0; - int nsamp = 100000; - for (int i = 0; i < nsamp; ++i) - { - float p = 2.f * M_PI * rand() / RAND_MAX - M_PI; - float cp = std::cos(p); - float sp = std::sin(p); - float fcp = Surge::DSP::fastcos(p); - float fsp = Surge::DSP::fastsin(p); - - float cd = fabs(cp - fcp); - float sd = fabs(sp - fsp); - if (cd > md) - md = cd; - if (sd > md) - md = sd; - sds += cd * cd + sd * sd; - } - sds = sqrt(sds) / nsamp; - REQUIRE(md < 1e-4); - REQUIRE(sds < 1e-6); - } - - SECTION("fastSin and fastCos in range -10*PI, 10*PI with clampRange") - { - float sds = 0, md = 0; - int nsamp = 100000; - for (int i = 0; i < nsamp; ++i) - { - float p = 2.f * M_PI * rand() / RAND_MAX - M_PI; - p *= 10; - p = Surge::DSP::clampToPiRange(p); - float cp = std::cos(p); - float sp = std::sin(p); - float fcp = Surge::DSP::fastcos(p); - float fsp = Surge::DSP::fastsin(p); - - float cd = fabs(cp - fcp); - float sd = fabs(sp - fsp); - if (cd > md) - md = cd; - if (sd > md) - md = sd; - sds += cd * cd + sd * sd; - } - sds = sqrt(sds) / nsamp; - REQUIRE(md < 1e-4); - REQUIRE(sds < 1e-6); - } - - SECTION("fastSin and fastCos in range -100*PI, 100*PI with clampRange") - { - float sds = 0, md = 0; - int nsamp = 100000; - for (int i = 0; i < nsamp; ++i) - { - float p = 2.f * M_PI * rand() / RAND_MAX - M_PI; - p *= 100; - p = Surge::DSP::clampToPiRange(p); - float cp = std::cos(p); - float sp = std::sin(p); - float fcp = Surge::DSP::fastcos(p); - float fsp = Surge::DSP::fastsin(p); - - float cd = fabs(cp - fcp); - float sd = fabs(sp - fsp); - if (cd > md) - md = cd; - if (sd > md) - md = sd; - sds += cd * cd + sd * sd; - } - sds = sqrt(sds) / nsamp; - REQUIRE(md < 1e-4); - REQUIRE(sds < 1e-6); - } - - SECTION("fastTanh and fastTanhSSE") - { - for (float x = -4.9; x < 4.9; x += 0.02) - { - INFO("Testing unclamped at " << x); - auto q = _mm_set_ps1(x); - auto r = Surge::DSP::fasttanhSSE(q); - auto rn = tanh(x); - auto rd = Surge::DSP::fasttanh(x); - union - { - __m128 v; - float a[4]; - } U; - U.v = r; - REQUIRE(U.a[0] == Approx(rn).epsilon(1e-4)); - REQUIRE(rd == Approx(rn).epsilon(1e-4)); - } - - for (float x = -10; x < 10; x += 0.02) - { - INFO("Testing clamped at " << x); - auto q = _mm_set_ps1(x); - auto r = Surge::DSP::fasttanhSSEclamped(q); - auto cn = tanh(x); - union - { - __m128 v; - float a[4]; - } U; - U.v = r; - REQUIRE(U.a[0] == Approx(cn).epsilon(5e-4)); - } - } - - SECTION("fastTan") - { - // need to bump start point slightly, fasttan is only valid just after -PI/2 - for (float x = -M_PI / 2.0 + 0.001; x < M_PI / 2.0; x += 0.02) - { - INFO("Testing fasttan at " << x); - auto rn = tanf(x); - auto rd = Surge::DSP::fasttan(x); - REQUIRE(rd == Approx(rn).epsilon(1e-4)); - } - } - - SECTION("fastexp and fastexpSSE") - { - for (float x = -3.9; x < 2.9; x += 0.02) - { - INFO("Testing fastexp at " << x); - auto q = _mm_set_ps1(x); - auto r = Surge::DSP::fastexpSSE(q); - auto rn = exp(x); - auto rd = Surge::DSP::fastexp(x); - union - { - __m128 v; - float a[4]; - } U; - U.v = r; - - if (x < 0) - { - REQUIRE(U.a[0] == Approx(rn).margin(1e-3)); - REQUIRE(rd == Approx(rn).margin(1e-3)); - } - else - { - REQUIRE(U.a[0] == Approx(rn).epsilon(1e-3)); - REQUIRE(rd == Approx(rn).epsilon(1e-3)); - } - } - } - - SECTION("fastSine and fastSinSSE") - { - for (float x = -3.14; x < 3.14; x += 0.02) - { - INFO("Testing unclamped at " << x); - auto q = _mm_set_ps1(x); - auto r = Surge::DSP::fastsinSSE(q); - auto rn = sin(x); - auto rd = Surge::DSP::fastsin(x); - union - { - __m128 v; - float a[4]; - } U; - U.v = r; - REQUIRE(U.a[0] == Approx(rn).margin(1e-4)); - REQUIRE(rd == Approx(rn).margin(1e-4)); - REQUIRE(U.a[0] == Approx(rd).margin(1e-6)); - } - } - - SECTION("fastCos and fastCosSSE") - { - for (float x = -3.14; x < 3.14; x += 0.02) - { - INFO("Testing unclamped at " << x); - auto q = _mm_set_ps1(x); - auto r = Surge::DSP::fastcosSSE(q); - auto rn = cos(x); - auto rd = Surge::DSP::fastcos(x); - union - { - __m128 v; - float a[4]; - } U; - U.v = r; - REQUIRE(U.a[0] == Approx(rn).margin(1e-4)); - REQUIRE(rd == Approx(rn).margin(1e-4)); - REQUIRE(U.a[0] == Approx(rd).margin(1e-6)); - } - } - - SECTION("Clamp to -PI,PI SSE") - { - for (float f = -800.7; f < 816.4; f += 0.245) - { - auto fs = _mm_set_ps1(f); - - auto q = Surge::DSP::clampToPiRangeSSE(fs); - union - { - __m128 v; - float a[4]; - } U; - U.v = q; - for (int s = 0; s < 4; ++s) - { - REQUIRE(U.a[s] == Approx(Surge::DSP::clampToPiRange(f)).margin(1e-4)); - } - } - } -} - TEST_CASE("Sinc Delay Line", "[dsp]") { // This requires SurgeStorate to initialize its tables. Easiest way diff --git a/src/surge-testrunner/UnitTestsFLT.cpp b/src/surge-testrunner/UnitTestsFLT.cpp index 1772208b6f2..675d6746b65 100644 --- a/src/surge-testrunner/UnitTestsFLT.cpp +++ b/src/surge-testrunner/UnitTestsFLT.cpp @@ -9,7 +9,6 @@ #include "catch2/catch2.hpp" #include "UnitTestUtilities.h" -#include "FastMath.h" using namespace Surge::Test; diff --git a/src/surge-testrunner/UnitTestsFX.cpp b/src/surge-testrunner/UnitTestsFX.cpp index 00613815c12..d24716f2b72 100644 --- a/src/surge-testrunner/UnitTestsFX.cpp +++ b/src/surge-testrunner/UnitTestsFX.cpp @@ -9,7 +9,6 @@ #include "catch2/catch2.hpp" #include "UnitTestUtilities.h" -#include "FastMath.h" using namespace Surge::Test; diff --git a/src/surge-testrunner/UnitTestsMSEG.cpp b/src/surge-testrunner/UnitTestsMSEG.cpp index f2516ff8561..63264a1852c 100644 --- a/src/surge-testrunner/UnitTestsMSEG.cpp +++ b/src/surge-testrunner/UnitTestsMSEG.cpp @@ -5,7 +5,6 @@ #include "HeadlessUtils.h" #include "catch2/catch2.hpp" -#include "FastMath.h" #include "MSEGModulationHelper.h" struct msegObservation diff --git a/src/surge-xt/SurgeSynthProcessor.cpp b/src/surge-xt/SurgeSynthProcessor.cpp index a2066823461..849244f5d86 100644 --- a/src/surge-xt/SurgeSynthProcessor.cpp +++ b/src/surge-xt/SurgeSynthProcessor.cpp @@ -17,6 +17,12 @@ #include "globals.h" #include "UserDefaults.h" +#if LINUX +// getCurrentPosition is deprecated in J7 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + /* * This is a bit odd but - this is an editor concept with the lifetime of the processor */ diff --git a/src/surge-xt/SurgeSynthProcessor.h b/src/surge-xt/SurgeSynthProcessor.h index fa832a5b2a0..232bd32cf00 100644 --- a/src/surge-xt/SurgeSynthProcessor.h +++ b/src/surge-xt/SurgeSynthProcessor.h @@ -84,14 +84,10 @@ struct SurgeParamToJuceParamAdapter : SurgeBaseParam { explicit SurgeParamToJuceParamAdapter(SurgeSynthesizer *s, Parameter *p) : s(s), p(p), range(0.f, 1.f, 0.001f), - SurgeBaseParam( -#if SURGE_HAS_JUCE7 - juce::ParameterID(p->get_storage_name(), - 1), // This "1" needs thought if we add params -#else - p->get_storage_name(), -#endif - SurgeParamToJuceInfo::getParameterName(s, p), "") + SurgeBaseParam(juce::ParameterID(p->get_storage_name(), + 1), // This "1" needs thought if we add params + SurgeParamToJuceInfo::getParameterName(s, p), + juce::AudioProcessorParameterWithIDAttributes()) { setValueNotifyingHost(getValue()); } @@ -172,14 +168,9 @@ struct SurgeMacroToJuceParamAdapter : public SurgeBaseParam { explicit SurgeMacroToJuceParamAdapter(SurgeSynthesizer *s, long macroNum) : s(s), macroNum(macroNum), range(0.f, 1.f, 0.001f), - SurgeBaseParam( -#if SURGE_HAS_JUCE7 - juce::ParameterID(std::string("macro_") + std::to_string(macroNum), 1), -#else - std::string("macro_") + std::to_string(macroNum), -#endif - - std::string("M") + std::to_string(macroNum + 1), "") + SurgeBaseParam(juce::ParameterID(std::string("macro_") + std::to_string(macroNum), 1), + std::string("M") + std::to_string(macroNum + 1), + juce::AudioProcessorParameterWithIDAttributes()) { setValueNotifyingHost(getValue()); } @@ -235,14 +226,10 @@ struct SurgeMacroToJuceParamAdapter : public SurgeBaseParam struct SurgeBypassParameter : public juce::RangedAudioParameter { explicit SurgeBypassParameter() - : value(0.f), range(0.f, 1.f, 0.01f), juce::RangedAudioParameter( -#if SURGE_HAS_JUCE7 - juce::ParameterID("surgext-bypass", 1), -#else - "surgext_bypass", -#endif - - "Bypass Surge XT", "") + : value(0.f), + range(0.f, 1.f, 0.01f), juce::RangedAudioParameter( + juce::ParameterID("surgext-bypass", 1), "Bypass Surge XT", + juce::AudioProcessorParameterWithIDAttributes()) { setValueNotifyingHost(getValue()); } 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: { diff --git a/src/surge-xt/plugin_type_extensions/SurgeSynthLV2Extensions.cpp b/src/surge-xt/plugin_type_extensions/SurgeSynthLV2Extensions.cpp index c0754974715..7f76b505155 100644 --- a/src/surge-xt/plugin_type_extensions/SurgeSynthLV2Extensions.cpp +++ b/src/surge-xt/plugin_type_extensions/SurgeSynthLV2Extensions.cpp @@ -19,14 +19,5 @@ #include "SurgeSynthEditor.h" #include "SurgeSynthFlavorExtensions.h" -void SurgeSynthProcessorSpecificExtensions(SurgeSynthProcessor *p, SurgeSynthesizer *s) -{ -#if !SURGE_HAS_JUCE7 - p->surge->activateExtraOutputs = false; - p->canRemoveBusValue = true; - p->removeBus(false); - p->removeBus(false); - p->canRemoveBusValue = false; -#endif -} +void SurgeSynthProcessorSpecificExtensions(SurgeSynthProcessor *p, SurgeSynthesizer *s) {} void SurgeSynthEditorSpecificExtensions(SurgeSynthEditor *e, SurgeGUIEditor *sed) {}