Stage 2 of #338. A game that syncs to its music has to know where the
music is heard. This stage reads that on the audio clock and hands it
to behaviors as events and as a position.
- New event nodes On beat (playback, bar, beat, late), On bar
(playback, bar, late) and On song marker (playback, marker, name,
late).
- New data node Song position with bar, beat, fraction, seconds and
playing.
- The nodes have the fields Song and Pattern. With neither picked,
every playback counts. A linked playback input picks that one.
Compositions do not count.
- The Marker field offers the markers of all songs as Song / Marker,
as a sound field offers its clips.
- Everything follows what is heard: the audio clock minus the output
latency. That holds for baked songs and for Play pattern too.
- Only the last beat since the frame before fires, and only when it is
at most half a beat late, 0.15 s at most. Bars and markers alike.
- A copied song gets markers with ids of its own, so a Marker field
never names two songs.
- The audio clock is only asked while something plays. Asked in every
frame, it made the AudioContext without a user gesture (#436).
Tests:
- beats 14 and music-events 6 new, 4 in song-play, 2 in song-markers,
2 catalog cases, the touched groups 756/756
- 16 counter-probes, all compile, all red
- e2e 65 on atx: ALL PASSED, 71 checks, 65k2 new: 11 beats 1.1 to 2.4
and 2.1 again, none missing or twice, across the pause too. late
0.015 to 0.027 s. Counter-probe without the last position: red
- gate on atx: CHECK EXIT 0, 334 files, 5121 tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>