Add the FX reclaimer: a debounced, time-boxed convergence loop that offlines parked chains and restores returning ones off the switch path

This commit is contained in:
2026-08-06 19:07:17 -04:00
parent a9d2397586
commit 5a35b71dc0
8 changed files with 840 additions and 22 deletions
+4
View File
@@ -39,6 +39,7 @@ add_library(reaper_reasampler MODULE
${LICE_SRC}
${REASAMPLER_SRC_DIR}/shell/capture/insert.cpp
${REASAMPLER_SRC_DIR}/shell/view/view.cpp
${REASAMPLER_SRC_DIR}/shell/view/fx_reclaim.cpp
${REASAMPLER_SRC_DIR}/shell/view/view_lanes.cpp
${REASAMPLER_SRC_DIR}/shell/view/view_park.cpp
${REASAMPLER_SRC_DIR}/shell/view/view_reconcile.cpp
@@ -72,6 +73,9 @@ target_include_directories(reaper_reasampler PRIVATE ${SDK_INC} ${WDL_INC})
# has none — its TUs are compiled into this target directly.
reasampler_test(view_park LINK view_mode_model)
reasampler_test(view_reconcile LINK applied_state view_mode_model)
# The reclaimer's drain loop is templated on its host for exactly this reason: the
# ordering, budget, debounce and resume bookkeeping run against a fake chain.
reasampler_test(fx_reclaim LINK fx_state)
# Bank-package import: the promptless verb plus its action skin. Kept as its own
# appended block rather than merged into the lists above, so the two package
+10
View File
@@ -38,6 +38,7 @@
#include "shell/panel/panel_input.h" // bankPanelRefresh / bankPanelNotifyProjectLoaded
#include "shell/panel/panel_window.h" // panel lifecycle (init/toggle/open-query/shutdown)
#include "shell/persist/session.h" // ReaSamplerSession
#include "shell/view/fx_reclaim.h" // the FX reclaimer's tick
#include "shell/view/view.h" // applyMode
#include "shell/view/view_lanes.h" // reconcileManagedLanes
#include "shell/view/view_reconcile.h" // reconcileAppliedFlags
@@ -215,6 +216,15 @@ static void OnTimer()
reasampler::applyMode(g_session.view(), g_session.view().activeModeId(), nullptr);
}
// Converge the FX chains toward what the view state says they should be — the
// 1897ms of TrackFX_SetOffline a mode switch no longer pays synchronously. Same
// idle discipline as the realtime fast path above: a SINGLE BOOL TEST when there is
// nothing to converge. Ordered AFTER the load block deliberately — a reload replaces
// the view model wholesale, and the applyMode above is what re-derives the queue
// from it, so draining first would spend a tick against the outgoing model.
if (reasampler::g_fxReclaimPending)
reasampler::fxReclaimTick(g_session.view(), nullptr);
reasampler::bankPanelRefresh(); // cheap fingerprint compare; no-op when unchanged/closed
}