fix: 회의 모드 녹음 개선
마이크 캡처 강제(시스템 오디오→마이크), CaptionOverlay 숨김, 오디오 레벨 인디케이터 추가, 상태 전환 꼬임 수정, 전사 타임스탬프 상대 시간 변환.
This commit is contained in:
parent
acab319589
commit
43a2acb89d
3 changed files with 73 additions and 6 deletions
|
|
@ -75,6 +75,9 @@ class MeetingModeService extends EventEmitter {
|
|||
private _segments: CaptionSegment[] = []
|
||||
private _memos: MeetingMemo[] = []
|
||||
private _segmentHandler: ((segment: CaptionSegment) => void) | null = null
|
||||
private _audioDataHandler: ((payload: { buffer: Buffer; timestamp: number }) => void) | null = null
|
||||
private _audioLevelTimer: ReturnType<typeof setInterval> | null = null
|
||||
private _lastRms = 0
|
||||
/** CaptionService session-saved 방지 플래그 */
|
||||
private _meetingModeActive = false
|
||||
|
||||
|
|
@ -148,9 +151,18 @@ class MeetingModeService extends EventEmitter {
|
|||
}
|
||||
captionService.on('segment', this._segmentHandler)
|
||||
|
||||
// 회의 모드는 마이크 캡처 강제 (시스템 오디오가 아닌 마이크)
|
||||
const prevAudioSource = captionService.getConfig().audioSource
|
||||
captionService.setConfig({ audioSource: 'mic' })
|
||||
|
||||
try {
|
||||
await captionService.start()
|
||||
// 회의 모드 UI가 자체 자막 패널에 표시하므로 오버레이 숨김
|
||||
const { hideCaptionOverlay } = await import('../windows/WindowManager')
|
||||
hideCaptionOverlay()
|
||||
} catch (err) {
|
||||
// 오디오 소스 복원
|
||||
captionService.setConfig({ audioSource: prevAudioSource })
|
||||
// 시작 실패 시 복원
|
||||
captionService.off('segment', this._segmentHandler)
|
||||
this._segmentHandler = null
|
||||
|
|
@ -168,6 +180,18 @@ class MeetingModeService extends EventEmitter {
|
|||
throw err
|
||||
}
|
||||
|
||||
// 오디오 레벨 모니터링 시작
|
||||
const { getAudioCaptureService, calculateRMS } = await import('./AudioCaptureService')
|
||||
const audioCaptureService = getAudioCaptureService()
|
||||
this._audioDataHandler = (payload: { buffer: Buffer; timestamp: number }) => {
|
||||
this._lastRms = calculateRMS(payload.buffer)
|
||||
}
|
||||
audioCaptureService.on('audio-data', this._audioDataHandler)
|
||||
|
||||
this._audioLevelTimer = setInterval(() => {
|
||||
this._sendToRenderer('meetingMode:audioLevel', { level: this._lastRms })
|
||||
}, 100)
|
||||
|
||||
logger.info(`회의 녹음 시작: sessionId=${sessionId}`)
|
||||
this._sendStateToRenderer()
|
||||
|
||||
|
|
@ -217,6 +241,17 @@ class MeetingModeService extends EventEmitter {
|
|||
const sessionId = this._sessionId!
|
||||
const now = Date.now()
|
||||
|
||||
// 오디오 레벨 모니터링 정리
|
||||
if (this._audioLevelTimer) {
|
||||
clearInterval(this._audioLevelTimer)
|
||||
this._audioLevelTimer = null
|
||||
}
|
||||
if (this._audioDataHandler) {
|
||||
const { getAudioCaptureService } = await import('./AudioCaptureService')
|
||||
getAudioCaptureService().off('audio-data', this._audioDataHandler)
|
||||
this._audioDataHandler = null
|
||||
}
|
||||
|
||||
// CaptionService 종료
|
||||
const { getCaptionService } = await import('./CaptionService')
|
||||
const captionService = getCaptionService()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue