Cut shell/capture comment bloat ~33% (comments only, zero code change)
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
#pragma once
|
||||
// realtime_lifecycle — the in-flight realtime-capture state machine + globals
|
||||
// (Q-W3 hoist out of main.cpp). A realtime record spans many timer ticks (it takes
|
||||
// end-start wall-clock seconds and must NOT block REAPER's UI): the action STARTS
|
||||
// it (capture_orchestrator::RunCaptureRealtimeTrack -> g_rtBackend.begin), OnTimer
|
||||
// drives it here (DriveRealtimeCapture -> g_rtBackend.tick) each tick until a
|
||||
// The in-flight realtime-capture state machine + globals. A realtime record spans
|
||||
// many timer ticks (it takes end-start wall-clock seconds and must not block
|
||||
// REAPER's UI): the action starts it (RunCaptureRealtimeTrack -> g_rtBackend.begin),
|
||||
// OnTimer drives it here (DriveRealtimeCapture -> g_rtBackend.tick) each tick until a
|
||||
// terminal verdict, then the handle is cleared.
|
||||
//
|
||||
// The three globals are EXPOSED (extern) rather than wrapped: the action bodies in
|
||||
// capture_orchestrator manipulate them exactly as main.cpp did (zero-behavior-change
|
||||
// move), and — load-bearing (CONTEXT.md §Phase Q hot-path guardrail) — the timer's
|
||||
// IDLE FAST-PATH stays a SINGLE POINTER TEST at the call site:
|
||||
// The three globals are extern rather than wrapped so the timer's idle fast path
|
||||
// stays a single pointer test at the call site — load-bearing:
|
||||
// if (capture::g_rtCapture) capture::DriveRealtimeCapture(g_session);
|
||||
// No per-tick cross-TU call, no accessor indirection, when nothing is recording.
|
||||
//
|
||||
// REAPER-facing: the .cpp includes reaper_plugin_functions.h WITHOUT
|
||||
// REAPERAPI_IMPLEMENT (main.cpp owns the API pointers — CLAUDE.md §contract).
|
||||
// The .cpp includes reaper_plugin_functions.h WITHOUT REAPERAPI_IMPLEMENT
|
||||
// (main.cpp owns the API pointers).
|
||||
|
||||
#include "shell/capture/capture_realtime_shell.h" // RealtimeRecordBackend / RealtimeCaptureHandle
|
||||
|
||||
@@ -24,33 +21,30 @@ class ReaSamplerSession;
|
||||
|
||||
namespace reasampler::capture {
|
||||
|
||||
// The realtime backend + the in-flight capture handle. Non-null handle == a
|
||||
// capture is in progress (used to reject a second one, to drive the per-tick
|
||||
// advance, and to abort on project switch / unload).
|
||||
// Non-null g_rtCapture == a capture is in progress: used to reject a second one,
|
||||
// drive the per-tick advance, and abort on project switch / unload.
|
||||
extern RealtimeRecordBackend g_rtBackend;
|
||||
extern RealtimeCaptureHandle g_rtCapture;
|
||||
|
||||
// The ReaProject* the in-flight capture belongs to (opaque, compare-only) — lets
|
||||
// The project the in-flight capture belongs to (opaque, compare-only) — lets
|
||||
// OnTimer detect a project switch mid-capture and abort+restore rather than leak the
|
||||
// temp track/arm/transport into or across projects. Only meaningful when
|
||||
// g_rtCapture != nullptr.
|
||||
// temp track/arm/transport across projects. Meaningful only when g_rtCapture != nullptr.
|
||||
extern ReaProject* g_rtCaptureProject;
|
||||
|
||||
// Commit a finished realtime capture (a Done tick/abort with an Ok result): add the
|
||||
// Sample to the ACTIVE bank, record the owned file, bump the generation, persist +
|
||||
// MarkProjectDirty. On a non-Ok result, logs the failure only.
|
||||
// Commits a finished realtime capture (a Done tick/abort with an Ok result): adds
|
||||
// the Sample to the active bank, records the owned file, bumps the generation,
|
||||
// persists + MarkProjectDirty. On a non-Ok result, logs the failure only.
|
||||
void CommitRealtimeResult(ReaSamplerSession& session, const CaptureResult& res);
|
||||
|
||||
// Advance any in-flight realtime capture one tick. Cheap when none is running (a
|
||||
// null check — though the caller already guards, see the header note) and fast even
|
||||
// mid-record. Detects a project switch mid-capture and aborts+restores so the
|
||||
// capture never leaks across projects. Called from OnTimer BEFORE session.poll().
|
||||
// Advances any in-flight realtime capture one tick. Detects a project switch
|
||||
// mid-capture and aborts+restores so the capture never leaks across projects.
|
||||
// Called from OnTimer before session.poll().
|
||||
void DriveRealtimeCapture(ReaSamplerSession& session);
|
||||
|
||||
// Unload teardown: abort any in-flight capture while the API pointers are still
|
||||
// live — finalize-or-abort + restore so we never leave a temp track, an armed
|
||||
// track, or an altered transport/cursor in the user's project on unload. Commits
|
||||
// whatever was captured (best effort) before tearing down. No-op when idle.
|
||||
// track, or an altered transport/cursor behind. Commits whatever was captured
|
||||
// (best effort) before tearing down. No-op when idle.
|
||||
void AbortRealtimeCaptureForUnload(ReaSamplerSession& session);
|
||||
|
||||
} // namespace reasampler::capture
|
||||
|
||||
Reference in New Issue
Block a user