Skip to content

Commit

Permalink
Merge branch 'main' into OpenSoundControl-2355
Browse files Browse the repository at this point in the history
* main:
  Upgrade to JUCE 7.0.5 with patches (surge-synthesizer#6944)
  add another 5 modes for ringmod in mixer (surge-synthesizer#6935)
  Move FastMath entirely to sst-basic-blocks; turn on gcc12 build (surge-synthesizer#6943)
  • Loading branch information
pkstone committed Apr 17, 2023
2 parents 044a0a0 + 7c1bde4 commit c55cb6b
Show file tree
Hide file tree
Showing 29 changed files with 255 additions and 719 deletions.
29 changes: 0 additions & 29 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion libs/JUCE
Submodule JUCE updated 2231 files
2 changes: 1 addition & 1 deletion libs/sst/sst-basic-blocks
11 changes: 4 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -95,19 +98,13 @@ if(DEFINED ENV{VST2SDK_DIR})
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/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)
Expand Down
3 changes: 1 addition & 2 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/Oscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "Oscillator.h"
#include "DSPUtils.h"
#include "FastMath.h"
#include "sst/basic-blocks/dsp/FastMath.h"
#include <cmath>

#include "AliasOscillator.h"
Expand Down
85 changes: 60 additions & 25 deletions src/common/dsp/SurgeVoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/common/dsp/effects/RingModulatorEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/effects/WaveShaperEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/effects/chowdsp/shared/wdf_sse.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cmath>
#include <memory>
#include <type_traits>
#include "FastMath.h"
#include "sst/basic-blocks/dsp/FastMath.h"
#include "portable_intrinsics.h"

namespace chowdsp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <random>

#include "SpringReverbProc.h"
#include "utilities/FastMath.h"
#include "sst/basic-blocks/dsp/FastMath.h"

namespace
{
Expand Down Expand Up @@ -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<StateVariableFilterType::Highpass>(ch, output) +
shortShakeBuffer[n];
};
Expand Down
3 changes: 2 additions & 1 deletion src/common/dsp/effects/chowdsp/tape/HysteresisOps.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include <cmath>
#include "FastMath.h"
#include "globals.h"
#include "sst/basic-blocks/dsp/FastMath.h"

#define CHOWTAPE_HYSTERESIS_USE_SIMD 1

Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/modulators/MSEGModulationHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <iostream>
#include "DebugHelpers.h"
#include "basic_dsp.h" // for limit_range
#include "FastMath.h"
#include "sst/basic-blocks/dsp/FastMath.h"

namespace Surge
{
Expand Down
15 changes: 8 additions & 7 deletions src/common/dsp/oscillators/SineOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

#include "SineOscillator.h"
#include "FastMath.h"
#include "sst/basic-blocks/dsp/FastMath.h"
#include <algorithm>

/*
Expand Down Expand Up @@ -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<mode>(sxl, cxl, std::min(n_unison - u, 4));

Expand Down Expand Up @@ -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<mode>(Surge::DSP::fastsin(phase[u]),
Surge::DSP::fastcos(phase[u]));
float out_local =
singleValueFromSinAndCos<mode>(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];
Expand All @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/common/dsp/oscillators/StringOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit c55cb6b

Please sign in to comment.