mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-29 03:55:09 +00:00
ed71d8141b
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
20 lines
529 B
JavaScript
20 lines
529 B
JavaScript
import Tone from "../core/Tone";
|
|
import "../shim/AudioContext";
|
|
|
|
/**
|
|
* AnalyserNode.getFloatTimeDomainData polyfill
|
|
* @private
|
|
*/
|
|
if (Tone.supported){
|
|
if (!AnalyserNode.prototype.getFloatTimeDomainData){
|
|
//referenced https://github.com/mohayonao/get-float-time-domain-data
|
|
AnalyserNode.prototype.getFloatTimeDomainData = function(array){
|
|
var uint8 = new Uint8Array(array.length);
|
|
this.getByteTimeDomainData(uint8);
|
|
for (var i = 0; i < uint8.length; i++){
|
|
array[i] = (uint8[i] - 128) / 128;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|