Kinect hardware

Electric motor

3 sections of mainboard

Cooling fan

Two cameras

IR projector

4 microphones

Four different kinds of screws

15 chips including:

Wolfson Stereo ADC with microphone preamp

Fairchild N-Channel PowerTrench MOSFET

NEC USB 2.0 hub controller

Unidentified SAP package chip

Camera interface controller

Marvell SoC camera interface controller

Hynix 512Mb DDR2 SDRAM

Analog Devices CMOS Rail-to-Rail Output Operational Amplifier

TI 8-bit, 8-channel Sampling A/D converter

Allegro low voltage stepper and single/dual motor driver

ST 8Mbit NV flash memory

PrimeSense image sensor processor

TI USB audio controller

Kionix accelerometer

iOS录音问题

问题描述
AD的iPad版有一个鼓掌互动的应用。换了前后三套类库,如下:
SCListener:https://gist.github.com/72914
AVAudioRecorder:http://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/Reference/Reference.html
SpeakHere:http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html

问题分析
首先使用SCListener,发现模拟器上正常使用,但是真机不能监听声音。再使用AVAudioRecorder,发现还是有以上真机不能监听的问题。
最后使用SpeakHere,可以监听,但是有一个bug。就是:真机上,声音监听过就不能播放video,而模拟器上一切正常。

问题解决
原来录音和播放使用的是一个通道,需要手动设置当前通道的状态。而模拟器上就可以忽略这种限制。
修改通道为录音的代码如下:
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryRecord error:nil];

修改通道为播放的代码如下:
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];

播放前修改为播放,录音前修改为录音,一切OK了。

PS:后来发现只要修改对应的通道,AVAudioRecorder在真机上也可以用了。

Kinect驱动

驱动有三种:
OpenNI:Open Natural Interface,没有电驱模块。

Libfreenect:OpenKinect,由号称第一个破解Kinect的Hector Martin发起,有很多geek簇拥Mac,所以本来的目标平台是Linux和Mac,现在有Windows移植。

CLNUL:由NUI的大神AlexP (开发过PS3的Windows驱动),目标平台是Windows7,搭配OpenCV。

cocos2d多个CCSprite同时运行带CCCallFuncN的Action后会造成调用丢失

问题描述
昨天晚上通宵改Geely iPad的bug,这个bug改了8个小时。问题是程序会泄露导致崩溃。

问题分析
项目使用的是cocos2d,所以也不能使用Instruments做性能测试。一步一步发现一个CCLayer没有dealloc,于是进去一步一步查,一段段的注释和启用。最后发现有了这段代码就会出现泄露崩溃:

[vBackground stopAllActions];

[vMenu stopAllActions];

id backgroundFaceAction=[CCFadeOut actionWithDuration:0.7];

id backgroundCallAction=[CCCallFuncN actionWithTarget:self selector:@selector(removeNode:)];

id backgroundSequenceAction=[CCSequence actions:backgroundFaceAction, backgroundCallAction, nil];

id menuFaceAction=[CCFadeOut actionWithDuration:0.7];

id menuCallAction=[CCCallFuncN actionWithTarget:self selector:@selector(removeNode:)];

id menuSequenceAction=[CCSequence actions:menuFaceAction, menuCallAction, nil];

[vBackground runAction:backgroundSequenceAction];

[vMenu runAction:menuSequenceAction];

其中调用的removeNode函数如下:

-(void) removeNode:(id)vNode

{

CCNode *node=vNode;

if (node.parent!=nil)

{

[self removeChild:node cleanup:YES];

}

}

改成直接removeChild掉两个CCSprite,就不崩溃了:

[self removeNode:vBackground];

[self removeNode:vMenu];

问题解决:猜想是两个CCSprite同一时间开始的两个CCAction后同时调用removeNode函数,但是一个调到了,一个调用不到。想来这个是一个cocos2d的bug。

MPMoviePlayerViewController完成通知无效

问题描述
今天做Geely,在cocos2d中加video,使用MPMoviePlayerViewController类。

代码如下:
// play video
NSString *videoPath=[[NSBundle mainBundle] pathForResource:@"110414_Gilly_Mix" ofType:@"mov"];
NSURL *videoUrl=[NSURL fileURLWithPath:videoPath];
MPMoviePlayerViewController *player= [[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];
player.view.backgroundColor = [UIColor blackColor];
player.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
player.moviePlayer.movieControlMode = MPMovieControlModeHidden;
[[[player moviePlayer] backgroundView] setBackgroundColor:[UIColor blackColor]];
[[[CCDirector sharedDirector] openGLView] addSubview:player.view];

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];

[[player moviePlayer] play];

问题解决
通知这段去掉object,改为:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];

调用成功,问题解决,但是不知道原因。