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
+34
View File
@@ -0,0 +1,34 @@
#pragma once
// The transient DAW track selection a selected-tracks render requires. REAPER's
// &128 source prints whatever tracks are selected, not the tracks the request
// names, so the render owns the selection for its duration and hands it back.
// The .cpp includes reaper_plugin_functions.h WITHOUT REAPERAPI_IMPLEMENT.
#include <vector>
#include "shell/capture/capture.h" // MediaTrack fwd
namespace reasampler::capture {
// RAII: selects exactly `tracks`, restores the project's original track selection
// on every exit path (non-destructive — selection flags only, no restructuring).
// Two callers need this and neither has the right selection standing: a ranged
// item capture renders through the items' tracks while the user's track selection
// is unrelated, and re-capture-from-source resolves its tracks by GUID and selects
// nothing at all. An empty `tracks` is a deliberate no-op — forcing an empty
// selection would render silence.
class RenderTrackSelection
{
public:
explicit RenderTrackSelection(const std::vector<MediaTrack*>& tracks);
~RenderTrackSelection();
RenderTrackSelection(const RenderTrackSelection&) = delete;
RenderTrackSelection& operator=(const RenderTrackSelection&) = delete;
private:
std::vector<MediaTrack*> original_;
bool applied_ = false;
};
} // namespace reasampler::capture