Mechanical sweep of all .sx sources, plan docs, and tests/expected
snapshots for the sx language rename (s8/s16/s32/s64 -> i8/i16/i32/i64).
Verified: tools/run_tests.sh 23/23.
Note: the ios-sim build has 2 pre-existing 'restart' dot-call errors
from the sx opt-in UFCS change (sx a47ea14) — independent of this
rename (present pre-sweep); migrated in the follow-up commit.
Drive event-appropriate cues from the existing System Sound Services bank,
purely additively — no board/score/move state is read or written and every
call stays inline-if-OS==.ios guarded.
board_view.sx (move-commit path): a committed gesture now plays the swap
slide cue for any swipe intent (legal or the reverted ping-back); a legal
move adds the match pop on its first clearing round; a multi-round chain
adds the escalating cascade cue keyed to the recorded AnimMove depth
(mv.rounds.len), kept distinct from the match pop so a single clear is never
doubled. An illegal swap plays only the swap cue.
main.sx (frame loop): the win/lose stinger fires EXACTLY ONCE, edge-triggered
on the frame the banner comes up — the level has settled won/lost and any
in-flight cascade has finished animating. Status is read-only from the model;
a restart re-arms the edge for a fresh win/lose.
audio.sx: each play_* method logs a per-cue NSLog line at play time so the
ordering is observable via `log show`; cascade_cue_name maps the clamped
combo index to a stable literal (literals only — the string→NSString bridge
needs NUL-terminated bytes).
Refactor GameAudio from the single clear cue into a full bank: load swap,
match, combo1..combo5, win, lose once at startup, each into its own
SystemSoundID via load_system_sound. Expose per-event play methods
(play_swap/play_match/play_cascade/play_win/play_lose), each a single
AudioServicesPlaySystemSound. play_cascade selects the ascending clip by
clamping cascade depth through the pure, OS-agnostic cascade_cue_index
(depth<=1 -> combo1, depth>=5 -> combo5) so P10.4 can snapshot it headlessly.
Layer stays purely additive and inline-if-OS==.ios guarded; the clear trigger
is migrated to sfx_cascade(mv.rounds.len) at its board_view call site, with
sfx_swap/match/win/lose shims staged for P10.3 wiring. No framework added
beyond the already-linked AudioToolbox/CoreFoundation (build.sx untouched).
Feasibility spike outcome: iOS audio from sx is feasible with no sx-library
change. System Sound Services is plain C, reached with the same `#foreign`
FFI uikit.sx already uses (UIApplicationMain / dlsym / CACurrentMediaTime);
AudioToolbox + CoreFoundation are linked per-target in build.sx.
Smallest viable SFX: one short CC0 clip (Kenney Interface Sounds, CC0 1.0)
played when a swap clears a match. Purely additive — audio.sx reads/writes
no score/board/move state; the wiring in board_view only adds a call.
- audio.sx: load clear.wav once, AudioServicesPlaySystemSound on clear
- board_view.sx: trigger sfx_clear() on a legal swap that clears (>=1 round)
- main.sx: allocate + init g_audio at boot
- build.sx: link AudioToolbox + CoreFoundation on iOS
- assets/audio/clear.wav (+ one-line CC0 credit in LICENSE.txt)
Verified: ios-sim build links; 18/18 tests pass; sim boot log shows
"[sx] audio: clear cue loaded" (AudioServicesCreateSystemSoundID succeeded,
asset shipped in the bundle and decoded).