苹果公司的3D调音台音频单元指南指出:



https://developer.apple.com/library/ios/qa/qa1695/_index.html

但是,我不知道如何将立体声音频单元的每个通道发送到3D混音器中。如何做到这一点?

最佳答案

基本上,您需要做类似的事情

@interface AudioEngine () {
    AVAudioEngine                       *_engine;
    AVAudioEnvironmentNode              *_environment;
    AVAudioPCMBuffer                    *_ouputBuffer;
    NSMutableArray <AVAudioPlayerNode*> *_PlayerArray;
    AVAudioPlayerNode                   *_soundPlayer;
    AVAudioPCMBuffer                    *_soundBuffer;
    bool                                _multichannelOutputEnabled

;

加载文件并从缓冲区中抓取它。
要将立体声拆分为多声道,您需要
outputLayoutTag = kAudioChannelLayoutTag_AudioUnit_2;
_multichannelOutputEnabled = true;

这个'_multichannelOutputEnabled = true;'通常设置为false

然后设置算法以对您的 channel 进行操作
AVAudio3DMixingRenderingAlgorithm renderingTHIS = _multichannelOutputEnabled ?
AVAudio3DMixingRenderingAlgorithmSoundField : AVAudio3DMixingRenderingAlgorithmEqualPowerPanning;
        newPlayer.renderingAlgorithm = renderingTHIS;

在 View Controller 中的某处,您可能会有类似这样的内容绑定(bind)到游戏中的对象上
[self.epicAudioEngine.updateListenerOrientation:AVAudioMake3DAngularOrientation([ang.x,ang.y,ang.z])

[self updateEulerAnglesAndListenerFromDeltaX:dX DeltaY:dY]

浏览ffmpeg的libavformat,libavutil源代码,以了解如何处理音频

关于ios - iOS音频单元,将每个立体声 channel 从立体声源输出到3D调音台,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37580255/

10-09 07:39