iOS 0.2.1: don't touch the engine's input node (microphone privacy crash); log benchmark
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7f231c8f79
commit
47588990ce
@@ -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:
|
||||
|
||||
@@ -67,6 +67,7 @@ static NSError *hostError(NSString *msg) {
|
||||
AVAudioEngine *_engine;
|
||||
AVAudioUnit *_instNode;
|
||||
AVAudioUnit *_fxNode;
|
||||
NSMutableArray<AVAudioNode *> *_attached; // what rebuild attached, to detach next time
|
||||
MIDIClientRef _midiClient;
|
||||
MIDIPortRef _midiPort;
|
||||
NSArray<NSString *> *_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]);
|
||||
|
||||
Reference in New Issue
Block a user