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

Method initializeAudioMixer

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

Source from the content-addressed store, hash-verified

565 }
566
567 private async initializeAudioMixer(): Promise<void> {
568 if (this.audioContext || !this.screenAudioStream || !this.microphoneStream) return;
569 Logger.info("StreamManager", "Initializing audio mixer for 'allAudio'.");
570 this.audioContext = new AudioContext();
571 const destination = this.audioContext.createMediaStreamDestination();
572 const screenSource = this.audioContext.createMediaStreamSource(this.screenAudioStream);
573 screenSource.connect(destination);
574 this.sourceNodes.set('screen', screenSource);
575 const micSource = this.audioContext.createMediaStreamSource(this.microphoneStream);
576 micSource.connect(destination);
577 this.sourceNodes.set('microphone', micSource);
578 this.allAudioStream = destination.stream;
579 // This now correctly starts transcription only when the mixer is initialized
580 await this.startTranscriptionForStream('allAudio', this.allAudioStream);
581 this.notifyListeners();
582 }
583
584 private checkForTeardown(): void {
585 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