blob: 57bc131853ddc0cb816cbc1cc82c1130c2c5d244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
let initialized = false;
let ctx = null;
let voiceTracks = null;
function initializeCtx() {
if (!initialized) {
try {
initialized = true;
ctx = new window.AudioContext();
voiceTracks = [
document.getElementById("lcolonq-pubnix-index-audio-voice-0"),
document.getElementById("lcolonq-pubnix-index-audio-voice-1"),
document.getElementById("lcolonq-pubnix-index-audio-voice-2"),
document.getElementById("lcolonq-pubnix-index-audio-voice-3"),
document.getElementById("lcolonq-pubnix-index-audio-voice-4"),
document.getElementById("lcolonq-pubnix-index-audio-voice-5"),
document.getElementById("lcolonq-pubnix-index-audio-voice-6"),
];
} catch (e) {
initialized = false;
}
}
}
export const _playVoice = (b) => (i) => () => {
if (b) initializeCtx();
try {
if (initialized) voiceTracks[i].play();
} catch (e) {}
};
|