MCPcopy
hub / github.com/arc53/DocsGPT / stopAudioProcessing

Function stopAudioProcessing

frontend/src/components/MessageInput.tsx:352–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

350 };
351
352 const stopAudioProcessing = () => {
353 if (snapshotIntervalRef.current !== null) {
354 window.clearInterval(snapshotIntervalRef.current);
355 snapshotIntervalRef.current = null;
356 }
357
358 if (audioProcessorNodeRef.current) {
359 audioProcessorNodeRef.current.onaudioprocess = null;
360 audioProcessorNodeRef.current.disconnect();
361 audioProcessorNodeRef.current = null;
362 }
363 if (audioSourceNodeRef.current) {
364 audioSourceNodeRef.current.disconnect();
365 audioSourceNodeRef.current = null;
366 }
367 if (audioSilenceGainRef.current) {
368 audioSilenceGainRef.current.disconnect();
369 audioSilenceGainRef.current = null;
370 }
371 if (audioContextRef.current) {
372 void audioContextRef.current.close().catch(() => undefined);
373 audioContextRef.current = null;
374 }
375 stopMediaStream();
376 };
377
378 const resetLiveTranscriptionState = () => {
379 pcmChunksRef.current = [];

Callers 3

MessageInputFunction · 0.85
failLiveTranscriptionFunction · 0.85
handleVoiceInputFunction · 0.85

Calls 2

stopMediaStreamFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected