capture: render a ranged item capture time-bounded — the selected-items source can't narrow a window, only a full-extent one uses it

sourceModeForScope now takes the item extent vs. the requested window. Full-extent item captures and the batch keep the old path unchanged.
This commit is contained in:
2026-08-01 19:43:06 -04:00
parent 8bf6841f7b
commit 5e3ea6c851
16 changed files with 407 additions and 20 deletions
+10 -1
View File
@@ -16,6 +16,7 @@
#include "shell/persist/session.h" // ReaSamplerSession
#include "shell/capture/insert.h" // runInsert / InsertRequest
#include "shell/capture/realtime_lifecycle.h" // the in-flight realtime state
#include "shell/capture/render_selection.h" // RenderTrackSelection
#include "reaper_plugin.h" // UNDO_STATE_MISCCFG
@@ -181,6 +182,14 @@ CaptureResult renderOffline(CaptureScope scope,
const CaptureRequest& req)
{
ReaProject* proj = EnumProjects(-1, nullptr, 0);
// A selected-tracks render prints the DAW's track selection, so the request's
// own tracks must BE that selection for the render — the plain track scope
// already resolved them from the live selection (identity), but a ranged item
// capture and a re-capture-from-source both name tracks the user has not
// selected. Both guards outlive the render call and restore on every path.
std::optional<RenderTrackSelection> selection;
if (req.sourceMode == SourceMode::SelectedTracks)
selection.emplace(sourceTracks);
FxBypassGuard fxGuard(scope, sourceTracks, proj);
OfflineRenderBackend backend;
return backend.capture(req);
@@ -217,7 +226,7 @@ CaptureResult captureAndIndexOne(ReaSamplerSession& session,
const TailSetting tail = bankPanelTailSetting();
CaptureRequest req;
req.sourceMode = sourceModeForScope(scope);
req.sourceMode = sourceModeForScope(scope, src.itemExtentIsWindow);
req.startSeconds = startSeconds; // exact bounds — no rounding
req.endSeconds = endSeconds;
req.wetDry = 1.0; // wet post the FX left enabled by the scope