Skip to content

Commit

Permalink
Move submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
hemmer committed May 6, 2024
1 parent 61abb44 commit abe2d82
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "dep/sst-filters"]
path = dep/sst-filters
[submodule "libs/sst-filters"]
path = libs/sst-filters
url = https://github.com/surge-synthesizer/sst-filters.git
[submodule "dep/sst-basic-blocks"]
path = dep/sst-basic-blocks
[submodule "libs/sst-basic-blocks"]
path = libs/sst-basic-blocks
url = https://github.com/surge-synthesizer/sst-basic-blocks.git
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ RACK_DIR ?= ../..

SOURCES += $(wildcard src/*.cpp)
SOURCES += $(wildcard src/noise-plethora/*/*.cpp)
FLAGS += -Idep/sst-basic-blocks/include -Idep/sst-filters/include -std=c++17
FLAGS += -Ilibs/sst-basic-blocks/include -Ilibs/sst-filters/include -std=c++17

DISTRIBUTABLES += $(wildcard LICENSE*) res

Expand Down
1 change: 1 addition & 0 deletions libs/sst-basic-blocks
Submodule sst-basic-blocks added at b51d34
1 change: 1 addition & 0 deletions libs/sst-filters
Submodule sst-filters added at 1934e4
38 changes: 22 additions & 16 deletions src/PonyVCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ struct PonyVCF : Module {
};

LadderFilter<float_4> filters[4];

sst::filters::QuadFilterUnitState qfus;

// 4x quad = 16 channels of polyphony
sst::filters::QuadFilterUnitState qfus[4];
sst::filters::FilterCoefficientMaker<> coefMaker;
sst::filters::FilterUnitQFPtr filterUnitPtr{nullptr};

Expand Down Expand Up @@ -137,14 +138,17 @@ struct PonyVCF : Module {
filters[i].reset();
coefMaker.setSampleRateAndBlockSize(APP->engine->getSampleRate(), 1);

std::fill(qfus.R, &qfus.R[sst::filters::n_filter_registers], _mm_setzero_ps());
std::fill(qfus.C, &qfus.C[sst::filters::n_cm_coeffs], _mm_setzero_ps());
for (int c = 0; c < 4; ++c) {
std::fill(qfus[c].R, &qfus[c].R[sst::filters::n_filter_registers], _mm_setzero_ps());
std::fill(qfus[c].C, &qfus[c].C[sst::filters::n_cm_coeffs], _mm_setzero_ps());


for (int i = 0; i < 4; ++i) {
std::fill(delayBufferData[i], delayBufferData[i] + sst::filters::utilities::MAX_FB_COMB + sst::filters::utilities::SincTable::FIRipol_N, 0.0f);
qfus.DB[i] = delayBufferData[i];
qfus.active[i] = (int) 0xffffffff;
qfus.WP[i] = 0;
for (int i = 0; i < 4; ++i) {
std::fill(delayBufferData[i], delayBufferData[i] + sst::filters::utilities::MAX_FB_COMB + sst::filters::utilities::SincTable::FIRipol_N, 0.0f);
qfus[c].DB[i] = delayBufferData[i];
qfus[c].active[i] = (int) 0xffffffff;
qfus[c].WP[i] = 0;
}
}
}

Expand All @@ -162,6 +166,7 @@ struct PonyVCF : Module {

int channels = std::max({1, inputs[IN1_INPUT].getChannels(), inputs[IN2_INPUT].getChannels(), inputs[IN3_INPUT].getChannels()});

// process channels in blocks of 4
for (int c = 0; c < channels; c += 4) {
auto& filter = filters[c / 4];

Expand All @@ -186,19 +191,20 @@ struct PonyVCF : Module {
// Set cutoff (Hz)
float_4 cutoff = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);

// serially update each of the four internal channels of the quadfilterstate object
for (int i = 0; i < 4; i++) {
coefMaker.MakeCoeffs(cutoff[i], resonance[i], sst::filters::FilterType::fut_vintageladder,
sst::filters::FilterSubType::st_Driven, nullptr, true);

coefMaker.MakeCoeffs(cutoff[0], resonance[0], sst::filters::FilterType::fut_vintageladder,
sst::filters::FilterSubType::st_Driven, nullptr, true);


coefMaker.updateState(qfus, 0);
coefMaker.updateState(qfus[c / 4], i);
}

float_4 out;
out.v = filterUnitPtr(&qfus, input.v);
out.v = filterUnitPtr(&qfus[c / 4], input.v);

outputs[OUTPUT].setVoltageSimd(out, c);
continue;

/*
// ignore for now
filter.setCutoff(cutoff);
Expand Down

0 comments on commit abe2d82

Please sign in to comment.