From 47588990ce261ce1c11b62d1bf6db09e9e14fbc6 Mon Sep 17 00:00:00 2001 From: Reactorcoremeltdown Date: Sun, 15 Nov 2026 22:35:18 +0100 Subject: [PATCH] iOS 0.2.1: don't touch the engine's input node (microphone privacy crash); log benchmark Co-Authored-By: Claude Opus 5.5 --- ios/CHANGELOG.md | 7 +++++++ ios/app/Host/SizzleHost.mm | 17 ++++++++++++++--- versions.properties | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ios/CHANGELOG.md b/ios/CHANGELOG.md index 6dd7f01..c874f03 100644 --- a/ios/CHANGELOG.md +++ b/ios/CHANGELOG.md @@ -3,6 +3,13 @@ Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in `../versions.properties` (`ios.versionName` / `ios.versionCode`). +## 0.2.1 (build 5) + +- Fix: switching instruments (e.g. to the Wavetable) killed the app. Rewiring the + audio graph read the engine's microphone input, which iOS treats as a privacy + access the app hadn't declared. The app no longer touches the input. +- Benchmark results also go to the system log ("SizzleBench"), readable over USB. + ## 0.2.0 (build 4) - All six instruments, now in C++ and matching the Android app sample for sample: diff --git a/ios/app/Host/SizzleHost.mm b/ios/app/Host/SizzleHost.mm index 83fb2fe..e4ad65a 100644 --- a/ios/app/Host/SizzleHost.mm +++ b/ios/app/Host/SizzleHost.mm @@ -67,6 +67,7 @@ static NSError *hostError(NSString *msg) { AVAudioEngine *_engine; AVAudioUnit *_instNode; AVAudioUnit *_fxNode; + NSMutableArray *_attached; // what rebuild attached, to detach next time MIDIClientRef _midiClient; MIDIPortRef _midiPort; NSArray *_midiSources; @@ -87,6 +88,7 @@ static NSError *hostError(NSString *msg) { if (!self) return nil; registerDevices(); _engine = [AVAudioEngine new]; + _attached = [NSMutableArray array]; _midiSources = @[]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil]; @@ -109,15 +111,20 @@ static NSError *hostError(NSString *msg) { }]; } +/// Detach what the last rebuild attached, then wire instrument → effect → mixer. +/// Never touch the engine's inputNode: merely reading it opens the microphone, +/// which iOS treats as a privacy access (0.2.0 was killed for exactly that). - (void)rebuild { [_engine stop]; - for (AVAudioNode *n in [_engine.attachedNodes copy]) - if (n != _engine.mainMixerNode && n != _engine.outputNode && n != _engine.inputNode) [_engine detachNode:n]; + for (AVAudioNode *n in _attached) [_engine detachNode:n]; + [_attached removeAllObjects]; if (!_instNode) return; [_engine attachNode:_instNode]; + [_attached addObject:_instNode]; AVAudioNode *last = _instNode; if (_fxNode) { [_engine attachNode:_fxNode]; + [_attached addObject:_fxNode]; [_engine connect:_instNode to:_fxNode format:nil]; last = _fxNode; } @@ -295,7 +302,11 @@ static double timeRender(SizzleDeviceAU *au, BOOL instrument, double seconds) { } - (void)benchmark:(void (^)(NSString *))line done:(void (^)(void))done { - void (^say)(NSString *) = ^(NSString *s) { dispatch_async(dispatch_get_main_queue(), ^{ line(s); }); }; + // Also to the system log ("SizzleBench …"), so results can be read over USB. + void (^say)(NSString *) = ^(NSString *s) { + NSLog(@"SizzleBench %@", s); + dispatch_async(dispatch_get_main_queue(), ^{ line(s); }); + }; dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ say([NSString stringWithFormat:@"%@ · %lu cores · 10 s of 44.1 kHz audio per device", machine(), (unsigned long)NSProcessInfo.processInfo.activeProcessorCount]); diff --git a/versions.properties b/versions.properties index ca029e5..b1764ed 100644 --- a/versions.properties +++ b/versions.properties @@ -17,8 +17,8 @@ android.versionCode = 70 # iOS/iPadOS (cc.tiredsysadmin.ios.sizzle): the AUv3 plugin app in ios/app; the # Makefile there passes these to Xcode and names the .ipa by versionCode. (The # TrollStore spike in ios/spike keeps its own version in its project.yml.) -ios.versionName = 0.2.0 -ios.versionCode = 4 +ios.versionName = 0.2.1 +ios.versionCode = 5 macos.versionName = - linux.versionName = - bsd.versionName = -