2017-10-26 04:52:09 +00:00
|
|
|
define(["Tone/core/Tone"], function(Tone){
|
|
|
|
|
|
|
|
if (Tone.supported){
|
|
|
|
if (!window.hasOwnProperty("AudioContext") && window.hasOwnProperty("webkitAudioContext")){
|
|
|
|
window.AudioContext = window.webkitAudioContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
//not functionally equivalent, but only an API placeholder
|
|
|
|
if (!AudioContext.prototype.close){
|
|
|
|
AudioContext.prototype.close = function(){
|
|
|
|
if (Tone.isFunction(this.suspend)) {
|
|
|
|
return this.suspend();
|
|
|
|
} else {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
2017-10-26 05:07:53 +00:00
|
|
|
};
|
2017-10-26 04:52:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//not functionally equivalent
|
|
|
|
if (!AudioContext.prototype.resume){
|
|
|
|
AudioContext.prototype.resume = function(){
|
|
|
|
return Promise.resolve();
|
2017-10-26 05:07:53 +00:00
|
|
|
};
|
2017-10-26 04:52:09 +00:00
|
|
|
}
|
2017-10-26 18:09:20 +00:00
|
|
|
|
|
|
|
//createGain
|
|
|
|
if (!AudioContext.prototype.createGain && AudioContext.prototype.createGainNode){
|
|
|
|
AudioContext.prototype.createGain = AudioContext.prototype.createGainNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
//createDelay
|
|
|
|
if (!AudioContext.prototype.createDelay && AudioContext.prototype.createDelayNode){
|
|
|
|
AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode;
|
|
|
|
}
|
2017-10-26 04:52:09 +00:00
|
|
|
}
|
|
|
|
});
|