From a6a2de9472de01ff5941d08646dff468c6111df4 Mon Sep 17 00:00:00 2001 From: luismrguimaraes Date: Sun, 8 Sep 2024 11:31:17 +0100 Subject: [PATCH 1/3] move interpolation type from Variants to SingleVariant --- .../components/mapping-pane/VariantDisplay.cpp | 8 ++++---- src/engine/zone.h | 2 +- src/voice/voice.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp b/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp index f840d3c9..9af13344 100644 --- a/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp +++ b/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp @@ -502,7 +502,7 @@ void VariantDisplay::rebuild() break; } - switch (variantView.interpolationType) + switch (variantView.variants[selectedVariation].interpolationType) { case dsp::InterpolationTypes::Sinc: srcButton->setLabel("SINC"); @@ -727,10 +727,10 @@ void VariantDisplay::showSRCMenu() p.addSeparator(); auto add = [&p, this](auto e, auto n) { - p.addItem(n, true, variantView.interpolationType == e, [this, e]() { - variantView.interpolationType = e; + p.addItem(n, true, variantView.variants[selectedVariation].interpolationType == e, [this, e]() { + variantView.variants[selectedVariation].interpolationType = e; connectors::updateSingleValue( - variantView, variantView.interpolationType, this); + variantView, variantView.variants[selectedVariation].interpolationType, this); rebuild(); }); }; diff --git a/src/engine/zone.h b/src/engine/zone.h index 63ff6676..8049acb5 100644 --- a/src/engine/zone.h +++ b/src/engine/zone.h @@ -109,6 +109,7 @@ struct Zone : MoveableOnly, HasGroupZoneProcessors, SampleRateSuppor bool active{false}; SampleID sampleID; int64_t startSample{-1}, endSample{-1}, startLoop{-1}, endLoop{-1}; + dsp::InterpolationTypes interpolationType{dsp::InterpolationTypes::Sinc}; // VariantMode variantMode{RR}; PlayMode playMode{NORMAL}; @@ -132,7 +133,6 @@ struct Zone : MoveableOnly, HasGroupZoneProcessors, SampleRateSuppor { std::array variants; VariantPlaybackMode variantPlaybackMode{FORWARD_RR}; - dsp::InterpolationTypes interpolationType{dsp::InterpolationTypes::Sinc}; } variantData; std::array, maxVariantsPerZone> samplePointers; diff --git a/src/voice/voice.cpp b/src/voice/voice.cpp index 073e6f3c..a3ab9834 100644 --- a/src/voice/voice.cpp +++ b/src/voice/voice.cpp @@ -537,7 +537,7 @@ void Voice::initializeGenerator() return; } - // but the default of course is to use the sapmle index + // but the default of course is to use the sample index auto &s = zone->samplePointers[sampleIndex]; auto &variantData = zone->variantData.variants[sampleIndex]; assert(s); @@ -598,7 +598,7 @@ void Voice::initializeGenerator() variantData.loopDirection == engine::Zone::FORWARD_ONLY, variantData.loopMode == engine::Zone::LOOP_WHILE_GATED); - GD.interpolationType = zone->variantData.interpolationType; + GD.interpolationType = variantData.interpolationType; } float Voice::calculateVoicePitch() From 6325210bbf02864a749db2c8292742f3056cb50a Mon Sep 17 00:00:00 2001 From: luismrguimaraes Date: Sun, 8 Sep 2024 11:33:46 +0100 Subject: [PATCH 2/3] fix clang format --- .../components/mapping-pane/VariantDisplay.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp b/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp index 9af13344..7371aa2a 100644 --- a/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp +++ b/src-ui/app/edit-screen/components/mapping-pane/VariantDisplay.cpp @@ -727,12 +727,13 @@ void VariantDisplay::showSRCMenu() p.addSeparator(); auto add = [&p, this](auto e, auto n) { - p.addItem(n, true, variantView.variants[selectedVariation].interpolationType == e, [this, e]() { - variantView.variants[selectedVariation].interpolationType = e; - connectors::updateSingleValue( - variantView, variantView.variants[selectedVariation].interpolationType, this); - rebuild(); - }); + p.addItem( + n, true, variantView.variants[selectedVariation].interpolationType == e, [this, e]() { + variantView.variants[selectedVariation].interpolationType = e; + connectors::updateSingleValue( + variantView, variantView.variants[selectedVariation].interpolationType, this); + rebuild(); + }); }; add(dsp::InterpolationTypes::Sinc, "Sinc"); add(dsp::InterpolationTypes::Linear, "Linear"); From 1a15912622a1a75508e40eb325fe3c8456448f05 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sun, 8 Sep 2024 08:25:05 -0400 Subject: [PATCH 3/3] Add the streaming for interpoation on SingleVariant --- src/json/engine_traits.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/json/engine_traits.h b/src/json/engine_traits.h index b51ee33c..95d2b931 100644 --- a/src/json/engine_traits.h +++ b/src/json/engine_traits.h @@ -319,6 +319,7 @@ SC_STREAMDEF(scxt::engine::Zone::SingleVariant, SC_FROM({ {"loopMode", s.loopMode}, {"loopDirection", s.loopDirection}, {"loopCountWhenCounted", s.loopCountWhenCounted}, + {"interpolationType", s.interpolationType}, {"loopFade", s.loopFade}}; } else @@ -344,6 +345,8 @@ SC_STREAMDEF(scxt::engine::Zone::SingleVariant, SC_FROM({ findOrSet(v, "loopDirection", engine::Zone::LoopDirection::FORWARD_ONLY, s.loopDirection); findOrSet(v, "loopFade", 0, s.loopFade); + findOrSet(v, "interpolationType", dsp::InterpolationTypes::Sinc, + s.interpolationType); findOrSet(v, "loopCountWhenCounted", 0, s.loopCountWhenCounted); } else