[lib.audio-manager] added stack max size

This commit is contained in:
xdrm-brackets 2018-04-09 19:21:26 +02:00
parent a06e9c1789
commit 7d767343d6
1 changed files with 6 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export default class AudioManager{
/* (7) Initialise coordinator to manage received */
this.stack = [];
this.stack_save = 0;
this.stack_size = 10;
@ -261,7 +261,11 @@ export default class AudioManager{
this.ws.send(buf16);
/* (6) Read input buffer */
this.stack.shift().start(this.ctx.currentTime);
this.stack.length > 0 && this.stack.shift().start(this.ctx.currentTime);
/* (7) Pop stack if exceeded */
this.stack.length > this.stack_size && this.stack.pop();