Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lovr.audio.setGeometry with phonon is kinda slow #406

Open
bjornbytes opened this issue Apr 12, 2021 · 1 comment
Open

lovr.audio.setGeometry with phonon is kinda slow #406

bjornbytes opened this issue Apr 12, 2021 · 1 comment

Comments

@bjornbytes
Copy link
Owner

bjornbytes commented Apr 12, 2021

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.
@bjornbytes
Copy link
Owner Author

I wonder if phonon's refcounting can help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant