iOS 音频单元,将立体声源中的每个立体声 channel 输出到 3D 混音器
<p><p>Apple 的 3D Mixer Audio Unit 指南指出:</p>
<blockquote>
<p>To use a stereo source, you may treat its left and right channels as two independent single-channel sources, and then feed each side of the stereo stream to its own input bus. </p>
</blockquote>
<p> <a href="https://developer.apple.com/library/ios/qa/qa1695/_index.html" rel="noreferrer noopener nofollow">https://developer.apple.com/library/ios/qa/qa1695/_index.html</a> </p>
<p>但是,我不知道如何将立体声音频单元的每个 channel 发送到 3D 混音器。如何做到这一点?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>基本上,你需要做类似的事情</p>
<pre><code>@interface AudioEngine () {
AVAudioEngine *_engine;
AVAudioEnvironmentNode *_environment;
AVAudioPCMBuffer *_ouputBuffer;
NSMutableArray <AVAudioPlayerNode*> *_PlayerArray;
AVAudioPlayerNode *_soundPlayer;
AVAudioPCMBuffer *_soundBuffer;
bool _multichannelOutputEnabled
</code></pre>
<p>;</p>
<p>加载一个文件并从缓冲区中抓取它。
要将立体声分成多声道,您需要类似</p>
<pre><code>outputLayoutTag = kAudioChannelLayoutTag_AudioUnit_2;
_multichannelOutputEnabled = true;
</code></pre>
<p>这个'_multichannelOutputEnabled = true;'通常设置为false</p>
<p>然后设置算法以对您的 channel 执行某些操作</p>
<pre><code>AVAudio3DMixingRenderingAlgorithm renderingTHIS = _multichannelOutputEnabled ?
AVAudio3DMixingRenderingAlgorithmSoundField : AVAudio3DMixingRenderingAlgorithmEqualPowerPanning;
newPlayer.renderingAlgorithm = renderingTHIS;
</code></pre>
<p>在 ViewController 的某个地方,您可能会将类似的东西与游戏中的对象相关联</p>
<pre><code>)
</code></pre>
<p>查看 libavformat、libavutil 的 ffmpeg 源代码,了解如何处理音频</p></p>
<p style="font-size: 20px;">关于iOS 音频单元,将立体声源中的每个立体声 channel 输出到 3D 混音器,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37580255/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37580255/
</a>
</p>
页:
[1]