aboutsummaryrefslogtreecommitdiff
path: root/webAO/viewport/utils/createBlipChannels.ts
blob: 9e9c96415adfd32c0087975e37a8ff27c9701831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
};