iphone - CoreAudio Audio Unit plays only one channel of stereo audio -


recently i've bumped next problem. use coreaudio audiounit (remotei/o) play/record sound stream in ios app.

sound stream goes audio unit 2 channel lpcm, 16 bit, signed integer, interleaved (i configure output recording stream same has 1 channel , 2 bytes per packet , frame).

i have configured input asbd follows (i no error when set , when initialize unit):

asbd.mformatflags = klinearpcmformatflagissignedinteger | klinearpcmformatflagispacked; asbd.mbytesperpacket = 4; asbd.mframesperpacket = 1; asbd.mbytesperframe = 4; asbd.mchannelsperframe = 2; asbd.mbitsperchannel = 16; 

in render callback function audiobufferlist 1 buffer (as understand, because audio stream interleaved).

i have sample stereo file testing 100% stereo 2 obvious channels. translate stream corresponds asbd , feed audio unit.

when play sample file hear left channel.

i appreciate ideas why happens. if needed can post more code.

update: i've tried set

asbd.mformatflags = klinearpcmformatflagissignedinteger | klinearpcmformatflagispacked | klinearpcmformatflagisnoninterleaved; asbd.mbytesperpacket = 2; asbd.mframesperpacket = 1; asbd.mbytesperframe = 2; asbd.mchannelsperframe = 2; asbd.mbitsperchannel = 16; 

asbd , i've got buffer list 2 buffers. deinterleaved stream 2 channels(1 channel 1 buffer) , got same result. tried headset , speaker on ipad (i know speaker mono).

ok. i've check code , spotted use voiceprocessingio audio unit (instead of remoteio in question) correct app since documentation says "the voice-processing i/o unit (subtype kaudiounitsubtype_voiceprocessingio) has characteristics of remote i/o unit , adds echo suppression two-way duplex communication. adds automatic gain correction, adjustment of voice-processing quality, , muting"

when changed audio unit type remoteio i've got stereo playback. didn't have change stream properties.

basically voiceprocessingio audio unit downfalls mono , disregards stream properties.

i've posted question on apple developer forum regarding stereo output using voiceprocessingio audio unit haven't got answer yet.

it seems pretty logical me downfall mono in order signal processing echo cancelation because ios devices can record mono sound without specific external accessories. although not documented anywhere in apple documentation. i've come across post of guy claimed stereo worked voiceprocessingio au prior ios5.0.

anyway attention. other comments on matter appreciated.


Comments