Skip to content

Commit

Permalink
Merge branch 'main' into OpenSoundControl-2355
Browse files Browse the repository at this point in the history
  • Loading branch information
pkstone committed Apr 17, 2023
2 parents 928c004 + d57eed2 commit 044a0a0
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 334 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@
[submodule "libs/pffft"]
path = libs/pffft
url = https://github.com/surge-synthesizer/pffft.git
[submodule "libs/sst/sst-basic-blocks"]
path = libs/sst/sst-basic-blocks
url = https://github.com/surge-synthesizer/sst-basic-blocks.git
1 change: 1 addition & 0 deletions libs/sst/sst-basic-blocks
Submodule sst-basic-blocks added at 98ba45
4 changes: 2 additions & 2 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ 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,8 +280,6 @@ add_library(${PROJECT_NAME}
dsp/utilities/DSPUtils.cpp
dsp/utilities/DSPUtils.h
dsp/utilities/FastMath.h
dsp/utilities/LanczosResampler.cpp
dsp/utilities/LanczosResampler.h
dsp/utilities/SSEComplex.h
dsp/utilities/SSESincDelayLine.h
dsp/vembertech/basic_dsp.cpp
Expand Down Expand Up @@ -378,6 +377,7 @@ target_link_libraries(${PROJECT_NAME}
sst-filters
sst-filters-extras
sst-waveshapers
sst-basic-blocks

surge::oddsound-mts
surge::sqlite
Expand Down
7 changes: 2 additions & 5 deletions src/common/dsp/oscillators/TwistOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

#include "samplerate.h"

#if SAMPLERATE_LANCZOS
#include "LanczosResampler.h"
#endif

std::string twist_engine_name(int i)
{
switch (i)
Expand Down Expand Up @@ -277,7 +273,8 @@ TwistOscillator::TwistOscillator(SurgeStorage *storage, OscillatorStorage *oscda
: Oscillator(storage, oscdata, localcopy), charFilt(storage)
{
#if SAMPLERATE_LANCZOS
lancRes = std::make_unique<LanczosResampler>(48000, storage->dsamplerate_os);
lancRes = std::make_unique<sst::basic_blocks::dsp::LanczosResampler<BLOCK_SIZE>>(
48000, storage->dsamplerate_os);
srcstate = nullptr;
#else
int error;
Expand Down
6 changes: 4 additions & 2 deletions src/common/dsp/oscillators/TwistOscillator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/*
* What's our samplerate strategy
*/
#include "globals.h"
#define SAMPLERATE_SRC 0
#define SAMPLERATE_LANCZOS 1

Expand All @@ -26,7 +27,8 @@
#include "OscillatorCommonFunctions.h"

#if SAMPLERATE_LANCZOS
#include "LanczosResampler.h"
// #include "LanczosResampler.h"
#include "sst/basic-blocks/dsp/LanczosResampler.h"
#endif

namespace plaits
Expand Down Expand Up @@ -93,7 +95,7 @@ class TwistOscillator : public Oscillator
bool useCorrectLPGBlockSize{false}; // See #6760

#if SAMPLERATE_LANCZOS
std::unique_ptr<LanczosResampler> lancRes;
std::unique_ptr<sst::basic_blocks::dsp::LanczosResampler<BLOCK_SIZE>> lancRes;
#endif

float carryover[BLOCK_SIZE_OS][2];
Expand Down
45 changes: 0 additions & 45 deletions src/common/dsp/utilities/LanczosResampler.cpp

This file was deleted.

197 changes: 0 additions & 197 deletions src/common/dsp/utilities/LanczosResampler.h

This file was deleted.

42 changes: 0 additions & 42 deletions src/surge-testrunner/UnitTestsDSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "SSEComplex.h"
#include <complex>

#include "LanczosResampler.h"
#include "sst/plugininfra/cpufeatures.h"

using namespace Surge::Test;
Expand Down Expand Up @@ -905,47 +904,6 @@ TEST_CASE("SSE std::complex", "[dsp]")
}
}

#if 0
TEST_CASE("LanczosResampler", "[dsp]")
{
SECTION("Can Interpolate Sine")
{
LanczosResampler lr(48000, 88100);

std::cout << lr.inputsRequiredToGenerateOutputs(64) << std::endl;
// plot 'lancos_raw.csv' using 1:2 with lines, 'lancos_samp.csv' using 1:2 with lines
std::ofstream raw("lancos_raw.csv"), samp("lancos_samp.csv");
int points = 2000;
double dp = 1.0 / 370;
float phase = 0;
for (auto i = 0; i < points; ++i)
{
auto obsS = std::sin(i * dp * 2.0 * M_PI);
auto obsR = phase * 2 - 1;
phase += dp;
if (phase > 1)
phase -= 1;
auto obs = i > 800 ? obsS : obsR;
lr.push(obs);

raw << i << ", " << obs << "\n";
}
std::cout << lr.inputsRequiredToGenerateOutputs(64) << std::endl;

float outBlock[64];
int q, gen;
while ((gen = lr.populateNext(outBlock, 64)) > 0)
{
for (int i = 0; i < gen; ++i)
{
samp << q * 48000.0 / 88100.0 << ", " << outBlock[i] << std::endl;
++q;
}
}
}
}
#endif

// When we return to #1514 this is a good starting point
#if 0
TEST_CASE( "NaN Patch from Issue 1514", "[dsp]" )
Expand Down
Loading

0 comments on commit 044a0a0

Please sign in to comment.