summaryrefslogtreecommitdiff
path: root/src/host/timeline.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/timeline.zig')
-rw-r--r--src/host/timeline.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/host/timeline.zig b/src/host/timeline.zig
index 697a9df..c2eeff3 100644
--- a/src/host/timeline.zig
+++ b/src/host/timeline.zig
@@ -61,10 +61,29 @@ pub const Timeline = struct {
/// Set whenever live state is restored from a keyframe, for the host
/// to reset the input state that went with the old bytes.
restored: bool = false,
+ /// Frames fed since the keyframe was restored.
+ fed: u64 = 0,
+ /// A past session played (`play session`), not a clip: its index, and
+ /// its keyframes after the one played from, checked against the replay
+ /// as their frames are reached (Host.resync).
+ session: ?u64 = null,
+ checks: std.ArrayList(Check) = .empty,
+ next_check: usize = 0,
+
+ pub const Check = struct {
+ frame: u64,
+ key: u64,
+ /// Taken of what `update` made (periodic, a mark, before a reload,
+ /// at exit): a replay must match it. Other keyframes follow a jump
+ /// the log does not hold, and are restored without a word.
+ observed: bool,
+ };
pub fn deinit(self: *Timeline) void {
if (self.key) |k| k.free(self.gpa);
+ self.key = null;
self.events.deinit(self.gpa);
+ self.checks.deinit(self.gpa);
}
/// Puts a keyframe, in whatever layout it was taken, into live state.
@@ -73,6 +92,8 @@ pub const Timeline = struct {
defer arena.deinit();
_ = try memory.restore(arena.allocator(), key.layout, key.state, self.state.layout, self.state.slot(0), self.defaults);
self.restored = true;
+ self.fed = 0;
+ self.next_check = 0;
}
/// Makes a clip, its start keyframe and its frames, the one played; both
@@ -81,6 +102,8 @@ pub const Timeline = struct {
self.deinit();
self.key = key;
self.events = events;
+ self.session = null;
+ self.checks = .empty;
var it = frames(events.items);
const first = it.next();
self.base = if (first) |f| f[f.len - 1].time else 0;