fix persisting loud sounds

This commit is contained in:
RandomityGuy 2022-11-29 23:16:18 +05:30
parent 92d59ec1b6
commit b7652955b5
4 changed files with 16 additions and 0 deletions

View file

@ -33,6 +33,7 @@ class DuctFan extends ForceObject {
ResourceLoader.load("sound/fan_loop.wav").entry.load(() -> {
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/fan_loop.wav", ResourceLoader.getAudio,
this.soundResources), new Vector(1e8, 1e8, 1e8), true);
this.soundChannel.pause = true;
onFinish();
});
});
@ -43,5 +44,8 @@ class DuctFan extends ForceObject {
var seffect = this.soundChannel.getEffect(Spatialization);
seffect.position = this.getAbsPos().getPosition();
if (this.soundChannel.pause)
this.soundChannel.pause = false;
}
}

View file

@ -34,6 +34,7 @@ class Magnet extends ForceObject {
ResourceLoader.load("sound/magnet.wav").entry.load(() -> {
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/magnet.wav", ResourceLoader.getAudio, this.soundResources),
new Vector(1e8, 1e8, 1e8), true);
this.soundChannel.pause = true;
onFinish();
});
});
@ -44,5 +45,8 @@ class Magnet extends ForceObject {
var seffect = this.soundChannel.getEffect(Spatialization);
seffect.position = this.getAbsPos().getPosition();
if (this.soundChannel.pause)
this.soundChannel.pause = false;
}
}

View file

@ -33,6 +33,7 @@ class SmallDuctFan extends ForceObject {
ResourceLoader.load("sound/fan_loop.wav").entry.load(() -> {
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/fan_loop.wav", ResourceLoader.getAudio,
this.soundResources), new Vector(1e8, 1e8, 1e8), true);
this.soundChannel.pause = true;
onFinish();
});
});
@ -43,5 +44,8 @@ class SmallDuctFan extends ForceObject {
var seffect = this.soundChannel.getEffect(Spatialization);
seffect.position = this.getAbsPos().getPosition();
if (this.soundChannel.pause)
this.soundChannel.pause = false;
}
}

View file

@ -50,6 +50,7 @@ class Tornado extends ForceObject {
ResourceLoader.load("sound/tornado.wav").entry.load(() -> {
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/tornado.wav", ResourceLoader.getAudio, this.soundResources),
new Vector(1e8, 1e8, 1e8), true);
this.soundChannel.pause = true;
for (material in this.materials) {
material.blendMode = Alpha;
// material.mainPass.culling = h3d.mat.Data.Face.None;
@ -64,5 +65,8 @@ class Tornado extends ForceObject {
var seffect = this.soundChannel.getEffect(Spatialization);
seffect.position = this.getAbsPos().getPosition();
if (this.soundChannel.pause)
this.soundChannel.pause = false;
}
}