OpenAL source continues playback after stopping and deleting

In our ipad application, there are many OpenAL sources at the same time, one for each current touch. Sources are created and triggered by touch Modulated and stop when touched Excluded or touched Cancel.

Everything seems to work fine, except for the error when sometimes one source seems to continue to play after the sense of touch ends. This seems to only happen when many sensory events are generated.

I checked that when this happens, all my AL sources were stopped using alSourceStop and were destroyed using alDeleteSources. OpenAL does not report any error. But the sound does not stop.

I'm starting to think that this may be a mistake in the iOS implementation of OpenAL. Has anyone seen something like this?

+6
source share
3 answers

I have the same OpenAL problem with the new reverb features included on iPad 2 and iOS 5. I can fully confirm that the Play / Stop commands for the same sound are paired and the problem occurs even if you do not reuse the sources . The stop delay does not help, nor does it track the state transition to the spawned thread from the GCD. I don’t know how to do this, but I thought I would go through my observations while debugging this problem.

+2
source

Touch [Moved | Finished] are triggered when one or MORE fingers move or touch the end. iOS? It has? had a hard limit of 5 fingers more than that, and the events seemed a little disgusting. If you are faced with this limitation, you may need to rethink your implementation.

Since you are not giving any implementation details, it is hard to imagine what error your code may have. I do not know how you check if all your AL sources are stopped. Perhaps you should increase the global variable when you start the source and decrease it when you stop the source, then check the variable and make sure it is 0 (IMHO, you will probably see that it is> 0). The maximum limit for iOS is 32, but you said you didn't get openAL errors ... so you probably won't notice this.

0
source

You may find the following solution helpful. I am experiencing the same problem with my application, and so far the best solution I have found is simply to create an open source of silence (a source with a silence buffer, that is - full of zeros), and play it always after I stopped the sound .

This seems to fix the problem of sounds that continue to play even after the stop command, although sometimes it introduces a small 'click'. In any case, I found that a small 'click' is more tolerant than the sound continues when it needs to be stopped ...

Hope this helps someone out there!

0
source

Source: https://habr.com/ru/post/896168/


All Articles