[lib.audio-manager] fixed buffer chain

This commit is contained in:
xdrm-brackets 2018-04-09 19:05:08 +02:00
parent cdd2c42129
commit f7d6e530b4
1 changed files with 5 additions and 3 deletions

View File

@ -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);
}