const stopAllSounds = () => { store.sounds.forEach((sound, index) => { setStore("sounds", index, "status", "stopped") stopSound(sound.id) })}
export const [QuickSoundProvider, useStore] = createContextProvider(() => { return { store: store, setStore: setStore, addSound: () => addSound(), removeSound: (soundId) => removeSound(soundId), playSound: (soundId) => playSound(soundId), stopAllSounds: () => stopAllSounds(), setSoundVolume: (soundId, event) => setSoundVolume(soundId, event), setSearch: (value) => setSearch(value), getSounds: () => getSounds() }})
onChange={(event) => {customHandler(event.target.value)}}
const removeSound = async (soundId) => { const audioPlayer = getAudioPlayer(soundId) const status = getSelectedScene().sounds.find((sound) => sound.id === soundId).status; // Stop any audio players that are playing for this sound and remove them if (status == 'playing') { audioPlayer.stop() //!= how? delete audioPlayer } // Remove the sound from the scene setSelectedScene('sounds', (sound) => sound.id !== soundId)}
RangeError: Invalid array length