lang migration: rename signed integer types sN -> iN
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.
This commit is contained in:
14
audio.sx
14
audio.sx
@@ -15,12 +15,12 @@
|
||||
|
||||
// AudioToolbox — System Sound Services. SystemSoundID is a UInt32; OSStatus a
|
||||
// SInt32 (0 == noErr); the clip's file is passed as a CFURLRef (opaque ptr).
|
||||
AudioServicesCreateSystemSoundID :: (url: *void, out_id: *u32) -> s32 #foreign;
|
||||
AudioServicesCreateSystemSoundID :: (url: *void, out_id: *u32) -> i32 #foreign;
|
||||
AudioServicesPlaySystemSound :: (sound_id: u32) #foreign;
|
||||
|
||||
// CoreFoundation — build a file CFURL from an absolute path. `len` is a CFIndex
|
||||
// (long); `is_dir` a Boolean (unsigned char); a NULL allocator = default.
|
||||
CFURLCreateFromFileSystemRepresentation :: (allocator: *void, buffer: *u8, len: s64, is_dir: s8) -> *void #foreign;
|
||||
CFURLCreateFromFileSystemRepresentation :: (allocator: *void, buffer: *u8, len: i64, is_dir: i8) -> *void #foreign;
|
||||
CFRelease :: (cf: *void) #foreign;
|
||||
|
||||
// libc — getcwd to absolutize the bundle-relative asset path. The platform
|
||||
@@ -80,7 +80,7 @@ GameAudio :: struct {
|
||||
|
||||
// Pick the ascending cascade clip by clamping the cascade depth into the
|
||||
// combo1..combo5 range (see `cascade_cue_index`).
|
||||
play_cascade :: (self: *GameAudio, depth: s64) {
|
||||
play_cascade :: (self: *GameAudio, depth: i64) {
|
||||
inline if OS != .ios { return; }
|
||||
if !self.loaded { return; }
|
||||
idx := cascade_cue_index(depth);
|
||||
@@ -107,7 +107,7 @@ GameAudio :: struct {
|
||||
// `log show` shows the clip stepping up with cascade depth. Literals only — the
|
||||
// string→NSString bridge needs NUL-terminated bytes (a formatted string may not
|
||||
// be). `idx` is a clamped `cascade_cue_index`, so it is always 0..COMBO_CLIPS-1.
|
||||
cascade_cue_name :: (idx: s64) -> string {
|
||||
cascade_cue_name :: (idx: i64) -> string {
|
||||
if idx <= 0 { return "[sx] audio: cue combo1"; }
|
||||
if idx == 1 { return "[sx] audio: cue combo2"; }
|
||||
if idx == 2 { return "[sx] audio: cue combo3"; }
|
||||
@@ -118,7 +118,7 @@ cascade_cue_name :: (idx: s64) -> string {
|
||||
// Cascade depth (number of cleared rounds) → combo clip index 0..COMBO_CLIPS-1
|
||||
// (combo1..combo5). Clamps: depth <= 1 → 0, depth >= 5 → 4. Pure arithmetic and
|
||||
// OS-agnostic so it can be snapshot-tested headlessly (P10.4).
|
||||
cascade_cue_index :: (depth: s64) -> s64 {
|
||||
cascade_cue_index :: (depth: i64) -> i64 {
|
||||
if depth <= 1 { return 0; }
|
||||
if depth >= COMBO_CLIPS { return COMBO_CLIPS - 1; }
|
||||
depth - 1
|
||||
@@ -145,7 +145,7 @@ load_system_sound :: (name: string) -> u32 {
|
||||
if getcwd(@cwd_buf[0], 1024) == null { return 0; }
|
||||
cwd : string = ---;
|
||||
cwd.ptr = @cwd_buf[0];
|
||||
cwd.len = cast(s64) c_strlen(@cwd_buf[0]);
|
||||
cwd.len = cast(i64) c_strlen(@cwd_buf[0]);
|
||||
|
||||
// CFURLCreateFromFileSystemRepresentation takes an explicit byte length, so
|
||||
// the formatted path needs no NUL terminator.
|
||||
@@ -169,6 +169,6 @@ g_audio : *GameAudio = null;
|
||||
|
||||
sfx_swap :: () { if g_audio != null { g_audio.play_swap(); } }
|
||||
sfx_match :: () { if g_audio != null { g_audio.play_match(); } }
|
||||
sfx_cascade :: (depth: s64) { if g_audio != null { g_audio.play_cascade(depth); } }
|
||||
sfx_cascade :: (depth: i64) { if g_audio != null { g_audio.play_cascade(depth); } }
|
||||
sfx_win :: () { if g_audio != null { g_audio.play_win(); } }
|
||||
sfx_lose :: () { if g_audio != null { g_audio.play_lose(); } }
|
||||
|
||||
Reference in New Issue
Block a user