我一直在用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) –