From dcd01210a156b10ba210ae15ee776d0df6419991 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:34:48 -0500 Subject: [PATCH] Custom default volume --- index.html | 1 + src/emulator.js | 4 ++-- src/loader.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index bb81bcb..e299133 100644 --- a/index.html +++ b/index.html @@ -13,5 +13,6 @@ mute: false, volume: true, }*/ + EJS_volume = 1; diff --git a/src/emulator.js b/src/emulator.js index f1c4c3c..d8eeefd 100644 --- a/src/emulator.js +++ b/src/emulator.js @@ -148,17 +148,17 @@ class EmulatorJS { } } constructor(element, config) { + this.config = config; window.EJS_TESTING = this; this.currentPopup = null; this.touch = false; this.debug = (window.EJS_DEBUG_XX === true); this.cheats = []; this.started = false; - this.volume = 0.5; + this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5; this.muted = false; this.paused = true; this.listeners = []; - this.config = config; this.setElements(element); this.setColor(this.config.color || ""); if (this.config.adUrl) this.setupAds(this.config.adUrl); diff --git a/src/loader.js b/src/loader.js index aa6ce3b..1f241da 100644 --- a/src/loader.js +++ b/src/loader.js @@ -53,6 +53,7 @@ config.adTimer = window.EJS_AdTimer config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; config.buttonOpts = window.EJS_Buttons; + config.volume = window.EJS_volume; new EmulatorJS(EJS_player, config);