update
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user