[lib.audio-manager] fixed routing

This commit is contained in:
xdrm-brackets 2018-04-06 12:57:22 +02:00
parent 854adb244d
commit f3a62a0a6d
1 changed files with 14 additions and 10 deletions

View File

@ -37,19 +37,19 @@ export default class AudioManager{
voice_sss: this.ctx.createBiquadFilter()
};
/* (3) Set up our filters' parameters */
this.setUpFilters();
/* (4) Create network I/O controller (WebSocket) */
/* (3) Create network I/O controller (WebSocket) */
this.network = {
out: this.ctx.createScriptProcessor(AudioManager.BUFFER_SIZE, 1, 1)
};
/* (4) Initialise websocket */
this.ws = null;
/* (5) Bind network controller to send() function */
this.network.out.onaudioprocess = this.send.bind(this);
/* (6) Initialise websocket */
this.ws = null;
/* (6) Set up our filters' parameters */
this.setUpFilters();
@ -133,8 +133,8 @@ export default class AudioManager{
/* (3) Connect presence reduction to 'ss' removal */
this.filters.voice_presence.connect( this.filters.voice_sss );
/* (4) Connect last filter to MASTER gain */
this.filters.voice_sss.connect(this.master);
/* (4) Connect last filter to NETWORK output */
this.filters.voice_sss.connect(this.network.out);
}
@ -152,9 +152,9 @@ export default class AudioManager{
/* (2) Get first filter */
let first_filter = this.filters.voice_clarity;
/* (3) If unlink -> connect directly to MASTER gain */
/* (3) If unlink -> connect directly to NETWORK output */
if( unlink === true )
return this.input.connect(this.master);
return this.input.connect(this.network.out);
/* (4) If linking -> connect input to filter stack */
this.input.connect(first_filter);
@ -191,6 +191,10 @@ export default class AudioManager{
let buf16 = this.f32toi16(buf32);
// exit if no connection
if( this.ws === null || this.ws.readyState !== 1 )
return;
this.ws.send(buf16);
this.dbg.data.packets_sent++;