大佬教程收集整理的这篇文章主要介绍了ios – 我想每秒调用20次installTapOnBus:bufferSize:format:block:,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
AVAudioSession *audioSession = [AVAudioSession sharedInstance]; NSError* error = nil; if (audioSession.isInputAvailablE) [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; if(error){ return; } [audioSession setActive:YES error:&error]; if(error){ retur; } self.ENGIne = [[[AVAudioENGIne alloc] init] autorelease]; AVAu@L_726_5@mixerNode* mixer = [self.ENGIne mainMixerNode]; AVAudioInputNode* input = [self.ENGIne inputNode]; [self.ENGIne connect:input to:mixer format:[input inputFormatForBus:0]]; // tap ... 1 call in 16537Frames // It does not change even if you change the bufferSize [input installTapOnBus:0 bufferSize:4096 format:[input inputFormatForBus:0] block:^(AVAudioPCMBuffer* buffer,AVAudioTime* when) { for (UInt32 i = 0; i < buffer.audioBufferList->mnumberBuffers; i++) { Float32 *data = buffer.audioBufferList->mBuffers[i].mData; UInt32 frames = buffer.audioBufferList->mBuffers[i].mDataByteSize / sizeof(Float32); // create waveform ... } }]; [self.ENGIne startAndReturnError:&error]; if (error) { return; }@H_801_7@
但有人调整缓冲区大小,并获得40毫秒
https://devforums.apple.com/thread/249510?tstart=0
在ObjC中无法检查它:(
UPD它有效!只是单行:
[input installTapOnBus:0 bufferSize:1024 format:[mixer outputFormatForBus:0] block:^(AVAudioPCMBuffer *buffer,AVAudioTime *when) { buffer.frameLength = 1024; //here@H_801_7@ @H_801_7@
以上是大佬教程为你收集整理的ios – 我想每秒调用20次installTapOnBus:bufferSize:format:block:全部内容,希望文章能够帮你解决ios – 我想每秒调用20次installTapOnBus:bufferSize:format:block:所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。