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
|
<Button
|
||||||
variant={micTesting ? 'contained' : 'outlined'}
|
variant={micTesting ? 'contained' : 'outlined'}
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
if (micTesting) {
|
if (micTesting) {
|
||||||
setMicTesting(false)
|
setMicTesting(false)
|
||||||
setMicLevel(0)
|
setMicLevel(0)
|
||||||
} else {
|
} else {
|
||||||
setMicTesting(true)
|
setMicTesting(true)
|
||||||
const unsub = window.electronAPI.voice.onAudioLevel((e) => {
|
setMicLevel(0.05)
|
||||||
setMicLevel(e.level)
|
const resp = await window.electronAPI.audio.testDevice({ deviceId: 'default' })
|
||||||
})
|
if (resp.success) {
|
||||||
setTimeout(() => {
|
setMicLevel(resp.data.averageLevel)
|
||||||
|
setTimeout(() => {
|
||||||
|
setMicTesting(false)
|
||||||
|
setMicLevel(0)
|
||||||
|
}, 3000)
|
||||||
|
} else {
|
||||||
setMicTesting(false)
|
setMicTesting(false)
|
||||||
setMicLevel(0)
|
setMicLevel(0)
|
||||||
unsub()
|
}
|
||||||
}, 5000)
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
sx={{ fontFamily: d3roFontMono, fontSize: '11px', minWidth: 80 }}
|
sx={{ fontFamily: d3roFontMono, fontSize: '11px', minWidth: 80 }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue