我一直在用AVAudioEngine玩,并且无法整合AVAudioUnitEffect类。例如,AVAudioUnitDelay ...用AVAudioEngine麻烦挂钩AVAudioUnitEffect
@implementation ViewController {
AVAudioEngine *engine;
AVAudioPlayerNode *player;
}
...
- (IBAction)playButtonHit:(id)sender {
if (!player){
NSURL *bandsURL = [[NSBundle mainBundle] URLForResource:@"Bands With Managers" withExtension:@"mp3"];
AVAudioFile *file = [[AVAudioFile alloc] initForReading:bandsURL error:nil];
engine = [[AVAudioEngine alloc] init];
player = [[AVAudioPlayerNode alloc] init];
[engine attachNode:player];
AVAudioUnitDelay *delay = [[AVAudioUnitDelay alloc] init];
delay.wetDryMix = 50;
[engine connect:player to:delay format:file.processingFormat];
[engine connect:delay to:[engine outputNode] format:file.processingFormat];
[player scheduleFile:file atTime:nil completionHandler:nil];
[engine prepare];
[engine startAndReturnError:nil];
}
[player play];
}
当方法被调用应用程序崩溃,我得到这个错误:“*终止应用程序由于未捕获异常'com.apple.coreaudio.avfaudio',原因:'所需条件为false:[_nodes containsObject:node1] & & [_nodes containsObject:node2]'“
我在WWDC的“AVAudioEngine in Practice”会话中的一些例子之后对此进行了建模。我知道这可能是一些显而易见的事情,但我想不出来......
苹果修复了这个问题与iOS 8种子3(建设12A4318c) –