From c05c33bc8ff025c05b0aaeb35fb2e19dcab180d7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:31:40 +0700 Subject: [PATCH 01/26] feat(core): persist independent per-EdgeId SEND enabled state and reject primary toggles --- engine/core/DynamicChannelRoster.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index bf76ad572..42e3bd701 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -30,6 +30,7 @@ struct ChannelSendRef final { float pan=0.f; // send-only balance: PRE mono uses equal-power coefficients bool primaryOutput=false; // OUT selector edge, not a parallel SEND std::uint64_t edgeId=0; // stable native identity; CONTROL-only assignment + bool enabled=true; // independent SEND ON; retain EdgeId/gain/tap when OFF }; struct ChannelStripDefinition final { ChannelId id{}; @@ -59,7 +60,7 @@ struct ChannelEdit final { enum class Kind : std::uint8_t { add, duplicate, remove, move, rename, setFormat, setFader, setPan, setMute, setSolo, addInsertReference, addSendReference, setPrimaryOutput, - removeInsertReference, moveInsertReference, + removeInsertReference, moveInsertReference, setSendEnabled, // Control-document metadata (rack/slot bypass) changes revision // without changing a fader, audio descriptor or live PCM topology. touchDocumentRevision @@ -76,6 +77,7 @@ struct ChannelEdit final { bool primaryOutput=false; // exclusive OUT edge, independent of parallel SEND bool connectMainOnCreate=false; // WIRE-first native creation; legacy imports unchanged float sendPan=0.f; // independent send PAN, never channel fader PAN + std::uint64_t sendEdgeId=0; // exact parallel send identity for SEND ON/OFF std::string text; }; struct ChannelEditResult final { @@ -241,6 +243,16 @@ class DynamicChannelRoster final { case ChannelEdit::Kind::setSolo: it->solo=op.enabled; break; + case ChannelEdit::Kind::setSendEnabled: { + const auto edge=std::find_if(it->sends.begin(),it->sends.end(), + [&](const auto& send){return send.edgeId==op.sendEdgeId;}); + if(!op.sendEdgeId || edge==it->sends.end()) + result.fault=ChannelEditFault::missingEdge; + else if(edge->primaryOutput) + result.fault=ChannelEditFault::invalidAction; + else edge->enabled=op.enabled; + break; + } case ChannelEdit::Kind::touchDocumentRevision: // Exact stable ChannelId is validated above. Bump the // document revision without fabricating a DSP parameter @@ -306,6 +318,7 @@ class DynamicChannelRoster final { primary->gain=1.f; primary->preFader=false; primary->pan=0.f; + primary->enabled=true; } else { if(edges.size()>=budget_.maximumSendsPerChannel) { result.fault=ChannelEditFault::budgetExceeded;break; @@ -439,6 +452,7 @@ class DynamicChannelRoster final { // of doubling a parallel SEND in the accepted PCM. target->primaryOutput=true; target->gain=1.f;target->preFader=false;target->pan=0.f; + target->enabled=true; continue; } } From 5583caae354363577929568ec5dabb96c0dca6cf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:31:49 +0700 Subject: [PATCH 02/26] feat(pcm): compile disabled parallel SEND to zero contribution without deleting route --- engine/core/DynamicPreparedMixerBlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index e44575411..4c2f70846 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -483,8 +483,8 @@ class DynamicPreparedMixerBlock final { (send.pan>0.f?1.f-send.pan:1.f); const float gr=monoPre?std::sqrt(.5f*(1.f+send.pan)): (send.pan<0.f?1.f+send.pan:1.f); - outgoing[i].push_back({to,gl,gr,send.gain,send.preFader, - send.primaryOutput}); + outgoing[i].push_back({to,gl,gr,send.enabled?send.gain:0.f, + send.preFader,send.primaryOutput}); parents[to].push_back(i); ++indegree[to]; } From be1578343b6e76bf2987aab5105bfcc09e8c4f0b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:32:03 +0700 Subject: [PATCH 03/26] fix(pcm): prevent live send gain edits from re-enabling an OFF edge --- engine/core/DynamicPreparedMixerBlock.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 4c2f70846..c318ef22c 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -64,7 +64,7 @@ class DynamicPreparedMixerBlock final { struct Edge final { std::size_t destination=0; float panL=0.f,panR=0.f,initialGain=1.f; - bool pre=false,primary=false; + bool pre=false,primary=false,enabled=true; }; struct Lane final { ChannelId id{}; @@ -238,7 +238,7 @@ class DynamicPreparedMixerBlock final { for(std::size_t e=lane.first;e Date: Fri, 13 Nov 2026 07:32:16 +0700 Subject: [PATCH 04/26] feat(session): round-trip SEND enabled in .smix with legacy default ON --- src/NativeMixerSessionDocument.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/NativeMixerSessionDocument.h b/src/NativeMixerSessionDocument.h index 4dbdfbb8b..c8dbb3f96 100644 --- a/src/NativeMixerSessionDocument.h +++ b/src/NativeMixerSessionDocument.h @@ -540,6 +540,7 @@ class Codec final { set(e,"to",decimal(s.destination.value)); set(e,"gain",s.gain);set(e,"pan",s.pan); set(e,"pre",s.preFader);set(e,"primary",s.primaryOutput); + set(e,"enabled",s.enabled); sends.add(e); } set(ch,"catalogs",juce::var(catalogs)); @@ -703,6 +704,11 @@ class Codec final { edge.pan=static_cast(n); if(!strictBool(get(send,"pre"),edge.preFader)|| !strictBool(get(send,"primary"),edge.primaryOutput))return false; + // Backward compatible: historical .smix has no separate SEND ON. + // Missing means ON; an explicitly malformed value fails closed. + const auto enabled=get(send,"enabled"); + if(!enabled.isVoid() && !strictBool(enabled,edge.enabled))return false; + if(edge.primaryOutput && !edge.enabled)return false; row.sends.push_back(edge); } entries.push_back(std::move(row)); From 17ed387a102943bb422ab3b31bb4b1ce29963565 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:32:30 +0700 Subject: [PATCH 05/26] feat(logical): add validated SET_SEND_ENABLED and truthful edge snapshot state --- src/NativeLogicalMixerWorkspace.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/NativeLogicalMixerWorkspace.h b/src/NativeLogicalMixerWorkspace.h index a3d187f8e..d932119ad 100644 --- a/src/NativeLogicalMixerWorkspace.h +++ b/src/NativeLogicalMixerWorkspace.h @@ -178,6 +178,17 @@ class NativeLogicalMixerWorkspace final { edit.value=static_cast(n); } result=editor_.edit(expected,std::span{&edit,1}); + } else if(operation=="SET_SEND_ENABLED") { + // Logical/offline operation only: cannot authorize installed PCM. + // The authoritative roster retains EdgeId and stored gain/tap. + const auto edgeVar=payload.getProperty("edgeId",{}); + std::uint64_t sendId=0; + if(!armix::session::parseDecimal(edgeVar,sendId) || !sendId || + !number.isBool())return bad("INVALID_SEND_ENABLED"); + edit.kind=ChannelEdit::Kind::setSendEnabled; + edit.sendEdgeId=sendId; + edit.enabled=static_cast(number); + result=editor_.edit(expected,std::span{&edit,1}); } else if(operation=="SET_MUTE" || operation=="SET_SOLO") { if(!number.isBool())return bad("INVALID_BOOLEAN_CONTROL"); edit.kind=operation=="SET_MUTE"? @@ -341,6 +352,7 @@ class NativeLogicalMixerWorkspace final { for(const char* op:{"CREATE_CHANNEL","DELETE_CHANNEL","CREATE_GROUP", "REMOVE_BUS","RENAME_CHANNEL","SET_FADER","SET_PAN","SET_MUTE", "SET_SOLO","SET_PROCESSING_FORMAT","WIRE_TRANSACTION", + "SET_SEND_ENABLED", "ADD_FX_REFERENCE","REMOVE_FX_REFERENCE", "SET_FX_SLOT_BYPASS","SET_FX_RACK_BYPASS"})operations.add(juce::String(op)); set(cap,"supportedOps",juce::var(operations)); @@ -393,7 +405,7 @@ class NativeLogicalMixerWorkspace final { set(edge,"edgeId",str(send.edgeId)); set(edge,"from",str(row.id.value)); set(edge,"to",str(send.destination.value)); - set(edge,"signalKind","AUDIO");set(edge,"enabled",true); + set(edge,"signalKind","AUDIO");set(edge,"enabled",send.enabled); set(edge,"gainLinear",static_cast(send.gain)); set(edge,"primaryOutput",send.primaryOutput); set(edge,"tap",send.preFader?"SPLIT_PRE":"POST_FADER"); From b70209da2a43344deac471a36340a27e1bdec0fb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:33:03 +0700 Subject: [PATCH 06/26] test(core): verify SEND OFF/ON preserves EdgeId and rejects stale/primary edits --- .../device_independent_mixer_session_test.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/device_independent_mixer_session_test.cpp b/tests/device_independent_mixer_session_test.cpp index 780c76216..62e0f0208 100644 --- a/tests/device_independent_mixer_session_test.cpp +++ b/tests/device_independent_mixer_session_test.cpp @@ -80,6 +80,41 @@ int main() { valid(track->sends.back().destination==stableMain && !track->sends.back().primaryOutput); + // SEND ON/OFF is a state of the exact parallel EdgeId, NOT removal. + // Primary OUT and a different edge may not be touched accidentally. + const auto sendEdge=track->sends.back().edgeId; + ChannelEdit off;off.kind=ChannelEdit::Kind::setSendEnabled; + off.id=backing;off.sendEdgeId=sendEdge;off.enabled=false; + auto toggled=logical.edit(logical.revision(), + std::span{&off,1}); + valid(toggled.accepted()); + track=logical.roster().find(backing); + valid(track->sends.size()==2 && !track->sends.back().enabled && + track->sends.back().gain==.25f && + track->sends.back().edgeId==sendEdge && + track->sends.front().primaryOutput && track->sends.front().enabled); + const auto revisionAfterOff=logical.revision(); + valid(!logical.edit(revisionAfterOff-1, + std::span{&off,1}).accepted()); + ChannelEdit wrong=off;wrong.sendEdgeId=serialEdge; + valid(!logical.edit(logical.revision(), + std::span{&wrong,1}).accepted()); + wrong.sendEdgeId=99999999; + valid(!logical.edit(logical.revision(), + std::span{&wrong,1}).accepted()); + valid(!logical.roster().find(backing)->sends.back().enabled); + // Restore retains disabled SEND identity and parameters without hardware. + DeviceIndependentMixerSession switched; + valid(switched.restore(logical.roster())); + const auto* swapped=switched.roster().find(backing); + valid(swapped && !swapped->sends.back().enabled && + swapped->sends.back().gain==.25f && swapped->sends.back().edgeId==sendEdge); + ChannelEdit on=off;on.enabled=true; + valid(logical.edit(logical.revision(), + std::span{&on,1}).accepted()); + valid(logical.roster().find(backing)->sends.back().enabled && + logical.roster().find(backing)->sends.back().edgeId==sendEdge); + // 4) SOURCE ONLY removes primary MAIN but leaves the strip and // its explicit parallel SEND. Removing the last send keeps the channel. ChannelEdit sourceOnly; From f0f2458c5ff8aba1396d80caf58a847ab12f47eb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:33:43 +0700 Subject: [PATCH 07/26] test(pcm): verify per-EdgeId SEND OFF silences audio and ON restores gain/tap --- tests/dynamic_accepted_session_test.cpp | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index de60b7740..581556590 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -29,6 +29,70 @@ static ChannelEdit send(ChannelId from,ChannelId to,float gain,bool pre=false) { e.id=from;e.target=to;e.value=gain;e.preFader=pre;return e; } +// Real PCM SEND ON/OFF: mute one parallel edge without deleting the cable, +// changing its gain/tap, or affecting the source channel's MAIN contribution. +static void verifyPerEdgeSendEnablePcm() { + constexpr std::uint64_t epoch=9422; + DynamicAcceptedSession session; + DynamicGraphRequest req;req.physicalInputs=1;req.maxFrames=64; + const std::array channels{ + add(0,ChannelRole::input,"VOICE"), + add(1,ChannelRole::fxReturn,"WET",ProcessingFormat::stereo), + add(2,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + auto a=session.edit(0,0,channels,req,epoch,epoch,true); + assert(a.ok()); + const auto voice=a.edit.createdIds[0]; + const auto wet=a.edit.createdIds[1]; + const auto main=a.edit.createdIds[2]; + const std::array links{ + output(voice,main),output(wet,main),send(voice,wet,.5f,true) + }; + req.sources={{voice,0,-1,false}}; + a=session.edit(1,1,links,req,epoch,epoch,true); + assert(a.ok()); + const auto* row=session.acceptedRoster().find(voice); + assert(row && row->sends.size()==2); + const auto edge=std::find_if(row->sends.begin(),row->sends.end(), + [&](const auto& e){return e.destination==wet && !e.primaryOutput;}); + assert(edge!=row->sends.end() && edge->enabled); + const auto edgeId=edge->edgeId; + std::array input{},l{},r{};input.fill(.5f); + const float* pins[]{input.data()}; + const auto fx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&](){ + return session.render(epoch,pins,1,l.data(),r.data(),64,false,fx); + }; + assert(render()); + const float withSend=l[63]; + assert(withSend>.35f); + ChannelEdit off;off.kind=ChannelEdit::Kind::setSendEnabled; + off.id=voice;off.sendEdgeId=edgeId;off.enabled=false; + const std::array disable{off}; + a=session.edit(2,2,disable,req,epoch,epoch,true); + assert(a.ok() && a.graphRevision==3); + row=session.acceptedRoster().find(voice); + const auto offEdge=std::find_if(row->sends.begin(),row->sends.end(), + [&](const auto& e){return e.edgeId==edgeId;}); + assert(offEdge!=row->sends.end() && !offEdge->enabled && + offEdge->gain==.5f && offEdge->preFader); + assert(!session.setLiveParallelSend(epoch,3,voice,wet,true,1.f)); + assert(render()); + const float withoutSend=l[63]; + assert(withoutSend>.1f && withoutSend enable{on}; + a=session.edit(3,3,enable,req,epoch,epoch,true); + assert(a.ok() && a.graphRevision==4); + row=session.acceptedRoster().find(voice); + const auto onEdge=std::find_if(row->sends.begin(),row->sends.end(), + [&](const auto& e){return e.edgeId==edgeId;}); + assert(onEdge!=row->sends.end() && onEdge->enabled && + onEdge->gain==.5f && onEdge->preFader); + assert(render() && near(l[63],withSend,1e-4f)); + session.unpublish();session.pollRetirement(); +} + static void verifyRealtimeSlewAndNativeChannelIdContinuousControls() { using armix::dsp::RealtimeSlew64; // Sub-64 variable callbacks must not finish a 64-sample gesture in 4 @@ -919,6 +983,7 @@ int main() { verifyConsoleWirePrimaryOutputPcm(); verifyRealtimeSlewAndNativeChannelIdContinuousControls(); + verifyPerEdgeSendEnablePcm(); constexpr std::uint64_t epoch=77; constexpr float center=.7071067811865475f; DynamicAcceptedSession session; From 95ed9df95a92144d4b55bd479362436524b3fd4e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:36:15 +0700 Subject: [PATCH 08/26] feat(core): add independent digital pre-insert ChannelId gain state and validation --- engine/core/DynamicChannelRoster.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index 42e3bd701..621322f28 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -38,6 +38,7 @@ struct ChannelStripDefinition final { ProcessingFormat format=ProcessingFormat::mono; std::string name; float faderLinear=1.f, pan=0.f; + float inputGainLinear=1.f; // digital pre-insert gain, not hardware preamp bool mute=false, solo=false; // Catalog identifiers ONLY. No vendor processor object is copied or built. // The existing audio control thread owns independent VST instance creation. @@ -60,7 +61,7 @@ struct ChannelEdit final { enum class Kind : std::uint8_t { add, duplicate, remove, move, rename, setFormat, setFader, setPan, setMute, setSolo, addInsertReference, addSendReference, setPrimaryOutput, - removeInsertReference, moveInsertReference, setSendEnabled, + removeInsertReference, moveInsertReference, setSendEnabled, setInputGain, // Control-document metadata (rack/slot bypass) changes revision // without changing a fader, audio descriptor or live PCM topology. touchDocumentRevision @@ -121,6 +122,13 @@ class DynamicChannelRoster final { row.faderLinear=gain;row.pan=pan; return true; } + bool rememberLiveInputGain(ChannelId id,float gain) noexcept { + if(!id.value || !std::isfinite(gain) || gain<0.f || gain>16.f)return false; + const auto it=index_.find(id.value); + if(it==index_.end() || channels_[it->second].role!=ChannelRole::input)return false; + channels_[it->second].inputGainLinear=gain; + return true; + } bool rememberLiveMuteSolo(ChannelId id,bool mute,bool solo) noexcept { const auto it=index_.find(id.value); if(!id.value||it==index_.end())return false; @@ -232,6 +240,12 @@ class DynamicChannelRoster final { result.fault=ChannelEditFault::invalidValue; else it->faderLinear=op.value; break; + case ChannelEdit::Kind::setInputGain: + if(it->role!=ChannelRole::input || !std::isfinite(op.value)|| + op.value<0.f||op.value>16.f) + result.fault=ChannelEditFault::invalidValue; + else it->inputGainLinear=op.value; + break; case ChannelEdit::Kind::setPan: if(!std::isfinite(op.value)||op.value< -1.f||op.value>1.f) result.fault=ChannelEditFault::invalidValue; @@ -764,6 +778,9 @@ class DynamicChannelRoster final { if(!ch.id.value || ch.id.value==std::numeric_limits::max() || !ids.insert(ch.id.value).second || !std::isfinite(ch.faderLinear) || ch.faderLinear<0.f || + !std::isfinite(ch.inputGainLinear) || ch.inputGainLinear<0.f || + ch.inputGainLinear>16.f || + (ch.role!=ChannelRole::input && ch.inputGainLinear!=1.f) || ch.faderLinear>4.f || !std::isfinite(ch.pan) || ch.pan< -1.f || ch.pan>1.f)return false; maxId=std::max(maxId,ch.id.value); From 518c2c294f92371ac8748930bc1bdeb1612a7e30 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:36:34 +0700 Subject: [PATCH 09/26] feat(pcm): process digital input gain before FX with callback-safe 64-sample slew --- engine/core/DynamicPreparedMixerBlock.h | 26 ++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index c318ef22c..136ce6437 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -98,7 +98,8 @@ class DynamicPreparedMixerBlock final { } struct ChannelTarget final { std::atomic state{Word::encode(1.f,1.f,false,false)}; - armix::dsp::RealtimeSlew64 appliedL{},appliedR{},gate{}; // AUDIO only + std::atomic inputGain{1.f}; // pre-insert digital trim target + armix::dsp::RealtimeSlew64 inputApplied{},appliedL{},appliedR{},gate{}; // AUDIO only }; // CONTROL only packs already verified callback-ordinal physical pin pairs. // 0xFFFF means missing right input for mono, never an active physical pin. @@ -172,6 +173,16 @@ class DynamicPreparedMixerBlock final { std::memory_order_release); return true; } + // Stable-ChannelId digital input gain; one control atomic, 64-sample RT slew. + // Not a physical mic-preamp and never a graph recompile on movement. + bool setInputGain(ChannelId id,float linear) noexcept { + if(!id.value || !std::isfinite(linear) || linear<0.f || linear>16.f)return false; + const auto found=controlIndex_.find(id.value); + if(found==controlIndex_.end() || lanes_[found->second].role!=ChannelRole::input) + return false; + channelTargets_[found->second].inputGain.store(linear,std::memory_order_release); + return true; + } // Canonical physical-pin validation shared by structural preflight and // accepted realtime SOURCE changes. Never normalize an invalid draft // into an apparently successful ACK by replacing it with old pins. @@ -592,6 +603,8 @@ class DynamicPreparedMixerBlock final { target.state.store(Word::encode(next.lanes_[i].gainL, next.lanes_[i].gainR,rows[i].mute,rows[i].solo), std::memory_order_relaxed); + target.inputGain.store(rows[i].inputGainLinear,std::memory_order_relaxed); + target.inputApplied.reset(rows[i].inputGainLinear); target.appliedL.reset(next.lanes_[i].gainL); target.appliedR.reset(next.lanes_[i].gainR); target.gate.reset(next.initialAudible_[i]?1.f:0.f); @@ -761,6 +774,17 @@ class DynamicPreparedMixerBlock final { for(int f=0;f Date: Fri, 13 Nov 2026 07:36:45 +0700 Subject: [PATCH 10/26] feat(native): accept epoch-fenced input gain into prepared PCM target --- engine/core/DynamicNativeSessionPublisher.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 4970c1046..aedc0c5ac 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -318,6 +318,13 @@ class DynamicNativeSessionPublisher final { return active.graph.setChannelMix(id,gain,pan); }); } + bool setInputGain(std::uint64_t epoch,std::uint64_t revision, + ChannelId id,float linear) noexcept { + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& active) noexcept { + return active.graph.setInputGain(id,linear); + }); + } bool setChannelMuteSolo(std::uint64_t epoch,std::uint64_t revision, ChannelId id,bool mute,bool solo) noexcept { return publisher_.updateActiveControl(epoch,revision, From b17ee046f8504c37d4367c7b55f9e1dd0ab61e44 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:37:00 +0700 Subject: [PATCH 11/26] feat(native): remember epoch-ACKed input gain across graph recompilation --- engine/core/DynamicAcceptedSession.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index dd4486f23..6a5ce10dc 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -306,6 +306,15 @@ class DynamicAcceptedSession final { return false; return accepted_.rememberLiveMix(id,linear,pan); } + // A real accepted post-source, pre-FX digital gain update. Remembers the + // final value without changing graph topology or touching the audio thread. + bool setLiveInputGain(std::uint64_t epoch,std::uint64_t graphRevision, + ChannelId id,float linear) noexcept { + const auto* row=accepted_.find(id); + if(!row || row->role!=ChannelRole::input || + !publisher_.setInputGain(epoch,graphRevision,id,linear))return false; + return accepted_.rememberLiveInputGain(id,linear); + } // The accepted physical patch is canonical too: subsequent Group/FX // graph recompiles must preserve the most recently ACKed live SOURCE. bool setLivePhysicalSource(std::uint64_t epoch,std::uint64_t graphRevision, From 6a5cf6842ab87527b323b384959a362ace37094f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:37:10 +0700 Subject: [PATCH 12/26] feat(session): persist digital input trim with legacy unity migration --- src/NativeMixerSessionDocument.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NativeMixerSessionDocument.h b/src/NativeMixerSessionDocument.h index c8dbb3f96..df504123e 100644 --- a/src/NativeMixerSessionDocument.h +++ b/src/NativeMixerSessionDocument.h @@ -530,6 +530,7 @@ class Codec final { set(ch,"format",static_cast(row.format)); set(ch,"name",juce::String::fromUTF8(row.name.c_str())); set(ch,"gain",row.faderLinear); + set(ch,"inputGain",row.inputGainLinear); set(ch,"pan",row.pan);set(ch,"mute",row.mute);set(ch,"solo",row.solo); juce::Array catalogs,sends; for(const auto& c:row.insertCatalogIds) @@ -680,6 +681,12 @@ class Codec final { if(!textField(get(ch,"name"),name,96)|| !real(get(ch,"gain"),n,0.,4.))return false; row.name=name.toStdString();row.faderLinear=static_cast(n); + // Legacy .smix defaults to unity digital trim without a new FX. + const auto trim=get(ch,"inputGain"); + if(!trim.isVoid()) { + if(!real(trim,n,0.,16.))return false; + row.inputGainLinear=static_cast(n); + } if(!real(get(ch,"pan"),n,-1.,1.))return false; row.pan=static_cast(n); if(!strictBool(get(ch,"mute"),row.mute)|| From 67ebb84c7fcfc912b030fbc96436ab8f07cdddb1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:37:24 +0700 Subject: [PATCH 13/26] =?UTF-8?q?feat(logical):=20SET=5FINPUT=5FGAIN=20?= =?UTF-8?q?=E2=88=9224..24=20dB=20and=20truthful=20digital=20gain=20snapsh?= =?UTF-8?q?ot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/NativeLogicalMixerWorkspace.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/NativeLogicalMixerWorkspace.h b/src/NativeLogicalMixerWorkspace.h index d932119ad..5ef91c9e9 100644 --- a/src/NativeLogicalMixerWorkspace.h +++ b/src/NativeLogicalMixerWorkspace.h @@ -163,6 +163,18 @@ class NativeLogicalMixerWorkspace final { armix::mixer::ProcessingFormat::mono: armix::mixer::ProcessingFormat::stereo; result=editor_.edit(expected,std::span{&edit,1}); + } else if(operation=="SET_INPUT_GAIN") { + if(!(number.isDouble() || number.isInt() || number.isInt64())) + return bad("INVALID_INPUT_GAIN"); + const auto db=static_cast(number); + if(!std::isfinite(db) || db< -24. || db>24.) + return bad("INVALID_INPUT_GAIN"); + const auto* target=editor_.roster().find(id); + if(!target || target->role!=Role::input) + return bad("INPUT_GAIN_NOT_APPLICABLE"); + edit.kind=ChannelEdit::Kind::setInputGain; + edit.value=static_cast(std::pow(10.,db/20.)); + result=editor_.edit(expected,std::span{&edit,1}); } else if(operation=="SET_FADER" || operation=="SET_PAN") { if(!(number.isDouble() || number.isInt() || number.isInt64())) return bad("INVALID_CONTROL_VALUE"); @@ -352,6 +364,7 @@ class NativeLogicalMixerWorkspace final { for(const char* op:{"CREATE_CHANNEL","DELETE_CHANNEL","CREATE_GROUP", "REMOVE_BUS","RENAME_CHANNEL","SET_FADER","SET_PAN","SET_MUTE", "SET_SOLO","SET_PROCESSING_FORMAT","WIRE_TRANSACTION", + "SET_INPUT_GAIN", "SET_SEND_ENABLED", "ADD_FX_REFERENCE","REMOVE_FX_REFERENCE", "SET_FX_SLOT_BYPASS","SET_FX_RACK_BYPASS"})operations.add(juce::String(op)); @@ -373,6 +386,8 @@ class NativeLogicalMixerWorkspace final { set(controls,"faderDb",row.faderLinear>0.f? std::max(-60.,20.*std::log10(static_cast(row.faderLinear))):-60.); set(controls,"pan",static_cast(row.pan)); + set(controls,"inputGainDb",20.*std::log10( + std::max(1.e-12,static_cast(row.inputGainLinear)))); set(controls,"mute",row.mute);set(controls,"solo",row.solo); set(channel,"controls",controls); auto source=object(); From 1bd4cf825fa371979ede5e184186ffb97f40228d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:38:01 +0700 Subject: [PATCH 14/26] test(pcm): prove native digital gain precedes nonlinear FX and smooths 64 samples --- tests/dynamic_accepted_session_test.cpp | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 581556590..1b2b8b623 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -93,6 +93,58 @@ static void verifyPerEdgeSendEnablePcm() { session.unpublish();session.pollRetirement(); } +// Digital input trim must precede nonlinear FX, with callback-continuous +// sample smoothing and a stable ChannelId during live parameter changes. +static void verifyDigitalInputGainBeforeFxPcm() { + constexpr std::uint64_t epoch=9442; + DynamicAcceptedSession session; + DynamicGraphRequest req;req.physicalInputs=1;req.maxFrames=64; + const std::array setup{ + add(0,ChannelRole::input,"MIC"), + add(1,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + auto a=session.edit(0,0,setup,req,epoch,epoch,true); + assert(a.ok()); + const auto mic=a.edit.createdIds[0]; + const auto main=a.edit.createdIds[1]; + const std::array link{output(mic,main)}; + req.sources={{mic,0,-1,false}}; + a=session.edit(1,1,link,req,epoch,epoch,true); + assert(a.ok()); + std::array input{},l{},r{};input.fill(.25f); + const float* pins[]{input.data()}; + const auto square=[&](ChannelId ch,float* left,float* right,int n) noexcept { + if(ch!=mic)return; + for(int i=0;iinputGainLinear==2.f); + assert(render(4)); + assert(l[3]>original && l[3] change{rename}; + a=session.edit(2,2,change,req,epoch,epoch,true); + assert(a.ok() && session.acceptedRoster().find(mic)->inputGainLinear==2.f); + assert(render(64)); + assert(near(l[63],original*4.f,1e-4f)); + session.unpublish();session.pollRetirement(); +} + static void verifyRealtimeSlewAndNativeChannelIdContinuousControls() { using armix::dsp::RealtimeSlew64; // Sub-64 variable callbacks must not finish a 64-sample gesture in 4 @@ -984,6 +1036,7 @@ int main() { verifyConsoleWirePrimaryOutputPcm(); verifyRealtimeSlewAndNativeChannelIdContinuousControls(); verifyPerEdgeSendEnablePcm(); + verifyDigitalInputGainBeforeFxPcm(); constexpr std::uint64_t epoch=77; constexpr float center=.7071067811865475f; DynamicAcceptedSession session; From 5cf45bb78020eb3ba8628ed57fd289e17d38c70d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:38:15 +0700 Subject: [PATCH 15/26] test(logical): preserve stable ChannelId digital gain through offline restore --- tests/device_independent_mixer_session_test.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/device_independent_mixer_session_test.cpp b/tests/device_independent_mixer_session_test.cpp index 62e0f0208..af1ccdfc8 100644 --- a/tests/device_independent_mixer_session_test.cpp +++ b/tests/device_independent_mixer_session_test.cpp @@ -159,6 +159,9 @@ int main() { ChannelEdit gain;gain.kind=ChannelEdit::Kind::setFader; gain.id=backing;gain.value=.5f; settings.push_back(gain); + ChannelEdit trim;trim.kind=ChannelEdit::Kind::setInputGain; + trim.id=backing;trim.value=2.f; + settings.push_back(trim); ChannelEdit pan;pan.kind=ChannelEdit::Kind::setPan; pan.id=backing;pan.value=-.2f; settings.push_back(pan); @@ -192,7 +195,8 @@ int main() { const auto* row=restored.roster().find(backing); valid(row && row->format==ProcessingFormat::mono && std::abs(row->faderLinear-.5f)<1.e-6f && - std::abs(row->pan+.2f)<1.e-6f && row->mute && row->solo && + std::abs(row->pan+.2f)<1.e-6f && row->inputGainLinear==2.f && + row->mute && row->solo && row->insertCatalogIds.size()==1 && row->insertCatalogIds.front()=="armix.builtin.channel-compressor.v1"); From 31690ece6e836c4e4a87d9d8840bfa14f7b33711 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:39:07 +0700 Subject: [PATCH 16/26] feat(core): exact EdgeId PRE_FADER/POST_FADER retap with primary route rejection --- engine/core/DynamicChannelRoster.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index 621322f28..5410317e7 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -61,7 +61,7 @@ struct ChannelEdit final { enum class Kind : std::uint8_t { add, duplicate, remove, move, rename, setFormat, setFader, setPan, setMute, setSolo, addInsertReference, addSendReference, setPrimaryOutput, - removeInsertReference, moveInsertReference, setSendEnabled, setInputGain, + removeInsertReference, moveInsertReference, setSendEnabled, setSendTap, setInputGain, // Control-document metadata (rack/slot bypass) changes revision // without changing a fader, audio descriptor or live PCM topology. touchDocumentRevision @@ -257,14 +257,17 @@ class DynamicChannelRoster final { case ChannelEdit::Kind::setSolo: it->solo=op.enabled; break; - case ChannelEdit::Kind::setSendEnabled: { + case ChannelEdit::Kind::setSendEnabled: + case ChannelEdit::Kind::setSendTap: { const auto edge=std::find_if(it->sends.begin(),it->sends.end(), [&](const auto& send){return send.edgeId==op.sendEdgeId;}); if(!op.sendEdgeId || edge==it->sends.end()) result.fault=ChannelEditFault::missingEdge; else if(edge->primaryOutput) result.fault=ChannelEditFault::invalidAction; - else edge->enabled=op.enabled; + else if(op.kind==ChannelEdit::Kind::setSendEnabled) + edge->enabled=op.enabled; + else edge->preFader=op.preFader; // post-insert PRE, not PRE_FX break; } case ChannelEdit::Kind::touchDocumentRevision: @@ -793,7 +796,8 @@ class DynamicChannelRoster final { !send.destination.value || send.destination==ch.id || !edges.insert(send.edgeId).second || !std::isfinite(send.gain)||send.gain<0.f||send.gain>4.f || - !std::isfinite(send.pan)||send.pan< -1.f||send.pan>1.f) + !std::isfinite(send.pan)||send.pan< -1.f||send.pan>1.f || + (send.primaryOutput && (!send.enabled || send.preFader))) return false; primary+=send.primaryOutput; maxEdge=std::max(maxEdge,send.edgeId); From f6f23f769431339cef728f3f367570e18f06dc63 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:39:21 +0700 Subject: [PATCH 17/26] feat(logical): validated per-EdgeId SET_SEND_TAP with explicit PRE_FADER stage readback --- src/NativeLogicalMixerWorkspace.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/NativeLogicalMixerWorkspace.h b/src/NativeLogicalMixerWorkspace.h index 5ef91c9e9..b3334ccc0 100644 --- a/src/NativeLogicalMixerWorkspace.h +++ b/src/NativeLogicalMixerWorkspace.h @@ -190,6 +190,18 @@ class NativeLogicalMixerWorkspace final { edit.value=static_cast(n); } result=editor_.edit(expected,std::span{&edit,1}); + } else if(operation=="SET_SEND_TAP") { + const auto edgeVar=payload.getProperty("edgeId",{}); + std::uint64_t sendId=0; + if(!armix::session::parseDecimal(edgeVar,sendId) || !sendId) + return bad("INVALID_SEND_TAP_EDGE"); + const auto tap=payload.getProperty("tap","").toString(); + if(tap!="PRE_FADER" && tap!="POST_FADER") + return bad("INVALID_SEND_TAP_STAGE"); + edit.kind=ChannelEdit::Kind::setSendTap; + edit.sendEdgeId=sendId; + edit.preFader=tap=="PRE_FADER"; + result=editor_.edit(expected,std::span{&edit,1}); } else if(operation=="SET_SEND_ENABLED") { // Logical/offline operation only: cannot authorize installed PCM. // The authoritative roster retains EdgeId and stored gain/tap. @@ -365,7 +377,7 @@ class NativeLogicalMixerWorkspace final { "REMOVE_BUS","RENAME_CHANNEL","SET_FADER","SET_PAN","SET_MUTE", "SET_SOLO","SET_PROCESSING_FORMAT","WIRE_TRANSACTION", "SET_INPUT_GAIN", - "SET_SEND_ENABLED", + "SET_SEND_ENABLED","SET_SEND_TAP", "ADD_FX_REFERENCE","REMOVE_FX_REFERENCE", "SET_FX_SLOT_BYPASS","SET_FX_RACK_BYPASS"})operations.add(juce::String(op)); set(cap,"supportedOps",juce::var(operations)); @@ -424,6 +436,9 @@ class NativeLogicalMixerWorkspace final { set(edge,"gainLinear",static_cast(send.gain)); set(edge,"primaryOutput",send.primaryOutput); set(edge,"tap",send.preFader?"SPLIT_PRE":"POST_FADER"); + // Explicit native DSP stage. Legacy SPLIT_PRE field stays + // compatible; it must not be presented as browser PRE_FX. + set(edge,"tapStage",send.preFader?"PRE_FADER":"POST_FADER"); edges.add(edge); sends.add(edge); if(send.primaryOutput)set(channel,"primaryOutId",str(send.destination.value)); From 6e606d4508b28a6a39d291309e69b1d9c6fba708 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:39:49 +0700 Subject: [PATCH 18/26] test(pcm): true PRE_FADER wet survives source fader zero while POST goes silent --- tests/dynamic_accepted_session_test.cpp | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 1b2b8b623..9ca33bf6f 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -90,6 +90,32 @@ static void verifyPerEdgeSendEnablePcm() { assert(onEdge!=row->sends.end() && onEdge->enabled && onEdge->gain==.5f && onEdge->preFader); assert(render() && near(l[63],withSend,1e-4f)); + // PRE_FADER is AFTER FX and BEFORE the source channel fader. + // With source fader fully closed, wet PRE remains; POST must go silent. + assert(session.setLiveMix(epoch,4,voice,0.f,0.f)); + assert(render()); + const float truePre=l[63]; + assert(truePre>.01f && truePre post{retap}; + a=session.edit(4,4,post,req,epoch,epoch,true); + assert(a.ok() && a.graphRevision==5); + row=session.acceptedRoster().find(voice); + const auto moved=std::find_if(row->sends.begin(),row->sends.end(), + [&](const auto& e){return e.edgeId==edgeId;}); + assert(moved!=row->sends.end() && !moved->preFader && + moved->enabled && moved->gain==.5f); + assert(render() && near(l[63],0.f,1e-5f)); + // Reject primary tap edits and keep the accepted revision/audio intact. + const auto primary=std::find_if(row->sends.begin(),row->sends.end(), + [&](const auto& e){return e.primaryOutput;}); + assert(primary!=row->sends.end()); + retap.sendEdgeId=primary->edgeId;retap.preFader=true; + const std::array illegal{retap}; + a=session.edit(5,5,illegal,req,epoch,epoch,true); + assert(!a.ok() && session.acceptedGraphRevision()==5); + assert(render() && near(l[63],0.f,1e-5f)); session.unpublish();session.pollRetirement(); } From eddcb143ba285a15f812f6c470864802a9fd5b39 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:41:07 +0700 Subject: [PATCH 19/26] ci(fast): compile deterministic PCM gain, PRE/POST and SEND tests on Linux --- .github/workflows/logical-mixer-fast.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/logical-mixer-fast.yml b/.github/workflows/logical-mixer-fast.yml index d0621622d..0313dc7cf 100644 --- a/.github/workflows/logical-mixer-fast.yml +++ b/.github/workflows/logical-mixer-fast.yml @@ -4,6 +4,10 @@ on: paths: - 'engine/core/DeviceIndependentMixerSession.h' - 'engine/core/DynamicChannelRoster.h' + - 'engine/core/DynamicPreparedMixerBlock.h' + - 'engine/core/DynamicAcceptedSession.h' + - 'engine/core/DynamicNativeSessionPublisher.h' + - 'tests/dynamic_accepted_session_test.cpp' - 'tests/device_independent_mixer_session_test.cpp' - '.github/workflows/logical-mixer-fast.yml' workflow_dispatch: @@ -19,3 +23,9 @@ jobs: tests/device_independent_mixer_session_test.cpp \ -o /tmp/arsonmix-logical-test /tmp/arsonmix-logical-test + - name: Compile and run native PCM gain, PRE/POST and SEND regressions (no JUCE) + run: | + c++ -std=c++20 -O1 -Wall -Wextra -Werror -I. \ + tests/dynamic_accepted_session_test.cpp \ + -o /tmp/arsonmix-dynamic-pcm-test + /tmp/arsonmix-dynamic-pcm-test From a1c2fbbbc98c8d2e425be43d17c75faaa7e5a620 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:44:24 +0700 Subject: [PATCH 20/26] feat(native): remember live SEND ON state without structural graph revision --- engine/core/DynamicChannelRoster.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index 5410317e7..47a94a9c8 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -129,6 +129,16 @@ class DynamicChannelRoster final { channels_[it->second].inputGainLinear=gain; return true; } + bool rememberLiveSendEnabled(ChannelId source,std::uint64_t edgeId,bool enabled) noexcept { + if(!source.value || !edgeId)return false; + const auto it=index_.find(source.value); + if(it==index_.end())return false; + for(auto& send:channels_[it->second].sends) + if(send.edgeId==edgeId && !send.primaryOutput){ + send.enabled=enabled;return true; + } + return false; + } bool rememberLiveMuteSolo(ChannelId id,bool mute,bool solo) noexcept { const auto it=index_.find(id.value); if(!id.value||it==index_.end())return false; From 63d2377403333bd742003e6d2a8e182368ac9215 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:44:36 +0700 Subject: [PATCH 21/26] feat(snapshot): carry accepted input gain and enabled state in native route projection --- engine/core/DynamicConsoleRoutingView.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/core/DynamicConsoleRoutingView.h b/engine/core/DynamicConsoleRoutingView.h index 29cf7b460..974600512 100644 --- a/engine/core/DynamicConsoleRoutingView.h +++ b/engine/core/DynamicConsoleRoutingView.h @@ -20,12 +20,14 @@ struct ConsoleSendView final { float gain=1.f,pan=0.f; bool preFader=false; std::uint64_t edgeId=0; + bool enabled=true; }; struct ConsoleEdgeView final { std::uint64_t edgeId=0; ChannelId from{},to{}; float gainLinear=1.f; bool preFader=false,primaryOutput=false; + bool enabled=true; }; struct ConsoleChannelView final { ChannelId id{}; @@ -33,6 +35,7 @@ struct ConsoleChannelView final { ProcessingFormat format=ProcessingFormat::mono; std::string name; ChannelId primaryOutput{}; // zero is genuine OUT NONE, NOT muted parallel sends + float inputGainLinear=1.f; // accepted digital pre-insert stage std::vector parallelSends; std::vector primarySources; std::vector parallelSendSources; @@ -70,7 +73,7 @@ class DynamicConsoleRoutingView final { return false; ConsoleChannelView item; item.id=row.id;item.role=row.role;item.format=row.format; - item.name=row.name; + item.name=row.name;item.inputGainLinear=row.inputGainLinear; if(row.role==ChannelRole::main) { if(next.main.value)return false; next.main=row.id; @@ -90,7 +93,7 @@ class DynamicConsoleRoutingView final { if(it==index.end() || !link.edgeId || !acceptedEdgeIds.insert(link.edgeId).second)return false; next.edges.push_back({link.edgeId,sender.id,link.destination, - link.gain,link.preFader,link.primaryOutput}); + link.gain,link.preFader,link.primaryOutput,link.enabled}); auto& destination=next.channels[it->second]; if(link.primaryOutput) { if(sender.primaryOutput.value || link.preFader || @@ -100,7 +103,7 @@ class DynamicConsoleRoutingView final { destination.primarySources.push_back(sender.id); } else { sender.parallelSends.push_back( - {link.destination,link.gain,link.pan,link.preFader,link.edgeId}); + {link.destination,link.gain,link.pan,link.preFader,link.edgeId,link.enabled}); // One source shown once in the Bus fan-in even if it has // multiple legal taps to that destination. if(std::find(destination.parallelSendSources.begin(), From 6c25d035b8f6b6c3aa0d43bdde7ad7219b128155 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:44:58 +0700 Subject: [PATCH 22/26] feat(pcm): realtime SEND ON/OFF with existing 64-sample gain ramp by EdgeId --- engine/core/DynamicPreparedMixerBlock.h | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 136ce6437..d7d674540 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -65,6 +65,7 @@ class DynamicPreparedMixerBlock final { std::size_t destination=0; float panL=0.f,panR=0.f,initialGain=1.f; bool pre=false,primary=false,enabled=true; + std::uint64_t edgeId=0; }; struct Lane final { ChannelId id{}; @@ -122,6 +123,7 @@ class DynamicPreparedMixerBlock final { static_assert(std::atomic::is_always_lock_free, "Realtime SEND must never enter a hidden blocking atomic path"); std::atomic gain{1.f}; + std::atomic enabled{true}; armix::dsp::RealtimeSlew64 applied{}; }; // O1: immutable lane roster + one lock-free control target per lane. @@ -249,13 +251,32 @@ class DynamicPreparedMixerBlock final { for(std::size_t e=lane.first;e4.f)return false; + const auto found=controlIndex_.find(source.value); + if(found==controlIndex_.end())return false; + const auto& lane=lanes_[found->second]; + for(std::size_t e=lane.first;e Date: Fri, 13 Nov 2026 07:45:13 +0700 Subject: [PATCH 23/26] feat(native): atomic installed SEND ON/OFF target with correlated routing readback --- engine/core/DynamicNativeSessionPublisher.h | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index aedc0c5ac..88668e5f1 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -360,6 +360,29 @@ class DynamicNativeSessionPublisher final { return true; }); } + bool setSendEnabled(std::uint64_t epoch,std::uint64_t revision, + ChannelId source,std::uint64_t edgeId,bool enabled, + float rememberedGain) noexcept { + if(!source.value || !edgeId || !std::isfinite(rememberedGain) || + rememberedGain<0.f || rememberedGain>4.f)return false; + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& active) noexcept { + const auto it=std::find_if(active.routing.edges.begin(), + active.routing.edges.end(),[&](const auto& edge){ + return edge.from==source && edge.edgeId==edgeId && + !edge.primaryOutput; + }); + if(it==active.routing.edges.end())return false; + if(active.graph.channelScheduled(source) && + !active.graph.setSendEnabled(source,edgeId,enabled,rememberedGain)) + return false; + it->enabled=enabled; + for(auto& row:active.routing.channels)if(row.id==source) + for(auto& send:row.parallelSends) + if(send.edgeId==edgeId)send.enabled=enabled; + return true; + }); + } bool setWireGain(std::uint64_t epoch,std::uint64_t revision, ChannelId source,std::uint64_t edgeId,float gain) noexcept { const auto* routing=acceptedRouting(epoch,revision); From d6fb132c60985414531bd080b4cc48d33e20de43 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:45:26 +0700 Subject: [PATCH 24/26] feat(native): epoch-gated live SEND ON/OFF preserving accepted EdgeId and saved gain --- engine/core/DynamicAcceptedSession.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 6a5ce10dc..55682e73c 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -359,6 +359,20 @@ class DynamicAcceptedSession final { source,destination,preFader,linear); } + // Real-time per-EdgeId SEND ON/OFF uses the same prepared PCM graph, + // retains remembered gain, and never tears down/recreates its WIRE. + bool setLiveSendEnabled(std::uint64_t epoch,std::uint64_t graphRevision, + ChannelId source,std::uint64_t edgeId,bool enabled) noexcept { + const auto* row=accepted_.find(source); + if(!row || !edgeId)return false; + for(const auto& edge:row->sends) + if(edge.edgeId==edgeId && !edge.primaryOutput){ + if(!publisher_.setSendEnabled(epoch,graphRevision, + source,edgeId,enabled,edge.gain))return false; + return accepted_.rememberLiveSendEnabled(source,edgeId,enabled); + } + return false; + } bool setLiveWireGain(std::uint64_t epoch,std::uint64_t revision, ChannelId source,std::uint64_t edgeId,float gain) noexcept { const auto* row=accepted_.find(source); From 38cce36d0a043e2a89312aba8acdeecfd0070795 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 07:45:49 +0700 Subject: [PATCH 25/26] test(pcm): live SEND ON/OFF ramps 64 samples without graph rebuild --- tests/dynamic_accepted_session_test.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 9ca33bf6f..d8ec4ace7 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -90,6 +90,27 @@ static void verifyPerEdgeSendEnablePcm() { assert(onEdge!=row->sends.end() && onEdge->enabled && onEdge->gain==.5f && onEdge->preFader); assert(render() && near(l[63],withSend,1e-4f)); + // Toggle the same EdgeId LIVE without a graph revision or WIRE removal. + assert(!session.setLiveSendEnabled(epoch-1,4,voice,edgeId,false)); + assert(!session.setLiveSendEnabled(epoch,3,voice,edgeId,false)); + assert(session.setLiveSendEnabled(epoch,4,voice,edgeId,false)); + assert(session.acceptedGraphRevision()==4); + assert(!session.acceptedRoster().find(voice)->sends.back().enabled); + const auto* accepted=session.acceptedRouting(epoch,4); + assert(accepted); + const auto routingEdge=std::find_if(accepted->edges.begin(),accepted->edges.end(), + [&](const auto& e){return e.edgeId==edgeId;}); + assert(routingEdge!=accepted->edges.end() && !routingEdge->enabled); + assert(!session.setLiveParallelSend(epoch,4,voice,wet,true,1.f)); + assert(render()); + const float liveOff=l[63]; + assert(liveOff>withoutSend && liveOffsends.back().enabled); + assert(render() && l[63]>withoutSend && l[63] Date: Fri, 13 Nov 2026 07:46:07 +0700 Subject: [PATCH 26/26] test(pcm): verify intermediate SEND ramp at 4 samples and final 60-sample completion --- tests/dynamic_accepted_session_test.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index d8ec4ace7..48e60f78f 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -60,8 +60,8 @@ static void verifyPerEdgeSendEnablePcm() { std::array input{},l{},r{};input.fill(.5f); const float* pins[]{input.data()}; const auto fx=+[](ChannelId,float*,float*,int) noexcept {}; - const auto render=[&](){ - return session.render(epoch,pins,1,l.data(),r.data(),64,false,fx); + const auto render=[&](int frames=64){ + return session.render(epoch,pins,1,l.data(),r.data(),frames,false,fx); }; assert(render()); const float withSend=l[63]; @@ -102,14 +102,14 @@ static void verifyPerEdgeSendEnablePcm() { [&](const auto& e){return e.edgeId==edgeId;}); assert(routingEdge!=accepted->edges.end() && !routingEdge->enabled); assert(!session.setLiveParallelSend(epoch,4,voice,wet,true,1.f)); - assert(render()); - const float liveOff=l[63]; + assert(render(4)); + const float liveOff=l[3]; assert(liveOff>withoutSend && liveOffsends.back().enabled); - assert(render() && l[63]>withoutSend && l[63]withoutSend && l[3]