[fuck] bigfix ta mere

This commit is contained in:
xdrm-brackets 2018-04-06 02:17:39 +02:00
parent 2682584e95
commit f6b17ccbd2
1 changed files with 8 additions and 9 deletions

View File

@ -69,7 +69,7 @@ export default class AudioManager{
// WILL BE DONE ON receive() // WILL BE DONE ON receive()
/* (1) Finally connect to OUTPUT */ /* (1) Finally connect to OUTPUT */
current_node.connect(this.gain); // current_node.connect(this.gain);
this.gain.connect(this.output); this.gain.connect(this.output);
} }
@ -94,14 +94,13 @@ export default class AudioManager{
/*DEBUG*///window.timer = new Date().getTime(); /*DEBUG*///window.timer = new Date().getTime();
let buf32 = new Float32Array(AudioManager.BUFFER_SIZE); let buf32 = new Float32Array(AudioManager.BUFFER_SIZE);
// _audioprocess.inputBuffer.copyFromChannel(buf32, 0);
_audioprocess.inputBuffer.copyFromChannel(buf32, 0); _audioprocess.inputBuffer.copyFromChannel(buf32, 0);
let buf16 = this.f32toi16(buf32); let buf16 = this.f32toi16(buf32);
if( this.ws && this.ws.readyState === 1 ) if( this.ws && this.ws.readyState === 1 ) console.log(`send buffer[${buf16.length}]`);
console.log(`send buffer[${buf16.length}]`); else console.log(`websocket not connected`);
else
console.log(`websocket not connected`);
this.ws && this.ws.send(buf16); this.ws && this.ws.send(buf16);
} }
@ -114,17 +113,18 @@ export default class AudioManager{
let buf32 = this.i16tof32(_buffer); let buf32 = this.i16tof32(_buffer);
/* (2) Create source node */ /* (2) Create source node */
this.network.in = this.ctx.createBufferSource(); let source = this.ctx.createBufferSource();
/* (3) Create buffer and dump data */ /* (3) Create buffer and dump data */
let input_buffer = this.ctx.createBuffer(1, AudioManager.BUFFER_SIZE, this.ctx.sampleRate); let input_buffer = this.ctx.createBuffer(1, AudioManager.BUFFER_SIZE, this.ctx.sampleRate);
input_buffer.getChannelData(0).set(buf32); input_buffer.getChannelData(0).set(buf32);
/* (4) Pass buffer to source node */ /* (4) Pass buffer to source node */
this.network.in.buffer = input_buffer; source.buffer = input_buffer;
/* (5) Connect and play audio */ /* (5) Connect and play audio */
this.network.in.connect(this.gain); source.connect(this.gain);
source.start(0);
} }
@ -188,7 +188,6 @@ export default class AudioManager{
/* (2) Manage websocket responses */ /* (2) Manage websocket responses */
this.ws.onmessage = function(_msg){ this.ws.onmessage = function(_msg){
console.warn(`received`, _msg.data);
if( !(_msg.data instanceof Blob) ) if( !(_msg.data instanceof Blob) )
return console.warn('[NaB] Not A Blob'); return console.warn('[NaB] Not A Blob');