--- title: ChannelMergerNode slug: Web/API/ChannelMergerNode translation_of: Web/API/ChannelMergerNode --- <p>{{APIRef("Web Audio API")}}</p> <p> <code>ChannelMergerNode</code> 接口,经常与其对应的 {{domxref("ChannelSplitterNode")}} 接口一起使用,将不同的单声道输入重新组合成单个输出。每个输入用于填充输出的一个通道。这对于分别访问每个通道非常有用,例如,执行通道混合时,必须在每个信道上单独控制增益。</p> <p><img alt="" src="https://mdn.mozillademos.org/files/9709/WebAudioMerger.png" style="display: block; height: 216px; margin: 0px auto; width: 286px;"></p> <p>如果 <code>ChannelMergerNode</code> 用于一个单一输出,但输入数量与用于合并的信道数量相同;输入的数量被定义为其构造函数的参数及对 {{domxref("AudioContext.createChannelMerger")}} 的调用。 如果没有给出值,则为默认值 <code>6</code>。</p> <p>使用 <code>ChannelMergerNode</code>,可以创建比渲染硬件能处理的更多的通道输出。在这种情况下,当信号发送至 {{domxref("AudioContext.listener")}} 对象时,额外的信道将被忽略。</p> <table class="properties"> <tbody> <tr> <th scope="row">输入数量</th> <td>变量; 默认为 <code>6</code>.</td> </tr> <tr> <th scope="row">输出数量</th> <td><code>1</code></td> </tr> <tr> <th scope="row">通道计数模式</th> <td><code>"max"</code></td> </tr> <tr> <th scope="row">通道数量</th> <td><code>2 </code>(不在默认计数模式下使用)</td> </tr> <tr> <th scope="row">频道解释</th> <td><code>"speakers"</code></td> </tr> </tbody> </table> <h2 id="构造函数">构造函数</h2> <dl> <dt>{{domxref("ChannelMergerNode.ChannelMergerNode()", "ChannelMergerNode()")}}</dt> <dd>生成一个新的 <code>ChannelMergerNode</code> 对象实例。</dd> </dl> <h2 id="属性">属性</h2> <p><em>没有具体属性;从其父级继承属性, </em><em>{{domxref("AudioNode")}}。</em></p> <h2 id="方法">方法</h2> <p><em>没具体方法; 从其父级继承方法, </em><em>{{domxref("AudioNode")}}。</em></p> <h2 id="例子">例子</h2> <p>{{page("/zh-CN/docs/Web/API/AudioContext/createChannelMerger","(举个)栗(例)子")}}</p> <h2 id="规格">规格</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('Web Audio API', '#the-channelmergernode-interface', 'ChannelMergerNode')}}</td> <td>{{Spec2('Web Audio API')}}</td> <td> </td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <div> <p>{{Compat("api.ChannelMergerNode")}}</p> </div> <h2 id="参见">参见</h2> <ul> <li><a href="/en-US/docs/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li> </ul>