diff --git a/gemini/multimodal-live-api/websocket-demo-app/frontend/pcm-processor.js b/gemini/multimodal-live-api/websocket-demo-app/frontend/pcm-processor.js index e5ff359a46..4c81f04719 100644 --- a/gemini/multimodal-live-api/websocket-demo-app/frontend/pcm-processor.js +++ b/gemini/multimodal-live-api/websocket-demo-app/frontend/pcm-processor.js @@ -1,13 +1,13 @@ +/** + * @class PCMProcessor + * @extends AudioWorkletProcessor + * @description Processes PCM audio data in a Web Audio API context + */ class PCMProcessor extends AudioWorkletProcessor { constructor() { super(); this.buffer = new Float32Array(); -/** - * @class PCMProcessor - * @extends AudioWorkletProcessor - * @description Processes PCM audio data. - */ this.port.onmessage = (e) => { const newData = e.data; const newBuffer = new Float32Array(this.buffer.length + newData.length); @@ -15,12 +15,6 @@ class PCMProcessor extends AudioWorkletProcessor { newBuffer.set(newData, this.buffer.length); this.buffer = newBuffer; }; - const newData = e.data; - const newBuffer = new Float32Array(this.buffer.length + newData.length); - newBuffer.set(this.buffer); - newBuffer.set(newData, this.buffer.length); - this.buffer = newBuffer; - }; } process(inputs, outputs, parameters) {