mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
19 lines
553 B
JavaScript
19 lines
553 B
JavaScript
define(["Tone/core/Tone", "Tone/shim/AudioContext"], function(Tone){
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
});
|