lovr
lovr copied to clipboard
lovr.audio.setGeometry with phonon is kinda slow
When you call lovr.audio.setGeometry to set up an audio mesh with phonon, it can take a few hundred milliseconds. It also takes out a lock to prevent the audio thread from running during this time. This works okay if you have 1 mesh that you set up during lovr.load, but blocking both the main and audio threads for this long at runtime is unacceptable. It's somewhat common to have games with multiple rooms/levels, so we need a better way to switch between audio meshes.
Exploring:
- Stop taking out a lock for the duration of setGeometry and instead make the locking more fine grained. For phonon, we can easily create a new audio mesh while the old one is still being used, and take out a lock only to swap them out. This would allow setGeometry to get called on a thread.
- An AudioMesh object. Create a bunch of these meshes at startup or on threads and switch between them quickly. This could also pave the way towards having multiple audio meshes or dynamic audio meshes that can be repositioned.
I wonder if phonon's refcounting can help here.