mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
baseUrl
useful for various production environments.
This commit is contained in:
parent
93d70a3a9e
commit
12c7426f53
1 changed files with 8 additions and 1 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue