added debug
This commit is contained in:
parent
05eb18d0ad
commit
0b3d093cb2
|
@ -41,12 +41,15 @@ export default class AudioManager{
|
||||||
if( self.ws.readyState !== 1 ) // not connected -> stack
|
if( self.ws.readyState !== 1 ) // not connected -> stack
|
||||||
return self._ws.stack.push(_data);
|
return self._ws.stack.push(_data);
|
||||||
|
|
||||||
|
console.warn(`send buffer[${_data.length}]`);
|
||||||
self.ws.send(_data);
|
self.ws.send(_data);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (9) Manage websocket message stack */
|
/* (9) Manage websocket message stack */
|
||||||
this.ws.onopen = function(){
|
this.ws.onopen = function(){
|
||||||
|
console.warn(`pop stack of size ${this._ws.stack.length}`);
|
||||||
|
|
||||||
while( this._ws.stack.length > 0 )
|
while( this._ws.stack.length > 0 )
|
||||||
this.ws.send(this._ws.stack.shift());
|
this.ws.send(this._ws.stack.shift());
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -54,6 +57,7 @@ export default class AudioManager{
|
||||||
|
|
||||||
/* (10) Manage websocket responses */
|
/* (10) Manage websocket responses */
|
||||||
this.ws.onmessage = function(_blob){
|
this.ws.onmessage = function(_blob){
|
||||||
|
console.warn(`received`, _blob);
|
||||||
|
|
||||||
if( !(_blob instanceof Blob) )
|
if( !(_blob instanceof Blob) )
|
||||||
return console.warn('NIQUE');
|
return console.warn('NIQUE');
|
||||||
|
@ -117,7 +121,6 @@ export default class AudioManager{
|
||||||
bindRecorderStream(_stream){
|
bindRecorderStream(_stream){
|
||||||
|
|
||||||
/* (1) Bind audio stream */
|
/* (1) Bind audio stream */
|
||||||
console.warn(_stream);
|
|
||||||
this.input = this.ctx.createMediaStreamSource(_stream);
|
this.input = this.ctx.createMediaStreamSource(_stream);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,12 +138,15 @@ export default class AudioManager{
|
||||||
|
|
||||||
let buf16 = this.f32toi16(buf32);
|
let buf16 = this.f32toi16(buf32);
|
||||||
|
|
||||||
|
console.log(`read buffer[${buf16.length}]`);
|
||||||
this._ws.send(buf16);
|
this._ws.send(buf16);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
receive(_buffer){
|
receive(_buffer){
|
||||||
|
|
||||||
|
console.log(`play buffer[${_buffer.length}]`);
|
||||||
|
|
||||||
/* (1) Convert to Float32Array */
|
/* (1) Convert to Float32Array */
|
||||||
let buf32 = this.i16tof32(_buffer);
|
let buf32 = this.i16tof32(_buffer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue