Files
m3te/build.sx
swipelab f0a13293bb P8.1: minimal match/clear SFX via iOS System Sound Services (sx FFI)
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).
2026-06-05 18:19:33 +03:00

40 lines
1.7 KiB
Plaintext

#import "modules/compiler.sx";
#import "modules/platform/bundle.sx";
configure_build :: () {
opts := build_options();
opts.set_bundle_id("co.swipelab.m3te");
opts.set_post_link_callback(bundle_main);
if OS == {
case .macos: {
opts.set_output_path("sx-out/macos/M3te");
opts.set_bundle_path("sx-out/macos/M3te.app");
// Ad-hoc sign (empty identity) so a local `open` launch isn't
// Gatekeeper-rejected. SDL3 comes from Homebrew.
opts.add_link_flag("-L/opt/homebrew/lib");
opts.add_link_flag("-lSDL3");
opts.add_asset_dir("assets", "assets");
}
case .ios: {
opts.set_output_path("sx-out/ios/M3te");
opts.set_bundle_path("sx-out/ios/M3te.app");
// Device-only: the simulator is ad-hoc signed by the bundler,
// which also grants get-task-allow for lldb. Embedding a device
// identity / profile in a sim build blocks install + launch.
if opts.is_ios_device() {
opts.set_codesign_identity("Apple Development: Alexandru Agrapine (DC8VVHJ9W4)");
opts.set_provisioning_profile("/Users/agra/Downloads/SwipeS32DevProfile.mobileprovision");
}
opts.add_framework("UIKit");
opts.add_framework("OpenGLES");
opts.add_framework("QuartzCore");
opts.add_framework("Metal");
// System Sound Services SFX (audio.sx) — a short clip played when a
// swap clears a match. CoreFoundation supplies the file URL.
opts.add_framework("AudioToolbox");
opts.add_framework("CoreFoundation");
opts.add_asset_dir("assets", "assets");
}
}
}