Improve UI

This commit is contained in:
Andras Schmelczer 2026-06-11 21:02:06 +01:00
parent 793d9a81e8
commit 3848e460cd
5 changed files with 289 additions and 5 deletions

View file

@ -52,7 +52,7 @@ export abstract class SoundHandler {
return sound;
}
public static play(sound: Sounds, volume = 1) {
public static play(sound: Sounds, volume = 1, playbackRate = 1) {
if (!this.initialized || !OptionsHandler.options.soundsEnabled) {
return;
}
@ -61,7 +61,8 @@ export abstract class SoundHandler {
this.sounds[sound].currentTime > 0
? (this.sounds[sound].cloneNode(true) as HTMLAudioElement)
: this.sounds[sound];
audio.volume = volume;
audio.volume = Math.max(0, Math.min(1, volume));
audio.playbackRate = playbackRate;
audio.play();
}