AudioDestinationNode
接口的maxchannelCount属性是
一个表示物理设备能处理最大通道数的无符号长整型数。
AudioNode.channelCount
属性值只能在 0和这个值 (两端包含)之间。如果 maxChannelCount
为 0
,例如在 OfflineAudioContext
, 表示音频通道不能被改变。
语法
var audioCtx = new AudioContext(); var myDestination = audioCtx.destination; myDestination.maxChannelCount = 2;
值
一个无符号长整型数
例子
下面假设了一个简单的音频环境,设置其中 AudioDestinationNode的
maxChannelCount值为
2:
var audioCtx = new AudioContext(); var source = audioCtx.createMediaElementSource(myMediaElement); source.connect(gainNode); audioCtx.destination.maxChannelCount = 2; gainNode.connect(audioCtx.destination);
为看到一个更完整的实施,请访问我们的 MDN Web Audio 例子,如 Voice-change-o-matic 或者 Violent Theremin.
规范
Specification | Status | Comment |
---|---|---|
Web Audio API maxChannelCount |
Working Draft |
浏览器兼容
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 10.0webkit | 25.0 (25.0) | 未实现 | 15.0webkit 22 (unprefixed) |
6.0webkit |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | ? | 26.0 | 1.2 | ? | ? | ? | 33.0 |