()
| 126 | private audioBuffer: AudioBuffer | null = null; |
| 127 | |
| 128 | async initialize() { |
| 129 | if (this.audioContext) return; |
| 130 | |
| 131 | try { |
| 132 | this.audioContext = new (window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext)(); |
| 133 | const response = await fetch('/hoverfx2.mp3'); |
| 134 | const arrayBuffer = await response.arrayBuffer(); |
| 135 | this.audioBuffer = await this.audioContext.decodeAudioData(arrayBuffer); |
| 136 | } catch (e) { |
| 137 | console.warn('Failed to initialize sound:', e); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | play(volume: number = 0.035, pitch: number = 0.8) { |
| 142 | if (!this.audioContext || !this.audioBuffer) return; |
no outgoing calls
no test coverage detected