我正在尝试使用 Gracenote API 从 iPhone 4s 麦克风捕捉音乐。
在设备上运行时,应用程序在failed to launch in time
调用. 找到下面的日志。我从 GN 示例应用程序中复制并粘贴了大部分代码,运行良好。startRecording
GNAudioSourceMic
通过模拟器运行它没有问题。
- (void)mk_initialize
{
AudioSessionInitialize (
NULL,
NULL,
interruptionListenerCallback,
(__bridge void *)(self)
);
@try {
_config = [GNConfig init:GN_CLIENT_ID];
}
@catch (NSException * e) {
NSLog(@"clientId issue");
return;
}
[self.config setProperty: @"debugEnabled"
value: @"1"];
_recognizeFromStream = [GNRecognizeStream gNRecognizeStream:self.config];
_audioConfig = [GNAudioConfig gNAudioConfigWithSampleRate:44100
bytesPerSample:2
numChannels:1];
_audioSourceMicObj = [GNAudioSourceMic gNAudioSourceMic:self.audioConfig];
self.audioSourceMicObj.delegate = self;
NSError *error = nil;
[RecognizeStreamOperation recognizeStreamOperation:self.config];
error = [self.recognizeFromStream startRecognizeSession:op
audioConfig:self.audioConfig];
if (error) {
NSLog(@"ERROR: %@",[error localizedDescription]);
}
[self.audioSourceMicObj startRecording]; // hanging call
[self performSelectorInBackground:@selector(setUpRecognizePCMSession)
withObject:nil];
}
设备日志:
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
XXXXXXX failed to launch in time
Elapsed total CPU time (seconds): 3.080 (user 3.080, system 0.000), 15% CPU
Elapsed application CPU time (seconds): 0.527, 3% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x397ab0fc __psynch_mutexwait + 24
1 libsystem_c.dylib 0x396f4124 pthread_mutex_lock + 388
2 AudioToolbox 0x30fd54e8 CAMutex::Lock() + 32
3 AudioToolbox 0x3102645c AUConverterBase::Reset(unsigned long, unsigned long) + 48
4 AudioToolbox 0x310df602 AUGenericOutput::Start() + 26
5 AudioToolbox 0x310d1126 AURemoteIO::Start() + 942
6 AudioToolbox 0x31100776 AUMethodStart(void*) + 118
.
.
.