1
我希望这个问题不太含糊。我试图从这个Xcode项目中的音频缓冲区获取信息,并使用它来完成一些DSP。用DSP处理C++中的音频数据
framebuffer指向我想传递给函数的一个值数组,循环并最终插入原始缓冲区。该方法将起到类似声音过滤器或效果的作用。
也许为了让我的问题尽可能清楚,我们可以得到一个子程序的例子,它会在缓冲区中为每个样本添加0.25?
这里是到目前为止的代码:
static OSStatus playbackCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
EAGLView *remoteIOplayer = (EAGLView *)inRefCon;
for (int i = 0 ; i < ioData->mNumberBuffers; i++){
//get the buffer to be filled
AudioBuffer buffer = ioData->mBuffers[i];
short *frameBuffer = (short*)buffer.mData;
for (int j = 0; j < inNumberFrames; j++){
// get NextPacket returns a 32 bit value, one frame.
frameBuffer[j] = [[remoteIOplayer inMemoryAudioFile] getNextPacket];
}
EAGLView* thisView = [[EAGLView alloc] init];
[thisView DoStuffWithTheRecordedAudio:ioData];
[thisView release];
}
return noErr;
}
这看起来像Objective-C,而不是C++? – 2010-12-09 15:25:11