MacOS sometimes report OpenAL errors, and sound stops working, after a while.
There might be other issues, but one consistently reproducible one was reported by @Langbart, and the underlying cause appears to be that:
- we don't properly clean up some sounds
- MacOS has a max 'in-flight' buffer limit of 1000, and streaming data use 50 buffers at a time (e.g. music/ambient).
The problem is that sounds can end up paused / in initial state while also being in 'last play', but the deletion code only checks for "STOPPED". This fixes that.
Seems to work for the reproduction by langbart, can't confirm that it removes all cases of OpenAL errors.
Reported by: Eszett
Thanks langbart for the consistent repro'.