In my iOS app I wan't to play sounds using OpenAL. I have AudioManager class, responsible for sound-management (singleton). All sound sources & buffers are initialized when it is created (on the first instance
call).
So to play sound all I need - is to stop previous sound, clear the old buffer (of necessary source), attach new buffer, set pitch & gain and finally, play the sound. All these operations are in playSound:(AMSound)sound
method (AMSound
is a simple enum).
For UI effects I call this method from main thread. But my app has a lot of background work, which is sometimes also accompanied by sound effects.
Can I call playSound:
directly from background threads or should Ido it on main thread only?
And what about simultaneous sounds: one created from main thread, another - from background?