AudioBuffer
接口的copyFromChannel方法将样本从AudioBuffer的指定通道复制到目标数组中
语法
myArrayBuffer.copyFromChannel(destination,channelNumber,startInChannel);
参数
- destination
- 将通道数据复制到的
Float32Array
- channelNumber
- 当前AudioBuffer的通道号,用于复制通道数据。键入channelNumber大于或等于
AudioBuffer.numberOfChannels
,将会抛出INDEX_SIZE_ERR
的错误 - startInChannel 可选
- 用于复制数据的可选偏移量。假如startInChannel比
AudioBuffer.length
大,将会抛出INDEX_SIZE_ERR
的错误
例子
var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
var anotherArray = new Float32Array;
myArrayBuffer.copyFromChannel(anotherArray,1,0);
规范
Specification | Status | Comment |
---|---|---|
Web Audio API copyFromChannel |
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 | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 14.0 webkit | (Yes) | 27 (27) | 未实现 | 15 webkit 22 (unprefixed) |
未实现 |
Unprefixed | 43.0 | (Yes) | ? | ? | ? | 未实现 |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|---|
Basic support | 未实现 | ? | (Yes) | 27.0 (27) | 1.2 | 未实现 | 未实现 | 未实现 | 28.0 webkit |
Unprefixed | 未实现 | 未实现 | (Yes) | ? | ? | ? | ? | 未实现 | 43.0 |