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;
currentTime: { alias: "_ctx.currentTime" },
- decodeAudioData: function (data) {
+ decodeAudioData: function (data, hint) {
var ctx = this._ctx;
try {
return ctx.decodeAudioData(data);
return new Promise(function (resolve, reject) {
ctx.decodeAudioData(data, function (buffer) {
resolve(buffer);
- }, function () {
- reject(new Error("Error decoding audio buffer"));
+ }, function (err) {
+ reject(new Error("Error decoding audio buffer"
+ + (hint ? ": " + hint : "")
+ + ": " + err.toString()));
});
});
}
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));
}