Phase 1+2 구현: Electron 뼈대 + STT/핫키/오케스트레이터
Phase 1: - 프로젝트 초기화 (TypeScript strict, electron-vite, ESLint, Prettier) - shared 타입 (ipc-channels 113채널, types, errors, constants) - 메인 프로세스 뼈대 (bootstrap, lifecycle, 단일 인스턴스) - LoggerService, ConfigService (electron-store ESM dynamic import) - React 19 + MUI 7 Dashboard, 시스템 트레이 Phase 2: - AudioCaptureService (node-record-lpcm16, PCM16 16kHz mono) - HotkeyService (uiohook-napi, 더블프레스, holdMode/toggleMode) - LocalSTTService (faster-whisper Python sidecar, 이중 조건 플러시) - VoiceModeService 오케스트레이터 (이중 상태머신, Action Queue) - Python sidecar (FastAPI: health/load/transcribe/shutdown) - IPC 핸들러 (voice, stt, hotkey) + Preload API 확장
This commit is contained in:
parent
e24bb8378c
commit
1d152d01a1
46 changed files with 10828 additions and 4 deletions
37
src/main/ipc/audio-handlers.ts
Normal file
37
src/main/ipc/audio-handlers.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// src/main/ipc/audio-handlers.ts
|
||||
|
||||
import { ipcMain } from 'electron'
|
||||
import { IPC_CHANNELS } from '@shared/ipc-channels'
|
||||
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
|
||||
import { getAudioCaptureService } from '../services/AudioCaptureService'
|
||||
import { configGet, configSet } from '../services/ConfigService'
|
||||
import type { SetDeviceParams } from '@shared/types'
|
||||
|
||||
export function registerAudioHandlers(): void {
|
||||
ipcMain.handle(IPC_CHANNELS.AUDIO.GET_DEVICES, async () => {
|
||||
try {
|
||||
const devices = await getAudioCaptureService().getDevices()
|
||||
return ipcSuccess(devices)
|
||||
} catch {
|
||||
return ipcError(ErrorCode.AudioDeviceNotFound, 'Failed to enumerate audio devices')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.AUDIO.GET_SELECTED_DEVICE, async () => {
|
||||
return ipcSuccess(configGet('selectedDeviceId'))
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.AUDIO.SET_SELECTED_DEVICE, async (_event, params: SetDeviceParams) => {
|
||||
try {
|
||||
configSet('selectedDeviceId', params.deviceId)
|
||||
return ipcSuccess(undefined)
|
||||
} catch {
|
||||
return ipcError(ErrorCode.AudioDeviceNotFound, 'Failed to set device')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.AUDIO.TEST_DEVICE, async () => {
|
||||
// Phase 1: 스텁
|
||||
return ipcSuccess({ averageLevel: 0, peakLevel: 0, hasAudio: false })
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue