From d53312575ef9ea97d3f141d7a5fff4d5e784c7e3 Mon Sep 17 00:00:00 2001 From: Will Toohey Date: Sat, 3 Apr 2021 16:01:40 +1000 Subject: [PATCH] Apply volume passed in defaults initialiser --- src/js/HuesCore.js | 4 ++-- src/js/SoundManager.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/HuesCore.js b/src/js/HuesCore.js index d1ecceb..1fc5231 100644 --- a/src/js/HuesCore.js +++ b/src/js/HuesCore.js @@ -109,7 +109,7 @@ class HuesCore { }; // Bunch-o-initialisers - this.version = 35; + this.version = 36; this.versionStr = (this.version/10).toFixed(1); this.versionHex = this.version.toString(16); this.beatIndex = 0; @@ -190,7 +190,7 @@ class HuesCore { this.visualiser.height = "64"; this.vCtx = this.visualiser.getContext("2d"); - this.soundManager = new SoundManager(this); + this.soundManager = new SoundManager(this, this.settings.volume); this.soundManager.init().then(() => { if(!this.soundManager.locked && this.settings.skipPreloader == "on") { diff --git a/src/js/SoundManager.js b/src/js/SoundManager.js index 3752146..fbe0ddc 100644 --- a/src/js/SoundManager.js +++ b/src/js/SoundManager.js @@ -23,7 +23,7 @@ "use strict"; class SoundManager { - constructor(core) { + constructor(core, initialVolume = 1) { // Perhaps this will do more later this.eventListeners = { /* callback seek() @@ -56,7 +56,7 @@ class SoundManager { // Volume this.gainNode = null; this.mute = false; - this.lastVol = 1; + this.lastVol = initialVolume; // Visualiser this.vReady = false; @@ -680,4 +680,4 @@ for (var i = 0; i < miniOggBin.length; i++) { window.SoundManager = SoundManager; -})(window, document); \ No newline at end of file +})(window, document);