| |
| |
| |
| |
|
|
| |
| |
| |
| |
| export function playAnalysisCompleteSound(): void { |
| try { |
| |
| const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)(); |
| |
| |
| const oscillator = audioContext.createOscillator(); |
| const gainNode = audioContext.createGain(); |
| |
| |
| oscillator.connect(gainNode); |
| gainNode.connect(audioContext.destination); |
| |
| |
| oscillator.frequency.setValueAtTime(600, audioContext.currentTime); |
| oscillator.frequency.setValueAtTime(900, audioContext.currentTime + 0.15); |
| |
| |
| oscillator.type = 'sine'; |
| |
| |
| gainNode.gain.setValueAtTime(0, audioContext.currentTime); |
| gainNode.gain.linearRampToValueAtTime(0.3, audioContext.currentTime + 0.01); |
| gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.3); |
| |
| |
| oscillator.start(audioContext.currentTime); |
| oscillator.stop(audioContext.currentTime + 0.3); |
| |
| |
| oscillator.onended = () => { |
| audioContext.close(); |
| }; |
| } catch (error) { |
| |
| |
| console.debug('无法播放提示音:', error); |
| } |
| } |
|
|
|
|