[lib.audio-manager] added stack max size
This commit is contained in:
parent
a06e9c1789
commit
7d767343d6
|
@ -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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue