开发者

How get raw data in printf (buffer)? in audio recording iphone

I need raw data like 0 / 1

static OSStatus recordingCallback(void *inRefCon, 
                                  AudioUnitRenderActionFlags *ioActionFlags, 
                                 // AudioQueueBufferRef inBuffer,
                     开发者_StackOverflow             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);


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]);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜