MCPcopy Create free account
hub / github.com/Roy3838/Observer / initializeAudioMixer

Method initializeAudioMixer

app/src/utils/streamManager.ts:580–595  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

578 }
579
580 private async initializeAudioMixer(): Promise<void> {
581 if (this.audioContext || !this.screenAudioStream || !this.microphoneStream) return;
582 Logger.info("StreamManager", "Initializing audio mixer for 'allAudio'.");
583 this.audioContext = new AudioContext();
584 const destination = this.audioContext.createMediaStreamDestination();
585 const screenSource = this.audioContext.createMediaStreamSource(this.screenAudioStream);
586 screenSource.connect(destination);
587 this.sourceNodes.set('screen', screenSource);
588 const micSource = this.audioContext.createMediaStreamSource(this.microphoneStream);
589 micSource.connect(destination);
590 this.sourceNodes.set('microphone', micSource);
591 this.allAudioStream = destination.stream;
592 // This now correctly starts transcription only when the mixer is initialized
593 await this.startTranscriptionForStream('allAudio', this.allAudioStream);
594 this.notifyListeners();
595 }
596
597 private checkForTeardown(): void {
598 const isUsed = (type: PseudoStreamType) => (this.userSets.get(type)?.size || 0) > 0;

Callers 1

Calls 3

notifyListenersMethod · 0.95
infoMethod · 0.80

Tested by

no test coverage detected