Musikbuttons hinzugefügt

This commit is contained in:
silas
2018-09-26 14:01:33 +02:00
parent be130a99e8
commit c13dfc378f
16 changed files with 1229 additions and 527 deletions

View File

@@ -139,12 +139,16 @@ class SoundManager {
audioObject.volume = Helper.nonNull(options.volume, audioObject.volume, 1);
audioObject.loop = Helper.nonNull(options.loop, audioObject.loop, false);
audioObject.timeOffset = Helper.nonNull(options.timeOffset, audioObject.timeOffset, 0);
this.channels[channel] = audioObject;
console.log(options);
if (audioObject.muted){
this.stop(channel);
}
this.channels[channel] = audioObject;
else if (Helper.isNotNull(options.muted) && options.muted === false){
// this.play(channel);
}
return this.channels[channel];
}
@@ -163,13 +167,12 @@ class SoundManager {
this.stop(channel);
this.set(audioOrOptions, channel);
console.log(this.channels[channel]);
if (!this.channels[channel].muted) {
let buffer = await this.channels[channel].loadedPromise;
let source = this.context.createBufferSource();
source.buffer = buffer;
source.connect(this.context.destination);
// source.loopStart = 5;
// source.loopEnd = 5;
source.loop = this.channels[channel].loop;
source.start(0);
this.channels[channel].source = source;