Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

532 B
Raw Blame
// ©AngelaMos | 2026
// audio.ts

import { create } from 'zustand'

interface AudioStore {
  ctx: AudioContext | null
  buffer: AudioBuffer | null
  unlocked: boolean
  setCtx: (ctx: AudioContext | null) => void
  setBuffer: (b: AudioBuffer | null) => void
  setUnlocked: (u: boolean) => void
}

export const useAudioStore = create<AudioStore>((set) => ({
  ctx: null,
  buffer: null,
  unlocked: false,
  setCtx: (ctx) => set({ ctx }),
  setBuffer: (buffer) => set({ buffer }),
  setUnlocked: (unlocked) => set({ unlocked }),
}))