装载采样器仪器在El Capitan失败

时间:2016-09-12 15:28:31

标签: objective-c xcode macos avfoundation

我使用SpriteKit编写了一个Mac应用程序。我的采样器乐器$request = $client->request('POST', 'testpromoboiler/updateUser', [ 'query' => ['token' => $user->sdg_token , 'address' => $user->address , ] ]); 由于某种原因不再加载。这个问题才出现,因为我已经将我的系统从Yosemite更新为El Capitan。自从我运行优胜美地以来,我还没有触及过代码。我的部署目标仍然是Yosemite,虽然我将其更改为El Cap并且崩溃了。有什么想法吗?

这是堆栈跟踪:

AVAudioUnitSampler

这是我加载采样器的代码:

MIDIController.h

2016-09-12 10:59:01.134 Playground[66431:1254259] removed
2016-09-12 10:59:03.747 Playground[66431:1254301] sampler loaded
2016-09-12 10:59:03.848 Playground[66431:1254285] 10:59:03.848 ERROR:    93: BankEntry::LoadInstrument: Unable to find patch 0 bank 0x78/0
2016-09-12 10:59:03.848 Playground[66431:1254285] 10:59:03.848 ERROR:    486: DLS/SF2 bank load failed
2016-09-12 10:59:03.859 Playground[66431:1254285] 10:59:03.859 ERROR:    AVAudioUnitSampler.mm:163: -[AVAudioUnitSampler loadSoundBankInstrumentAtURL:program:bankMSB:bankLSB:error:]: error -10851
2016-09-12 10:59:03.861 Playground[66431:1254285] An uncaught exception was raised
2016-09-12 10:59:03.861 Playground[66431:1254285] error -10851
2016-09-12 10:59:03.861 Playground[66431:1254285] (
    0   CoreFoundation                      0x00007fff946594f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9c4da73c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9465e1ca +[NSException raise:format:arguments:] + 106
    3   libAVFAudio.dylib                   0x00007fff9b29ce13 _Z19AVAE_RaiseExceptionP8NSStringz + 176
    4   libAVFAudio.dylib                   0x00007fff9b2d5dae -[AVAudioUnitSampler loadSoundBankInstrumentAtURL:program:bankMSB:bankLSB:error:] + 317
    5   Playground                          0x0000000100017800 __41-[MIDIController loadSoundFontInstrument]_block_invoke + 96
    6   libdispatch.dylib                   0x00000001003a1070 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x0000000100393cc5 _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x0000000100398457 _dispatch_root_queue_drain + 2934
    9   libdispatch.dylib                   0x00000001003978a5 _dispatch_worker_thread3 + 106
    10  libsystem_pthread.dylib             0x00000001003f6336 _pthread_wqthread + 1129
    11  libsystem_pthread.dylib             0x00000001003f3f91 start_wqthread + 13
)

2016-09-12 10:59:03.861 Playground[66431:1254285] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error -10851'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff946594f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9c4da73c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9465e1ca +[NSException raise:format:arguments:] + 106
    3   libAVFAudio.dylib                   0x00007fff9b29ce13 _Z19AVAE_RaiseExceptionP8NSStringz + 176
    4   libAVFAudio.dylib                   0x00007fff9b2d5dae -[AVAudioUnitSampler loadSoundBankInstrumentAtURL:program:bankMSB:bankLSB:error:] + 317
    5   Playground                          0x0000000100017800 __41-[MIDIController loadSoundFontInstrument]_block_invoke + 96
    6   libdispatch.dylib                   0x00000001003a1070 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x0000000100393cc5 _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x0000000100398457 _dispatch_root_queue_drain + 2934
    9   libdispatch.dylib                   0x00000001003978a5 _dispatch_worker_thread3 + 106
    10  libsystem_pthread.dylib             0x00000001003f6336 _pthread_wqthread + 1129
    11  libsystem_pthread.dylib             0x00000001003f3f91 start_wqthread + 13
)

libc++abi.dylib: terminating with uncaught exception of type NSException

MIDIController.m

#import <AVFoundation/AVFoundation.h>
#import <Foundation/Foundation.h>

@interface MIDIController : NSObject

@property NSMutableArray *notes;
@property NSMutableArray *keyboard;
@property CFStringRef endpointName;

@property AVAudioUnitSampler *sampler;

-(int)uniqueNotesPlayed;
-(void) loadSampler;
-(void) unloadSampler;
@end

1 个答案:

答案 0 :(得分:1)

从评论中迁移回答

loadSoundBankInstrumentAtURL报告kAudioUnitErr_InvalidPropertyValue,因为“无法找到补丁0银行0x78 / 0”。也许钢琴声音字体文件在elcap上被认为无效?

出于兴趣,您可以尝试将其加载到主调度队列中吗?或者没有dispatch_async

从多个线程调用是一个困难的要求(并且有人确实声称AVAudioUnitSampler是线程安全的吗?),所以如果这是你的困境的原因我不会感到惊讶。