Include URL in audio load error message.
[pwl6.git] / src / yuu / audio.js
index 0e543a7..cc00cf7 100644 (file)
@@ -89,7 +89,7 @@
 
         currentTime: { alias: "_ctx.currentTime" },
 
-        decodeAudioData: function (data) {
+        decodeAudioData: function (data, hint) {
             var ctx = this._ctx;
             try {
                 return ctx.decodeAudioData(data);
@@ -98,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 : "")));
                     });
                 });
             }
             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));
         }