我接管音频输入以分析乐器正在播放的音符。这接管了一个主线程。 如何创建一个线程来运行它,以便当音符播放时我可以振动手机?
这是我的viewDidLoad
:
- (void) viewDidLoad
{
[super viewDidLoad];
[self vibrate];
pthread_t buf_update_thread;
// Setup audio input
CTAudioBuffer * audioInput = InitAudio(); // This is where will not allow vibrate
animation = [[Animation alloc] init];
[animation init:(UIView *) self.view];
pthread_create(&buf_update_thread, NULL, &analyzeData, audioInput);
[NSTimer scheduledTimerWithTimeInterval:REDRAW_TIMER target:self selector:@selector(updateCTDisplay:) userInfo: nil repeats:YES];
}