This commit is contained in:
2026-02-11 07:05:20 +06:00
parent 1bd8aa0fea
commit 363f1008c6
16 changed files with 397 additions and 75 deletions

View File

@@ -25,7 +25,10 @@ const EVENT_VOLUME: Record<SfxEvent, number> = {
'connection': 0.1,
}
// TODO: refactor this shit
export const useSfx = createSharedComposable(() => {
const { outputMuted } = useApp()
async function play(src: string, volume = 0.2): Promise<void> {
return new Promise((resolve) => {
const howl = new Howl({
@@ -74,6 +77,10 @@ export const useSfx = createSharedComposable(() => {
async function playRandomConnectionSound(seed: string) {
await playEvent('stream-on')
if (outputMuted.value)
return
await play(CONNECTION_SOUNDS[hashStringToNumber(seed, CONNECTION_SOUNDS.length)]!, 0.1)
}