objective-c - 在主机应用程序 (iOS) 中检测 AUv3 失效
问题描述
我正在开发一个 AUv3 主机应用程序,我希望在加载的音频单元由于某种原因崩溃(失效)时通知用户。我查看了 Apple 关于 AUAudioUnit 的文档,但找不到任何有关如何从主机应用程序检测音频单元 (AUv3) 失效的信息。
有谁知道如何做到这一点?
谢谢
解决方案
在设置 AudioEngine 时,您可以观察kAudioComponentInstanceInvalidationNotification
以确定其音频组件实例是否稍后失效。
[[NSNotificationCenter defaultCenter] addObserverForName:kAudioComponentInstanceInvalidationNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
AUAudioUnit *auUnit = (AUAudioUnit *)note.object;
NSValue *val = note.userInfo[@"audioUnit"];
AudioUnit auAddress = (AudioUnit)val.pointerValue;
NSLog(@"AudioComponent Invalidation of Unit:%@ with Address:%p", auUnit, auAddress);
}];
请记住,您可能已经收到通知,但组件最终陷入了死锁。因此,当您试图从中恢复时,您可能不得不关闭整个主机应用程序。
推荐阅读
- python - 在浏览器中收听文本
- python - Flask REST: TypeError: get() got an unexpected keyword argument
- r - R中的复杂排序算法
- node.js - node js搜索系统正则表达式
- javascript - 从服务器中的公共 API 获取数据并发送到客户端
- swift - How to know when PDF document is downloaded in PDFKit?
- batch-file - 遍历子文件夹并从 zip 文件夹中删除某些文件名
- docker - Docker cli 使用较旧的日志记录?
- r - 如何通过组合来自两个不同表的信息来制作 if-else-sentences
- vuejs2 - 引导 Vue 模态