From 4a91f3018f3d53708c07a62660bf97338e1503e0 Mon Sep 17 00:00:00 2001
From: Alex Xu <alex_y_xu@yahoo.ca>
Date: Sat, 27 Jul 2013 19:12:06 -0400
Subject: fix volume

---
 www/js/api.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'www/js')

diff --git a/www/js/api.js b/www/js/api.js
index 21494a2..43692cf 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -36,12 +36,13 @@ window.html5ks.api = {
     html5ks.elements.audio[channel] = audio;
     audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]);
     audio.load();
-    audio.volume = fade ? 0 : html5ks.persistent.settings.musicVolume;
+    var volume = html5ks.persistent.settings[channel + "Volume"];
+    audio.volume = fade ? 0 : volume;
     audio.play();
     audio.onplaying = function () {
       deferred.resolve();
       if (fade) {
-        html5ks.api.set_volume(1, fade, channel);
+        html5ks.api.set_volume(volume, fade, channel);
       }
     };
     audio.onerror = function () {
-- 
cgit v1.2.3-70-g09d2