Custom default volume

This commit is contained in:
Ethan O'Brien 2023-07-03 09:34:48 -05:00
parent daaf010b94
commit dcd01210a1
3 changed files with 4 additions and 2 deletions

View file

@ -13,5 +13,6 @@
mute: false, mute: false,
volume: true, volume: true,
}*/ }*/
EJS_volume = 1;
</script> </script>
<script src='src/loader.js'></script> <script src='src/loader.js'></script>

View file

@ -148,17 +148,17 @@ class EmulatorJS {
} }
} }
constructor(element, config) { constructor(element, config) {
this.config = config;
window.EJS_TESTING = this; window.EJS_TESTING = this;
this.currentPopup = null; this.currentPopup = null;
this.touch = false; this.touch = false;
this.debug = (window.EJS_DEBUG_XX === true); this.debug = (window.EJS_DEBUG_XX === true);
this.cheats = []; this.cheats = [];
this.started = false; this.started = false;
this.volume = 0.5; this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5;
this.muted = false; this.muted = false;
this.paused = true; this.paused = true;
this.listeners = []; this.listeners = [];
this.config = config;
this.setElements(element); this.setElements(element);
this.setColor(this.config.color || ""); this.setColor(this.config.color || "");
if (this.config.adUrl) this.setupAds(this.config.adUrl); if (this.config.adUrl) this.setupAds(this.config.adUrl);

View file

@ -53,6 +53,7 @@
config.adTimer = window.EJS_AdTimer config.adTimer = window.EJS_AdTimer
config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings;
config.buttonOpts = window.EJS_Buttons; config.buttonOpts = window.EJS_Buttons;
config.volume = window.EJS_volume;
new EmulatorJS(EJS_player, config); new EmulatorJS(EJS_player, config);