오디오 디바이스: Win32_SoundDevice → AudioEndpoint로 변경 (실제 마이크/스피커 엔드포인트)
This commit is contained in:
parent
74e027d058
commit
9dbf5c2a08
1 changed files with 8 additions and 6 deletions
|
|
@ -226,9 +226,11 @@ class AudioCaptureService extends EventEmitter {
|
|||
]
|
||||
|
||||
try {
|
||||
// PowerShell로 Windows 오디오 입력 디바이스 열거
|
||||
// PowerShell로 Windows 오디오 입력(마이크) 엔드포인트 열거
|
||||
// Get-PnpDevice -Class AudioEndpoint: 실제 오디오 엔드포인트 (마이크/스피커)
|
||||
// MediaCategory가 'Capture' 또는 FriendlyName에 마이크 관련 키워드 포함
|
||||
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}"`, {
|
||||
encoding: 'utf8',
|
||||
timeout: 5000,
|
||||
|
|
@ -239,11 +241,11 @@ class AudioCaptureService extends EventEmitter {
|
|||
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) {
|
||||
const d = dev as { InstanceId?: string; FriendlyName?: string }
|
||||
if (d.InstanceId && d.FriendlyName) {
|
||||
devices.push({
|
||||
deviceId: d.DeviceID,
|
||||
label: d.Name,
|
||||
deviceId: d.FriendlyName, // SoX -t waveaudio는 이름으로 매칭
|
||||
label: d.FriendlyName,
|
||||
isDefault: false,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue