Fix five Wave-1 pure-layer FX/park review findings: resume-point stall, stale doc comments, implicit mode read, keying reset
This commit is contained in:
+20
-11
@@ -7,15 +7,22 @@ namespace reasampler::view {
|
||||
|
||||
namespace {
|
||||
|
||||
// Everything up to and including the first op naming `resumeAfter` is already
|
||||
// done. Not found ⇒ nothing dropped: the identity left the chain between ticks,
|
||||
// and re-walking a compare-before-write list beats trusting a cursor that no
|
||||
// longer points at anything.
|
||||
// Everything up to and including the resume point is already done. An empty
|
||||
// `resumeAfterFxGuid` is ambiguous by itself — "nothing done yet" and "the last
|
||||
// completed op had no identity" look identical — so an empty guid falls back to
|
||||
// matching by slot instead; `resumeAfterSlot < 0` is what actually means
|
||||
// "nothing done yet". Not found ⇒ nothing dropped: the resume point left the
|
||||
// chain between ticks, and re-walking a compare-before-write list beats
|
||||
// trusting a cursor that no longer points at anything.
|
||||
std::vector<FxOfflineOp> remainingAfter(const std::vector<FxOfflineOp>& ops,
|
||||
const std::string& resumeAfter) {
|
||||
if (resumeAfter.empty()) return ops;
|
||||
const std::string& resumeAfterFxGuid,
|
||||
int resumeAfterSlot) {
|
||||
if (resumeAfterFxGuid.empty() && resumeAfterSlot < 0) return ops;
|
||||
for (std::size_t i = 0; i < ops.size(); ++i) {
|
||||
if (ops[i].fxGuid == resumeAfter)
|
||||
const bool isResumePoint = resumeAfterFxGuid.empty()
|
||||
? ops[i].slot == resumeAfterSlot
|
||||
: ops[i].fxGuid == resumeAfterFxGuid;
|
||||
if (isResumePoint)
|
||||
return std::vector<FxOfflineOp>(ops.begin() + static_cast<std::ptrdiff_t>(i) + 1,
|
||||
ops.end());
|
||||
}
|
||||
@@ -54,15 +61,15 @@ std::vector<FxOfflineOp> fxRestoreTargets(const ViewModeModel& model,
|
||||
}
|
||||
|
||||
std::vector<FxTrackWork> desiredFxState(const ViewModeModel& model,
|
||||
const std::string& targetMode,
|
||||
const std::set<std::string>& liveTrackGuids) {
|
||||
std::vector<FxTrackWork> online;
|
||||
std::vector<FxTrackWork> offline;
|
||||
|
||||
const std::string& activeMode = model.activeModeId();
|
||||
for (const auto& [guid, snap] : model.snapshots()) { // std::map ⇒ GUID order
|
||||
if (liveTrackGuids.count(guid) == 0) continue; // dead track — nothing to write
|
||||
|
||||
if (!model.leafBelongsToMode(guid, activeMode)) {
|
||||
if (!model.leafBelongsToMode(guid, targetMode)) {
|
||||
offline.push_back(FxTrackWork{guid, FxWorkKind::Offline, {}, {}});
|
||||
continue;
|
||||
}
|
||||
@@ -82,10 +89,12 @@ FxRestoreResolution resolveFxWork(const FxTrackWork& work,
|
||||
const std::vector<std::string>& liveFxGuids) {
|
||||
if (work.kind == FxWorkKind::Offline) {
|
||||
return resolveFxRestore(
|
||||
remainingAfter(offlineTargets(work.trackGuid, liveFxGuids), work.resumeAfterFxGuid),
|
||||
remainingAfter(offlineTargets(work.trackGuid, liveFxGuids), work.resumeAfterFxGuid,
|
||||
work.resumeAfterSlot),
|
||||
liveFxGuids);
|
||||
}
|
||||
return resolveFxRestore(remainingAfter(work.targets, work.resumeAfterFxGuid), liveFxGuids);
|
||||
return resolveFxRestore(
|
||||
remainingAfter(work.targets, work.resumeAfterFxGuid, work.resumeAfterSlot), liveFxGuids);
|
||||
}
|
||||
|
||||
} // namespace reasampler::view
|
||||
|
||||
Reference in New Issue
Block a user