()
| 22 | let audioNapiPromise: Promise<AudioNapi> | null = null |
| 23 | |
| 24 | function loadAudioNapi(): Promise<AudioNapi> { |
| 25 | audioNapiPromise ??= (async () => { |
| 26 | const t0 = Date.now() |
| 27 | const mod = await import('audio-capture-napi') |
| 28 | // vendor/audio-capture-src/index.ts defers require(...node) until the |
| 29 | // first function call — trigger it here so timing reflects real cost. |
| 30 | mod.isNativeAudioAvailable() |
| 31 | audioNapi = mod |
| 32 | logForDebugging(`[voice] audio-capture-napi loaded in ${Date.now() - t0}ms`) |
| 33 | return mod |
| 34 | })() |
| 35 | return audioNapiPromise |
| 36 | } |
| 37 | |
| 38 | // ─── Constants ─────────────────────────────────────────────────────── |
| 39 |
no test coverage detected