diff --git a/src/classes/VoiceSession.ts b/src/classes/VoiceSession.ts index 8867004..5f3b6f1 100644 --- a/src/classes/VoiceSession.ts +++ b/src/classes/VoiceSession.ts @@ -60,6 +60,13 @@ export class VoiceSession { }, this.endTimeMs); } + /** + * 새 TTS가 들어오면 이전 재생을 의도적으로 interrupt한다 (큐잉 없음). + * 다중 사용자 환경에서 모든 메시지를 큐로 쌓으면 자기 발화가 수십 초 + * 밀려 채팅 맥락과 어긋나므로, "최신 발화 우선, 앞건 잘림"을 정책으로 + * 채택했다. generation 카운터는 같은 메시지에 대해 한 번만 play 되도록 + * 보호하는 용도이고, 이전 mp3가 잘리는 동작 자체는 설계 의도이다. + */ public async play(mp3Buf: Buffer) { if (this.isSessionEnd) return; const myGen = ++this.generation;