fix: 설정 오디오 테스트 버튼 실제 동작 연결
voice.onAudioLevel 구독(실제 캡처 없음) → audio.testDevice 호출로 변경. 2초 캡처 후 실제 RMS 레벨을 레벨 바에 표시.
This commit is contained in:
parent
fa73ad3bb2
commit
7a925bdeb9
1 changed files with 11 additions and 7 deletions
|
|
@ -533,20 +533,24 @@ export function SettingsModal({ open, onClose }: SettingsModalProps): React.Reac
|
|||
<Button
|
||||
variant={micTesting ? 'contained' : 'outlined'}
|
||||
size="small"
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
if (micTesting) {
|
||||
setMicTesting(false)
|
||||
setMicLevel(0)
|
||||
} else {
|
||||
setMicTesting(true)
|
||||
const unsub = window.electronAPI.voice.onAudioLevel((e) => {
|
||||
setMicLevel(e.level)
|
||||
})
|
||||
setMicLevel(0.05)
|
||||
const resp = await window.electronAPI.audio.testDevice({ deviceId: 'default' })
|
||||
if (resp.success) {
|
||||
setMicLevel(resp.data.averageLevel)
|
||||
setTimeout(() => {
|
||||
setMicTesting(false)
|
||||
setMicLevel(0)
|
||||
unsub()
|
||||
}, 5000)
|
||||
}, 3000)
|
||||
} else {
|
||||
setMicTesting(false)
|
||||
setMicLevel(0)
|
||||
}
|
||||
}
|
||||
}}
|
||||
sx={{ fontFamily: d3roFontMono, fontSize: '11px', minWidth: 80 }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue