useful for various production environments.
This commit is contained in:
Yotam Mann 2016-02-27 17:12:11 -05:00
parent 93d70a3a9e
commit 12c7426f53

View file

@ -317,6 +317,13 @@ define(["Tone/core/Tone", "Tone/core/Emitter"], function(Tone){
Tone.Buffer.trigger("progress", completed / Tone.Buffer._totalDownloads); Tone.Buffer.trigger("progress", completed / Tone.Buffer._totalDownloads);
}; };
/**
* A path which is prefixed before every url.
* @type {String}
* @static
*/
Tone.Buffer.baseUrl = "";
/** /**
* Makes an xhr reqest for the selected url then decodes * Makes an xhr reqest for the selected url then decodes
* the file as an audio buffer. Invokes * the file as an audio buffer. Invokes
@ -329,7 +336,7 @@ define(["Tone/core/Tone", "Tone/core/Emitter"], function(Tone){
*/ */
Tone.Buffer.load = function(url, callback){ Tone.Buffer.load = function(url, callback){
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open("GET", url, true); request.open("GET", Tone.Buffer.baseUrl + url, true);
request.responseType = "arraybuffer"; request.responseType = "arraybuffer";
// decode asynchronously // decode asynchronously
request.onload = function() { request.onload = function() {