mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-04 07:58:43 +00:00
ed71d8141b
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
25 lines
625 B
JavaScript
25 lines
625 B
JavaScript
import Tone from "../core/Tone";
|
|
|
|
/**
|
|
* AudioBuffer.copyTo/FromChannel polyfill
|
|
* @private
|
|
*/
|
|
if (Tone.supported){
|
|
if (!AudioBuffer.prototype.copyToChannel){
|
|
AudioBuffer.prototype.copyToChannel = function(src, chanNum, start){
|
|
var channel = this.getChannelData(chanNum);
|
|
start = start || 0;
|
|
for (var i = 0; i < channel.length; i++){
|
|
channel[i+start] = src[i];
|
|
}
|
|
};
|
|
AudioBuffer.prototype.copyFromChannel = function(dest, chanNum, start){
|
|
var channel = this.getChannelData(chanNum);
|
|
start = start || 0;
|
|
for (var i = 0; i < dest.length; i++){
|
|
dest[i] = channel[i+start];
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|