简体   繁体   中英

AudioBufferList to float ** conversion EZAudio EZMicrophone for Visual Plotting

I'm using EZAudio in my project to read audio data from the microphone. EZAudio has 2 microphone methods:

- (void)microphone:(EZMicrophone *)microphone hasBufferList:(AudioBufferList *)bufferList withBufferSize:(UInt32)bufferSize withNumberOfChannels:(UInt32)numberOfChannels {

-(void)microphone:(EZMicrophone *)microphone hasAudioReceived:(float **)buffer withBufferSize:(UInt32)bufferSize withNumberOfChannels:(UInt32)numberOfChannels {

I'm using the first method with AudioBufferList to get the audio data and send them over the wifi. It works well. But when I want to plot them, as far as i can tell EZAudio only accepts the output from the second method which uses float ** for plotting. I seem to be stuck here. I can't get the EZOutput to play float ** so i can use the second microphone method for both plotting and playback. And I can't pass in the AudioBufferList from the first method for plotting.

It seems if i can manage to convert one to another (AudioBufferList <--> float **), it may solve my problem, but i don't know how to do it.

Any help is appreciated.

尝试这个:

float *buffer = (float*)bufferList->mBuffers[0].mData;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM