improve step sound

This commit is contained in:
LabyStudio
2022-02-13 08:19:49 +01:00
parent b7b3439f0d
commit a7482c52f1
3 changed files with 25 additions and 6 deletions
@@ -58,7 +58,7 @@ window.SoundManager = class {
return sound;
}
playSound(name, x, y, z, pitch) {
playSound(name, x, y, z, volume, pitch) {
let pool = this.soundPool[name];
if (typeof pool === "undefined") {
@@ -76,7 +76,8 @@ window.SoundManager = class {
// Update position
sound.position.set(x, y, z);
// Update pitch
// Update volume and pitch
sound.setVolume(volume);
sound.filters[0].frequency.setValueAtTime(12000 * pitch, sound.context.currentTime);
// Play sound