[openal] OpenALSoft on Android, how to handle suspend/resume of application

Olle Hedman olle at illusionlabs.se
Thu Aug 30 09:57:46 EDT 2018


Hello!

We have been using OpenALSoft for some time now to port our games
soundsystem (initially written for iOS) to Android.

Originally we used an old heavily patched version (I don't really know what
version it was based on), but fairly recently I decided to migrate to a
version based on 1.18.2, and reduce our patches to a minimum, and keep them
organised with git. It mostly works great, and was much more convenient to
build and include in my project without much work. Currently we use this
version for Android, iOS and OSX.

We still have a few additions, but those should not affect my current
issue. (The addition is switching of backend in runtime, and driving the
wave mixing manually, so I can switch to wave backend and use it to
temporary record sound to file, for replay video generation, this part
works great on iOS and is already live in our latest game. There's also a
few minor patches to compile for iOS)

But at least one thing does not work for me anymore on Android, and that is
suspending and resuming. (when application goes into background and comes
back again). The problem is the mixing thread is still running and
outputting (very choppy) sound for all our looping sound effects while the
app is in background...

How am I supposed to handle this? Destroying and recreating the context is
very inconvenient since the suspend can happen at any time and we want
everything to restart playing exactly where suspended when we resume again.

In my old version of OpenALSoft, I had added some code that pauses the
mixing thread on android when I call alcSuspendContext, and restarts it
again on alcProcessContext (and call these when the app suspends/resume),
and this works just as I want it to.

Do you have any advice for how I should handle suspend/resume on Android?
If not, I could re-add the thread suspension in our own fork.

Also, let me know if you are interested in knowing more about any of our
other patches.

-- 

*Best regards,*
*Olof Hedman*

Mobile:

+46 (0)708 - 42 28 76
Office:

+46 (0)40 - 644 44 95
Web:

www.illusionlabs.com
Twitter:

twitter.com/illusionlabs

Illusion Labs AB
Kalendegatan 25
SE-211 35 Malmö, Sweden


"The information in this e-mail, and attachment(s) thereto, is strictly
confidential and may be legally privileged. It is intended solely for the
named recipient(s), and access to this e-mail, or any attachment(s)
thereto, by anyone else is unauthorized. If you are not the intended
recipient please inform the sender by replying to this transmission, and
delete the e-mail, its attachment(s), and any copies of it, without
disclosing it."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openal.org/pipermail/openal/attachments/20180830/a9672912/attachment.html>


More information about the openal mailing list