From b1f522c14ac8bbc25b24c65c2445a8018333a8c9 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 15 Jan 2025 22:10:33 -0500 Subject: [PATCH] Bipolar feedback had broken fb-drag-to-on (#129) so fix that by adding an onPullFromDef --- src/ui/matrix-panel.cpp | 2 +- src/ui/patch-data-bindings.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui/matrix-panel.cpp b/src/ui/matrix-panel.cpp index 9b5e9d5..5dcb47c 100644 --- a/src/ui/matrix-panel.cpp +++ b/src/ui/matrix-panel.cpp @@ -41,7 +41,7 @@ MatrixPanel::MatrixPanel(SixSinesEditor &e) : jcmp::NamedPanel("Matrix"), HasEdi Slabels[i]->setText("Op " + std::to_string(i + 1) + " " + u8"\U000021A9"); addAndMakeVisible(*Slabels[i]); - SknobsData[i]->under->onPullFromMin = [i, w = juce::Component::SafePointer(this)]() + SknobsData[i]->under->onPullFromDef = [i, w = juce::Component::SafePointer(this)]() { if (!w) return; diff --git a/src/ui/patch-data-bindings.h b/src/ui/patch-data-bindings.h index 9a7dd14..c51edc7 100644 --- a/src/ui/patch-data-bindings.h +++ b/src/ui/patch-data-bindings.h @@ -88,6 +88,12 @@ struct PatchContinuous : jdat::Continuous if (onPullFromMin) onPullFromMin(); } + + if (p->value == p->meta.defaultVal && f != p->value) + { + if (onPullFromDef) + onPullFromDef(); + } p->value = f; editor.uiToAudio.push({Synth::UIToAudioMsg::Action::SET_PARAM, pid, f}); editor.flushOperator(); @@ -105,7 +111,7 @@ struct PatchContinuous : jdat::Continuous jdat::Discrete *tsPowerPartner{nullptr}; void setTemposyncPowerPartner(jdat::Discrete *d) { tsPowerPartner = d; } - std::function onPullFromMin{nullptr}; + std::function onPullFromMin{nullptr}, onPullFromDef{nullptr}; using cubic_t = sst::jucegui::component_adapters::CubicThrowRescaler; };