From f7d6e530b411aac344179641ade302e8c7bd293a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 9 Apr 2018 19:05:08 +0200 Subject: [PATCH] [lib.audio-manager] fixed buffer chain --- parcel/lib/audio-manager.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parcel/lib/audio-manager.js b/parcel/lib/audio-manager.js index d314a85..79fd02b 100644 --- a/parcel/lib/audio-manager.js +++ b/parcel/lib/audio-manager.js @@ -60,6 +60,7 @@ export default class AudioManager{ /* (7) Initialise coordinator to manage received */ this.stack = []; + this.stack_save = 0; @@ -291,7 +292,7 @@ export default class AudioManager{ gain.connect(this.master); /* (7) If not empty stack -> play stack */ - if( this.stack.length > 0 ){ + if( this.stack.length > this.stack_save ){ this.stack.shift().start(this.ctx.currentTime); return this.stack.push(source); } @@ -304,11 +305,12 @@ export default class AudioManager{ this.dbg.data.packets_received++; this.dbg.data.kB_received += _buffer.length * 16. / 8 / 1024; - return this.stack.length > 0 && this.stack.shift().start(this.ctx.curentTime); + if( this.stack.length > this.stack_save ) + this.stack.shift().start(this.ctx.curentTime); }.bind(this); - // start playing + // push in stack source.start(this.ctx.currentTime); }