我需要原始数据,如0/1
static OSStatus recordingCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
// AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
////AudioHelper *remoteIOplayer = (AudioHelper *)inRefCon;
signalTime = CFAbsoluteTimeGetCurrent();
AudioBufferList list;
// redundant
list.mNumberBuffers = 1;
list.mBuffers[0].mData = sampleBuffer;
list.mBuffers[0].mDataByteSize = 2 * inNumberFrames;
list.mBuffers[0].mNumberChannels = 1;
ioData = &list;
printf("No buffers: %d, buffer length: %d bus number: %d\n", ioData->mNumberBuffers, ioData->mBuffers[0].mData, inBusNumber);
答案 0 :(得分:2)
SInt16* buf = (SInt16 *)ioData->mBuffers[0].mData;
for(int i=0; i< ioData->mBuffers[0].mDataByteSize / 2; i=i+2) {
printf("\n%d\n%d ", buf[i], buf[i+1]);
}