P10.2: SFX bank over System Sound Services (sx / iOS)
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).
This commit is contained in:
@@ -642,10 +642,11 @@ impl View for BoardView {
|
||||
mv := plan_and_commit(self.board, intent.a, intent.b);
|
||||
if self.anim != null { self.anim.begin(mv); }
|
||||
if self.fx != null { self.fx.begin(@mv); }
|
||||
// SFX (P8.1). Additive only — plays a short cue when a swap
|
||||
// actually clears a match; reads no score/board state and
|
||||
// writes none. A legal move has >=1 cascade round.
|
||||
if mv.legal and mv.rounds.len > 0 { sfx_clear(); }
|
||||
// SFX (P10.2). Additive only — plays the ascending cascade
|
||||
// cue (combo1..combo5, clamped by depth) when a swap actually
|
||||
// clears a match; reads no score/board state and writes none.
|
||||
// A legal move has >=1 cascade round.
|
||||
if mv.legal and mv.rounds.len > 0 { sfx_cascade(mv.rounds.len); }
|
||||
self.sel.clear();
|
||||
} else {
|
||||
if hit := self.layout.point_to_cell(start) {
|
||||
|
||||
Reference in New Issue
Block a user