简体   繁体   English

AudioBufferList浮动**转换EZAudio EZMicrophone以进行可视绘图

[英]AudioBufferList to float ** conversion EZAudio EZMicrophone for Visual Plotting

I'm using EZAudio in my project to read audio data from the microphone. 我在我的项目中使用EZAudio从麦克风读取音频数据。 EZAudio has 2 microphone methods: EZAudio有2种麦克风方法:

- (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. 我正在使用AudioBufferList的第一种方法来获取音频数据并通过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. 但是,当我想绘制它们时,据我所知,EZAudio仅接受第二种使用float **进行绘制的方法的输出。 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. 我无法让EZOutput播放浮点**,因此我可以使用第二种麦克风方法进行绘图和回放。 And I can't pass in the AudioBufferList from the first method for plotting. 而且我无法通过第一种绘图方法传入AudioBufferList。

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. 看来,如果我可以设法将一个转换为另一个(AudioBufferList <-> float **),则可以解决我的问题,但是我不知道该怎么做。

Any help is appreciated. 任何帮助表示赞赏。

尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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