# Sizzle for iOS/iPadOS — staging tree This tree is separate from the Android app (its own Makefile, nothing shared yet). The plan is to ship every Sizzle instrument and effect as AUv3 plugins inside one app (iOS/iPadOS 15+), installed with TrollStore. Before porting anything, the **spike** in `spike/` answers the one question that could sink the plan: do hosts (AUM, GarageBand, Loopy…) list AUv3 plugins from a TrollStore-installed app, and do App Groups work there? ## The spike | Piece | What it is | |---|---| | `spike/project.yml` | XcodeGen spec; `make project` generates the Xcode project (git-ignored) | | `spike/App/` | SwiftUI host app `cc.tiredsysadmin.ios.sizzlespike` with a self-test (Run self-test button) | | `spike/AU/` | App extension `…sizzlespike.au`: one AUv3 instrument (`aumu` / `sSpk` / `Tsys`), "Tired Sysadmin: Sizzle Spike Sine", a sine voice with a Gain parameter | | `spike/Shared/Spike.swift` | The App Group id, the component description, and the App Group probe both sides run | The self-test shows three checks: 1. **[1] Registered components:** what `AVAudioUnitComponentManager` lists for `Tsys/sSpk`. That is the same registry hosts read, so a FAIL here means no host will see the plugin. 2. **[2] Instantiated out of process / Rendered 1 s offline:** iOS launches the extension and its render block produces sound (silent, offline render; peak > 0.05). "Play tone (1 s)" does the same through the speaker. 3. **[3] App Group:** the app writes `app.txt`, the extension writes `au.txt` when it is created (and `au-view.txt` when a host opens its view), and each side lists what's there. After [2], seeing `au.txt` in the app's list proves both sides share files, which is how the real port will hand samples and SF2 files to the plugins. ### Build ```sh make -C ios ipa # → ios/dist/cc.tiredsysadmin.ios.sizzlespike_.ipa ``` Needs Xcode and XcodeGen. The device build is unsigned, then ad-hoc signed inside-out (extension first) with each target's entitlements, and zipped as `Payload/`. TrollStore re-signs at install time and keeps the entitlements it finds; ldid isn't needed. Checked on the Mac: arm64, minimum OS 15.0 for the app and the extension, App Group entitlement on both, extension entry point `NSExtensionMain`, extension point `com.apple.AudioUnit-UI`. `make sim` / `make sim-run` build and run it in the Simulator, but no Simulator runtime was installed when the spike was written, so it hasn't been run there. ### Test on the iPad 1. AirDrop or copy the newest `cc.tiredsysadmin.ios.sizzlespike_.ipa` to the iPad, open it with TrollStore, install. 2. Open **Sizzle Spike**, tap **Run self-test**, and note [1]–[3] (screenshot). 3. In AUM (or GarageBand → Audio Units, Loopy, Drambo…), add an instrument and look for **Tired Sysadmin: Sizzle Spike Sine**. Load it, play notes, open its view (it lists the App Group files). 4. Back in Sizzle Spike, **Run self-test** again: `au-view.txt` should now be listed. What the outcomes mean: - [1] PASS and the host lists it: the plan works as designed. - [1] PASS but no host lists it: hosts filter TrollStore apps somehow; investigate before porting. - [1] FAIL: iOS didn't register the extension (pluginkit); try re-launching the app, then a respring, then reinstall. - [3] NOT AVAILABLE: App Groups don't survive TrollStore signing. The fallback is passing sample data through the plugin's saved state, or having the plugin pick files with a document picker. ### Results so far - **Build 1 (0.1.0):** AUM lists the plugin, loads it, and it plays from a MIDI keyboard, so hosts do see AUv3 plugins from a TrollStore install. AUM showed a red X as its icon (the app had no icon), and the app itself closed right after opening (it ran the self-test at launch). - **Build 2 (0.1.1):** adds an app icon, the SwiftUI scene manifest, and makes the self-test crash-proof for diagnosis. It runs only on the button. Each step is saved before it runs, so the next launch says where a crash happened ("The previous run stopped during: …"). AVAudioEngine's Objective-C exceptions are caught by `App/ObjC/SPKTry.m` and printed instead of killing the app. If the app still closes before showing anything, the crash is at launch. Its log is in Settings → Privacy & Security → Analytics & Improvements → Analytics Data, in a file named `SizzleSpike-.ips`. ## Decisions - **XcodeGen, not a checked-in .xcodeproj:** the project is text you can diff and review; the generated project is git-ignored. - **Swift render block in the spike:** good enough for one sine voice (no allocation or locks in the render block). The real port puts the DSP in a C++ core (see the conversation that planned it: Kotlin DSP → C++ verified against reference audio rendered by the Kotlin code). - **One extension, factory dispatch:** the real port will list many `AudioComponents` in one or a few extensions and pick the unit in `createAudioUnit(with:)` by subtype, instead of one extension per device. - **Versions:** the spike's version lives in `spike/project.yml` (`MARKETING_VERSION` 0.1.0, `CURRENT_PROJECT_VERSION` 1, which names the .ipa).