iPhone/iPad开发札记 2012/02/22


1. clean *.pcm playing program 

todo: 播放结束后,自动变成 play. 


Q: AQPlayer::IsRunningProc(): where to use it ?


* 跟踪SpeakHere,发现以下调用:

#0 0x0000b7e1 in AQPlayer::isRunningProc at AQPlayer.mm:94
#1 0x00d46e62 in AQCallbackReceiver_PropertiesChanged
#2 0x00ce2ee3 in _XPropertiesChanged
#3 0x00cdb161 in mshMIGPerform
#4 0x00f68064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
#5 0x00ec86f7 in __CFRunLoopDoSource1
#6 0x00ec5983 in __CFRunLoopRun
#7 0x00ec5240 in CFRunLoopRunSpecific
#8 0x00ec5161 in CFRunLoopRunInMode
#9 0x01a56268 in GSEventRunModal
#10 0x01a5632d in GSEventRun
#11 0x002d742e in UIApplicationMain
#12 0x00002734 in main at main.m:55


Note: 所以应该是在某个地方注册了property change之类event来驱动的。 Q: But where ?


* 重构代码,使用宏文件

杂音消失,但似乎在每一个buffer的内容放了两次,有重音。


* 修改sample rate,发现音调变化(大:高,小:低)


2. recording *.pcm file

* recording from SpeakHere 

# SetupAudioFormat()

AudioStreamBasicDescription:  ASBD


mSampleRate:441000

mFormatID: xxxxx( kLinearPCM ) 

mFormatFlags: 12 ( specific to format ) 

mFramesPerPacket: 0

mBytesPerFrame: 4

mChannelsPerFrame: 2

mBitesPerChannel: 16

mReserved: 0


Note1: FramesPerPacket not set 

Note2: AudioFileType is not in dataformat. 

Note3: 可从系统得到它支持的sample rate/channels等参数。

AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,xxx,yyy)


# StartRecord()

bufferByteSize = ComputeRecordBufferSize(&mRecordFormat, kBufferDurationSeconds);

Note: bufferBytesSize = 88200. 


Q:这个值可以随便设吗?原则是什么?


# MyInutBufferHandler()

注:此函数是由QAClient这个thread来调用的,而非main thread !


AT 9:31 PM, almost done !


Q: left issue: playback有重音。


3. reading Audio Unit Hosting Guide for iOS


* Audio Unit is the lowest layer in iOS audio stack.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值