diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-10 11:09:49 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-10 11:09:49 -0400 |
| commit | 108636666d474119892c4b3a2f3beadb767b006e (patch) | |
| tree | 32bffa6a2cb8cc3aca3a6e3fd36ac6847561da53 /webAO/viewport/utils/createBlipChannels.ts | |
| parent | abba7630e13f7e5269c14c2c43b66b03559ddfe3 (diff) | |
Structured viewport a little differently
Diffstat (limited to 'webAO/viewport/utils/createBlipChannels.ts')
| -rw-r--r-- | webAO/viewport/utils/createBlipChannels.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/webAO/viewport/utils/createBlipChannels.ts b/webAO/viewport/utils/createBlipChannels.ts new file mode 100644 index 0000000..6296b3b --- /dev/null +++ b/webAO/viewport/utils/createBlipChannels.ts @@ -0,0 +1,15 @@ +import { opusCheck } from "../../dom/opusCheck"; + +export const createBlipsChannels = () => { + const blipSelectors = document.getElementsByClassName( + "blipSound" + ) as HTMLCollectionOf<HTMLAudioElement>; + + const blipChannels = [...blipSelectors]; + // Allocate multiple blip audio channels to make blips less jittery + blipChannels.forEach((channel: HTMLAudioElement) => (channel.volume = 0.5)); + blipChannels.forEach( + (channel: HTMLAudioElement) => (channel.onerror = opusCheck(channel)) + ); + return blipChannels; +};
\ No newline at end of file |
