From d61538bb092838feef1673a42a09b674ecb57252 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Fri, 20 Sep 2024 16:32:20 -0400 Subject: [PATCH] Add Mult Swap Checkpoint --- src-ui/app/edit-screen/components/ModPane.cpp | 40 ++++++++++++++----- src/json/modulation_traits.h | 3 +- src/modulation/voice_matrix.h | 2 + 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src-ui/app/edit-screen/components/ModPane.cpp b/src-ui/app/edit-screen/components/ModPane.cpp index 51435bc2..eb9eee16 100644 --- a/src-ui/app/edit-screen/components/ModPane.cpp +++ b/src-ui/app/edit-screen/components/ModPane.cpp @@ -353,16 +353,13 @@ template struct ModRow : juce::Component, HasEditor } } - if (row.target.has_value()) + if (row.applicationMode == sst::basic_blocks::mod_matrix::ApplicationMode::MULTIPLICATIVE) { - if (GZTrait::isMultiplicative(*(row.target))) - { - a2->glyph = sst::jucegui::components::GlyphPainter::MODULATION_MULTIPLICATIVE; - } - else - { - a2->glyph = sst::jucegui::components::GlyphPainter::MODULATION_ADDITIVE; - } + a2->glyph = sst::jucegui::components::GlyphPainter::MODULATION_MULTIPLICATIVE; + } + else + { + a2->glyph = sst::jucegui::components::GlyphPainter::MODULATION_ADDITIVE; } repaint(); @@ -837,6 +834,31 @@ template struct ModRow : juce::Component, HasEditor p.addSeparator(); p.addCustomItem(-1, std::make_unique(editor, this)); + p.addSeparator(); + auto &route =parent->routingTable.routes[index]; + + p.addItem("Additive Application", true, route.applicationMode == sst::basic_blocks::mod_matrix::ApplicationMode::ADDITIVE, + [w = juce::Component::SafePointer(this)]() { + if (!w) + return; + auto &route =w->parent->routingTable.routes[w->index]; + route.applicationMode = sst::basic_blocks::mod_matrix::ApplicationMode::ADDITIVE; + + w->pushRowUpdate(true); + w->refreshRow(); + } ); + p.addItem("Multiplicative Application", true, route.applicationMode == sst::basic_blocks::mod_matrix::ApplicationMode::MULTIPLICATIVE, + [w = juce::Component::SafePointer(this)]() { + if (!w) + return; + auto &route =w->parent->routingTable.routes[w->index]; + route.applicationMode = sst::basic_blocks::mod_matrix::ApplicationMode::MULTIPLICATIVE ; + + w->pushRowUpdate(true); + w->refreshRow(); + } ); + + p.showMenuAsync(editor->defaultPopupMenuOptions()); } }; diff --git a/src/json/modulation_traits.h b/src/json/modulation_traits.h index 0a23ac4f..56fcac26 100644 --- a/src/json/modulation_traits.h +++ b/src/json/modulation_traits.h @@ -193,7 +193,7 @@ SC_STREAMDEF(scxt::voice::modulation::Matrix::RoutingTable::Routing, SC_FROM({ {"sourceVia", t.sourceVia}, {"target", t.target}, {"curve", t.curve}, {"depth", t.depth}, {"srcLMS", t.sourceLagMS}, {"srVLMS", t.sourceViaLagMS}, - {"srcLE", t.sourceLagExp}, {"srVLE", t.sourceViaLagExp}}; + {"srcLE", t.sourceLagExp}, {"srVLE", t.sourceViaLagExp}, {"appm", t.applicationMode}}; if (SC_STREAMING_FOR_IN_PROCESS) addToObject(v, "extraPayload", t.extraPayload); } @@ -211,6 +211,7 @@ SC_STREAMDEF(scxt::voice::modulation::Matrix::RoutingTable::Routing, SC_FROM({ findOrSet(v, "srVLMS", 0, result.sourceViaLagMS); findOrSet(v, "srcLE", true, result.sourceLagExp); findOrSet(v, "srVLE", true, result.sourceViaLagExp); + findOrSet(v, "appm", 0, result.applicationMode); })); SC_STREAMDEF(scxt::voice::modulation::Matrix::RoutingTable, SC_FROM({ diff --git a/src/modulation/voice_matrix.h b/src/modulation/voice_matrix.h index a12b6fbe..e6bcd718 100644 --- a/src/modulation/voice_matrix.h +++ b/src/modulation/voice_matrix.h @@ -63,6 +63,8 @@ struct MatrixConfig { return scxt::modulation::ModulationCurves::getCurveOperator(id); } + + // FIX ME make this default named and in the base and accessible to the ui static std::unordered_set multiplicativeTargets; static void setIsMultiplicative(const TargetIdentifier &ti) {