diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-09-10 17:19:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-10 17:19:52 +0200 |
| commit | 657d2944135a80cda846b14ddbccd055c5b45896 (patch) | |
| tree | 32bffa6a2cb8cc3aca3a6e3fd36ac6847561da53 /webAO/viewport/utils/createBlipChannels.ts | |
| parent | abba7630e13f7e5269c14c2c43b66b03559ddfe3 (diff) | |
| parent | 108636666d474119892c4b3a2f3beadb767b006e (diff) | |
Merge pull request #174 from caleb-mabry/viewport-movement
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 |
