X-Git-Url: https://git.yukkurigames.com/?p=pwl6.git;a=blobdiff_plain;f=src%2Fyuu%2Faudio.js;h=cc00cf7424ada80841e8b8b32f160090804d6c56;hp=d127fb8d518496bc11ca877d01c2af8259959204;hb=5deeff54e19003703e7ffb3ee1d3406c3092ebf9;hpb=9f0bd6f08de07960e2c47a0d4b65b416c68c3f8a diff --git a/src/yuu/audio.js b/src/yuu/audio.js index d127fb8..cc00cf7 100644 --- a/src/yuu/audio.js +++ b/src/yuu/audio.js @@ -29,7 +29,6 @@ this._masterVolume.gain.value = 0.5; this._musicVolume.gain.value = 0.5; - this._bufferCache = {}; this._mute = false; this._storage = null; this._volume = this._masterVolume.gain.value; @@ -90,7 +89,7 @@ currentTime: { alias: "_ctx.currentTime" }, - decodeAudioData: function (data) { + decodeAudioData: function (data, hint) { var ctx = this._ctx; try { return ctx.decodeAudioData(data); @@ -99,7 +98,8 @@ ctx.decodeAudioData(data, function (buffer) { resolve(buffer); }, function () { - reject(new Error("Error decoding audio buffer")); + reject(new Error("Error decoding audio buffer" + + (hint ? ": " + hint : ""))); }); }); } @@ -175,7 +175,9 @@ var url = yuu.resourcePath(path, "sound", "wav"); this.data = null; this.ready = yuu.GET(url, { responseType: "arraybuffer" }) - .then(ctx.decodeAudioData.bind(ctx)) + .then(function (data) { + return ctx.decodeAudioData(data, url); + }) .then(yf.setter.bind(this, "buffer")) .then(yf.K(this)); }