@threlte/extras
useAudioListener
useAudioListener
is a hook that either returns an existing THREE.AudioListener
or allows
a callback to immediately operate on a THREE.AudioListener
instance in a callback passed
to the hook.
Retrieving an existing AudioListener
const { listener, context } = useAudioListener()
console.log(listener) // THREE.AudioListener
console.log(context) // AudioContext
Using an AudioListener in a callback
const filter = useAudioListener(({ listener, context }) => {
return context.createBiquadFilter()
})