오디오 소스 선택 기능 추가

- AudioCaptureService.getDevices(): PowerShell로 Windows 오디오 디바이스 열거
- SettingsModal 오디오 탭: 마이크 선택 드롭다운 (기본 + 감지된 디바이스)
- 선택 변경 시 ConfigService에 저장 → 다음 녹음 시 적용
This commit is contained in:
Yun Chan 2026-04-05 10:05:47 +09:00
parent 48582e46ec
commit 438aa1de6c
2 changed files with 72 additions and 13 deletions

View file

@ -227,15 +227,40 @@ class AudioCaptureService extends EventEmitter {
}
async getDevices(): Promise<AudioDevice[]> {
// 현재 Phase에서는 기본 디바이스만 반환. 실제 디바이스 열거는 추후.
logger.debug('Getting audio devices (default only)')
return [
{
deviceId: 'default',
label: 'Default Microphone',
isDefault: true
}
const devices: AudioDevice[] = [
{ deviceId: 'default', label: '시스템 기본 마이크', isDefault: true },
]
try {
// PowerShell로 Windows 오디오 입력 디바이스 열거
const { execSync } = await import('child_process')
const psCommand = `Get-CimInstance Win32_SoundDevice | Where-Object { $_.StatusInfo -eq 3 } | Select-Object -Property DeviceID, Name | ConvertTo-Json -Compress`
const output = execSync(`powershell -NoProfile -Command "${psCommand}"`, {
encoding: 'utf8',
timeout: 5000,
}).trim()
if (output) {
const parsed: unknown = JSON.parse(output.startsWith('[') ? output : `[${output}]`)
if (Array.isArray(parsed)) {
for (const dev of parsed) {
const d = dev as { DeviceID?: string; Name?: string }
if (d.DeviceID && d.Name) {
devices.push({
deviceId: d.DeviceID,
label: d.Name,
isDefault: false,
})
}
}
}
}
} catch (err) {
logger.warn(`Failed to enumerate audio devices via PowerShell: ${err instanceof Error ? err.message : String(err)}`)
}
logger.debug(`Found ${devices.length} audio device(s)`)
return devices
}
getCurrentDevice(): AudioDevice | null {