iphone - How to read data from AudioQueueBufferRef->mAudioData -


i'm trying read audio data audioqueuebufferref->maudiodata.

what want print buffer read mic/file console.

i don't know in format audio data represented. tried print long/int/float nothing seems give me right data.

my code similar speakhere sample provided apple.

i'm trying print buffer this: printf("%d ",((int*)incompleteaqbuffer->maudiodata)[i]);

am doing wrong?? right way read data maudiodata??

my stream description details are:

        streamdescription.mformatid = kaudioformatlinearpcm;      // if want pcm, default signed 16-bit little-endian     streamdescription.mformatflags = klinearpcmformatflagissignedinteger | klinearpcmformatflagispacked;     streamdescription.mbitsperchannel = 8 * sizeof (int);     streamdescription.mbytesperpacket = streamdescription.mbytesperframe = (streamdescription.mbitsperchannel / 8) * streamdescription.mchannelsperframe;     streamdescription.mframesperpacket = 1; 

apple's speakhere sample app has:

mrecordformat.mbitsperchannel = 16; 

you have different. c short type not same size c int type on 32-bit risc architectures, such current ios devices.


Comments