Expand description
SharedClock - the single playback time source (decision 2).
Both the Player (worker thread) and the UI (main thread) read the SAME
clock, so highlight and audio physically can’t drift. The Player writes
position; the UI’s ~15 Hz timer reads SharedClock::position_s and
highlights the WordMark whose time_s <= position.
Cross-thread via a relaxed AtomicU64 (nanoseconds) - cheap and
single-producer (Player) / single-consumer (UI timer).
Structs§
- Shared
Clock - Shared playback position in nanoseconds (0 = start of playback).
Functions§
- highlight_
index - Pick the index of the last
WordMarkwhosetime_sis <=position_s(the currently-highlighted word). Returns None before the first word.