objective c - iOS Audio Unit, output each stereo channel from stereo source to 3D Mixer -
apple's 3d mixer audio unit guide states:
to use stereo source, may treat left , right channels 2 independent single-channel sources, , feed each side of stereo stream own input bus.
https://developer.apple.com/library/ios/qa/qa1695/_index.html
however, can not figure out how send each channel of stereo audio unit 3d mixer. how 1 this?
bascially, you'll need like
@interface audioengine () { avaudioengine *_engine; avaudioenvironmentnode *_environment; avaudiopcmbuffer *_ouputbuffer; nsmutablearray <avaudioplayernode*> *_playerarray; avaudioplayernode *_soundplayer; avaudiopcmbuffer *_soundbuffer; bool _multichanneloutputenabled
;
load file , grab buffer. split stereo multichannel, need like
outputlayouttag = kaudiochannellayouttag_audiounit_2; _multichanneloutputenabled = true;
this '_multichanneloutputenabled = true;' set false
then setup algorithm channels
avaudio3dmixingrenderingalgorithm renderingthis = _multichanneloutputenabled ? avaudio3dmixingrenderingalgorithmsoundfield : avaudio3dmixingrenderingalgorithmequalpowerpanning; newplayer.renderingalgorithm = renderingthis;
somewhere in view controller might have tied object in game
[self.epicaudioengine.updatelistenerorientation:avaudiomake3dangularorientation([ang.x,ang.y,ang.z]) [self updateeuleranglesandlistenerfromdeltax:dx deltay:dy]
look through ffmpeg source code libavformat,libavutil idea of how process audio