오디오 디바이스: Win32_SoundDevice → AudioEndpoint로 변경 (실제 마이크/스피커 엔드포인트)

This commit is contained in:
Yun Chan 2026-04-05 12:32:37 +09:00
parent 74e027d058
commit 9dbf5c2a08

View file

@ -226,9 +226,11 @@ class AudioCaptureService extends EventEmitter {
] ]
try { try {
// PowerShell로 Windows 오디오 입력 디바이스 열거 // PowerShell로 Windows 오디오 입력(마이크) 엔드포인트 열거
// Get-PnpDevice -Class AudioEndpoint: 실제 오디오 엔드포인트 (마이크/스피커)
// MediaCategory가 'Capture' 또는 FriendlyName에 마이크 관련 키워드 포함
const { execSync } = await import('child_process') const { execSync } = await import('child_process')
const psCommand = `[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-CimInstance Win32_SoundDevice | Where-Object { $_.StatusInfo -eq 3 } | Select-Object -Property DeviceID, Name | ConvertTo-Json -Compress` const psCommand = `[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-PnpDevice -Class AudioEndpoint -Status OK | Select-Object InstanceId, FriendlyName | ConvertTo-Json -Compress`
const output = execSync(`powershell -NoProfile -Command "${psCommand}"`, { const output = execSync(`powershell -NoProfile -Command "${psCommand}"`, {
encoding: 'utf8', encoding: 'utf8',
timeout: 5000, timeout: 5000,
@ -239,11 +241,11 @@ class AudioCaptureService extends EventEmitter {
const parsed: unknown = JSON.parse(output.startsWith('[') ? output : `[${output}]`) const parsed: unknown = JSON.parse(output.startsWith('[') ? output : `[${output}]`)
if (Array.isArray(parsed)) { if (Array.isArray(parsed)) {
for (const dev of parsed) { for (const dev of parsed) {
const d = dev as { DeviceID?: string; Name?: string } const d = dev as { InstanceId?: string; FriendlyName?: string }
if (d.DeviceID && d.Name) { if (d.InstanceId && d.FriendlyName) {
devices.push({ devices.push({
deviceId: d.DeviceID, deviceId: d.FriendlyName, // SoX -t waveaudio는 이름으로 매칭
label: d.Name, label: d.FriendlyName,
isDefault: false, isDefault: false,
}) })
} }