Lautstärke angepasst

This commit is contained in:
silas
2018-09-26 14:36:07 +02:00
parent c50fea1091
commit 877ff297c6
4 changed files with 18 additions and 6 deletions

View File

@@ -171,10 +171,16 @@ class SoundManager {
if (!this.channels[channel].muted) {
let buffer = await this.channels[channel].loadedPromise;
let source = this.context.createBufferSource();
let gain = this.context.createGain();
source.buffer = buffer;
source.connect(this.context.destination);
source.loop = this.channels[channel].loop;
gain.gain.value = this.channels[channel].volume;
source.connect(gain);
gain.connect(this.context.destination);
source.start(0);
this.channels[channel].source = source;
}
return this.channels[channel];