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.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/client.js') 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.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'webAO/client.js') 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(-) (limited to 'webAO/client.js') 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 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(-) (limited to 'webAO/client.js') 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.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index f0a74d8..6aaa8e9 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -375,7 +375,7 @@ class Client extends EventEmitter { changeMusicVolume(); document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); changeSFXVolume(); - document.getElementById("client_bvolume").value = getCookie("blipVolume"); + document.getElementById("client_blipaudio0").value = getCookie("blipVolume"); changeBlipVolume(); document.getElementById("ic_chat_name").value = getCookie("ic_chat_name"); @@ -1179,9 +1179,11 @@ class Viewport { // Allocate multiple blip audio channels to make blips less jittery - this.blipChannels = new Array(6); - this.blipChannels.fill(new Audio(AO_HOST + "sounds/general/sfx-blipmale.wav")) - .forEach(channel => channel.volume = 0.5); + this.blipChannels = [document.getElementById("client_blipaudio0"), + document.getElementById("client_blipaudio1"), + document.getElementById("client_blipaudio2"), + document.getElementById("client_blipaudio3")]; + this.currentBlipChannel = 0; this.sfxaudio = document.getElementById("client_sfxaudio"); @@ -1860,8 +1862,8 @@ window.changeSFXVolume = changeSFXVolume; * Triggered by the blip volume slider. */ export function changeBlipVolume() { - viewport.blipVolume = document.getElementById("client_bvolume").value / 100; - setCookie("blipVolume", document.getElementById("client_bvolume").value); + viewport.blipVolume = document.getElementById("client_blipaudio0").volume; + setCookie("blipVolume", document.getElementById("client_blipaudio0").volume); } window.changeBlipVolume = changeBlipVolume; -- cgit From 0903ace1a2f87f2fd088302f86432affb530a1d2 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 20:41:42 +0100 Subject: volume not value --- webAO/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 6aaa8e9..d55d409 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -375,7 +375,7 @@ class Client extends EventEmitter { changeMusicVolume(); document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); changeSFXVolume(); - document.getElementById("client_blipaudio0").value = getCookie("blipVolume"); + document.getElementById("client_blipaudio0").volume = getCookie("blipVolume"); changeBlipVolume(); document.getElementById("ic_chat_name").value = getCookie("ic_chat_name"); -- cgit From 2b890c9e54742d09a841b4ef3b5cf200397e80eb Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 21:14:59 +0100 Subject: Revert "volume not value" This reverts commit 0903ace1a2f87f2fd088302f86432affb530a1d2. --- webAO/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index d55d409..6aaa8e9 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -375,7 +375,7 @@ class Client extends EventEmitter { changeMusicVolume(); document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); changeSFXVolume(); - document.getElementById("client_blipaudio0").volume = getCookie("blipVolume"); + document.getElementById("client_blipaudio0").value = getCookie("blipVolume"); changeBlipVolume(); document.getElementById("ic_chat_name").value = getCookie("ic_chat_name"); -- cgit From 842dc4b9c7652058bf4214c28468f608fd1215c0 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 21:15:03 +0100 Subject: Revert "change blips too" This reverts commit 0a21911b3cc3f8de444c5b1da80c742cd74c611f. --- webAO/client.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 6aaa8e9..f0a74d8 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -375,7 +375,7 @@ class Client extends EventEmitter { changeMusicVolume(); document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); changeSFXVolume(); - document.getElementById("client_blipaudio0").value = getCookie("blipVolume"); + document.getElementById("client_bvolume").value = getCookie("blipVolume"); changeBlipVolume(); document.getElementById("ic_chat_name").value = getCookie("ic_chat_name"); @@ -1179,11 +1179,9 @@ class Viewport { // Allocate multiple blip audio channels to make blips less jittery - this.blipChannels = [document.getElementById("client_blipaudio0"), - document.getElementById("client_blipaudio1"), - document.getElementById("client_blipaudio2"), - document.getElementById("client_blipaudio3")]; - + this.blipChannels = new Array(6); + this.blipChannels.fill(new Audio(AO_HOST + "sounds/general/sfx-blipmale.wav")) + .forEach(channel => channel.volume = 0.5); this.currentBlipChannel = 0; this.sfxaudio = document.getElementById("client_sfxaudio"); @@ -1862,8 +1860,8 @@ window.changeSFXVolume = changeSFXVolume; * Triggered by the blip volume slider. */ export function changeBlipVolume() { - viewport.blipVolume = document.getElementById("client_blipaudio0").volume; - setCookie("blipVolume", document.getElementById("client_blipaudio0").volume); + viewport.blipVolume = document.getElementById("client_bvolume").value / 100; + setCookie("blipVolume", document.getElementById("client_bvolume").value); } window.changeBlipVolume = changeBlipVolume; -- cgit From 131bc522be92901321e89896a00d548f4b55ac4f Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 15 Feb 2020 21:25:55 +0100 Subject: Revert "use the element for sfx" --- webAO/client.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index f0a74d8..dda1c63 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -373,7 +373,7 @@ class Client extends EventEmitter { document.getElementById("client_musicaudio").volume = getCookie("musicVolume"); changeMusicVolume(); - document.getElementById("client_sfxaudio").volume = getCookie("sfxVolume"); + document.getElementById("client_svolume").value = getCookie("sfxVolume"); changeSFXVolume(); document.getElementById("client_bvolume").value = getCookie("blipVolume"); changeBlipVolume(); @@ -1184,7 +1184,7 @@ class Viewport { .forEach(channel => channel.volume = 0.5); this.currentBlipChannel = 0; - this.sfxaudio = document.getElementById("client_sfxaudio"); + this.sfxaudio = new Audio(AO_HOST + "sounds/general/sfx-blipmale.wav"); this.sfxplayed = 0; this.shoutaudio = new Audio(); @@ -1851,8 +1851,9 @@ window.changeMusicVolume = changeMusicVolume; * Triggered by the sound effect volume slider. */ export function changeSFXVolume() { - viewport.shoutaudio.volume = document.getElementById("client_sfxaudio").volume; - setCookie("sfxVolume", document.getElementById("client_sfxaudio").volume); + 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); } window.changeSFXVolume = changeSFXVolume; -- cgit