From 7a670b6cd3064d339c03c7d0840c176087f1ec99 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 19:39:58 +0100 Subject: audio won't work unless theres an actual audio element --- webAO/client.html | 9 ++++++++- webAO/client.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/webAO/client.html b/webAO/client.html index 1f17a65..a47c093 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -18,7 +18,6 @@ -

Loading

@@ -377,8 +376,16 @@ \ No newline at end of file diff --git a/webAO/client.js b/webAO/client.js index 3353cc1..e7b2362 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1193,7 +1193,7 @@ class Viewport { this.shoutaudio = new Audio(); - this.music = new Audio(); + this.music = document.getElementById("client_musicaudio"); this.music.play(); this.updater = null; -- cgit From a83e135966dd25a929b2f6d4526fe0253c876f90 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 19:52:22 +0100 Subject: the audio controls come with a volume slider --- webAO/client.html | 13 ++----------- webAO/client.js | 12 +++++------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/webAO/client.html b/webAO/client.html index a47c093..857cbad 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -281,12 +281,10 @@

Music - +
SFX - +
Blip - - - - \ No newline at end of file diff --git a/webAO/client.js b/webAO/client.js index e7b2362..9eb4031 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -371,9 +371,9 @@ class Client extends EventEmitter { document.querySelector('#client_themeselect [value="' + cookietheme + '"]').selected = true; reloadTheme(); - document.getElementById("client_mvolume").value = getCookie("musicVolume"); + document.getElementById("client_musicaudio").volume = getCookie("musicVolume"); changeMusicVolume(); - document.getElementById("client_svolume").value = getCookie("sfxVolume"); + document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); changeSFXVolume(); document.getElementById("client_bvolume").value = getCookie("blipVolume"); changeBlipVolume(); @@ -1847,8 +1847,7 @@ window.area_click = area_click; * Triggered by the music volume slider. */ export function changeMusicVolume() { - viewport.music.volume = document.getElementById("client_mvolume").value / 100; - setCookie("musicVolume", document.getElementById("client_mvolume").value); + setCookie("musicVolume", document.getElementById("client_musicaudio").volume); } window.changeMusicVolume = changeMusicVolume; @@ -1856,9 +1855,8 @@ window.changeMusicVolume = changeMusicVolume; * Triggered by the sound effect volume slider. */ export function changeSFXVolume() { - viewport.sfxaudio.volume = document.getElementById("client_svolume").value / 100; - viewport.shoutaudio.volume = document.getElementById("client_svolume").value / 100; - setCookie("sfxVolume", document.getElementById("client_svolume").value); + viewport.shoutaudio.volume = document.getElementById("client_sfxaudio").volume; + setCookie("sfxVolume", document.getElementById("client_sfxaudio").volume); } window.changeSFXVolume = changeSFXVolume; -- cgit From 9a74f4b7b8ab8d82c0c91f628df44b53f00e9aef Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 20:03:21 +0100 Subject: don't destroy my audio and use the element for sfx --- webAO/client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webAO/client.js b/webAO/client.js index 9eb4031..826698b 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -588,7 +588,6 @@ class Client extends EventEmitter { */ handleRMC(args) { viewport.music.pause(); - viewport.music = new Audio(this.musicList[args[1]]); const music = viewport.music; // Music offset + drift from song loading music.totime = args[1]; @@ -1188,7 +1187,7 @@ class Viewport { .forEach(channel => channel.volume = 0.5); this.currentBlipChannel = 0; - this.sfxaudio = new Audio(AO_HOST + "sounds/general/sfx-blipmale.wav"); + this.sfxaudio = document.getElementById("client_sfxaudio"); this.sfxplayed = 0; this.shoutaudio = new Audio(); -- cgit From ce9780b32e22d578881ff86b42324c27d8df3559 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 20:18:40 +0100 Subject: not needed anymore --- webAO/client.html | 18 +++++++++--------- webAO/styles/client.css | 8 -------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/webAO/client.html b/webAO/client.html index 857cbad..119e3d8 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -280,16 +280,16 @@

-
Music - -
-
SFX - -
-
Blip - Music

+ + +

SFX

+ + +

Blip

+ -
+

diff --git a/webAO/styles/client.css b/webAO/styles/client.css index 9ecd8cb..58d9087 100644 --- a/webAO/styles/client.css +++ b/webAO/styles/client.css @@ -358,14 +358,6 @@ border-width: 3px; } -.slider { - padding-right: 4px; - width: 80%; - align-self: center; - margin-left: auto; - margin-right: auto; -} - #client_defense_hp { text-align: left; } -- cgit From 39882cba4412b1c033dd6e0988a5e2d96ec9f072 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 20:20:24 +0100 Subject: the single blip was unused --- webAO/client.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/webAO/client.js b/webAO/client.js index 826698b..f0a74d8 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1177,9 +1177,6 @@ class Viewport { "cyan" ]; - this.blip = new Audio(AO_HOST + "sounds/general/sfx-blipmale.wav"); - this.blip.volume = 0.5; - // Allocate multiple blip audio channels to make blips less jittery this.blipChannels = new Array(6); -- cgit From 0a21911b3cc3f8de444c5b1da80c742cd74c611f Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 20:38:24 +0100 Subject: change blips too --- webAO/client.html | 6 ++++-- webAO/client.js | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/webAO/client.html b/webAO/client.html index 119e3d8..3c06689 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -287,8 +287,10 @@

Blip

- + + + +