Auto commit (MindMachine) Sat Apr 11 12:01:03 PM CDT 2026

This commit is contained in:
Tretzi
2026-04-11 12:01:03 -05:00
parent ee3d6342b8
commit ddc497a91f

View File

@@ -812,14 +812,25 @@ private fun rememberSplitFlashFrame(
return@produceState
}
// Lock the sequencer's time base to Compose's frame clock.
// Mixing System.nanoTime() (start) with withFrameNanos() (updates) can introduce
// an arbitrary offset that looks like irregular intervals.
val sequencer = SplitFlashSequencer(
startTimeNanos = System.nanoTime(),
startTimeNanos = 0L,
flashOnMs = latestFlashOnMs.value,
flashOffMs = latestFlashOffMs.value,
)
var started = false
while (true) {
withFrameNanos { frameTimeNanos ->
if (!started) {
// Initialize phaseStartNanos to the first real frame timestamp.
// This keeps phase transitions aligned to the same monotonic clock.
sequencer.frameAt(frameTimeNanos)
started = true
}
sequencer.updateIntervals(latestFlashOnMs.value, latestFlashOffMs.value)
value = sequencer.frameAt(frameTimeNanos)
}