I have a short audio file I am looping–it is a fairly continuous waveform so there is not supposed to be any perceptible break in the playback while looping. The file loops well on my mac native build, but when I run it on iOS there is a very noticeable click sound that plays each time it loops. It’s the kind of sound that would be expected on an imperfect loop, but since the file loops properly on mac I do not think it’s an issue with my audio file.
I’ve tried switching the format of the file (ogg, wav), but that doesn’t seem to make a difference. Has anyone else run into this problem?
Running on openfl 4.4.1, lime 3.4.1.
Could you try upgrading, and see if it works better? Thanks
Just finished upgrading to 4.5.0 and 3.5.0, and I don’t notice any improvement in the issue. It’s a very noticeable click on each loop.
Is this issue relevant? Currently onComplete event is invoked with timers, but I thought that we could query source state from OpenAL.
Or we need to implement real sound loop that uses OpenAL’s queuing mechanism. Current implementation just plays sound again when an audio source finishes playing, which isn’t very accurate.
I think the queuing mechanism is ideal–it seems like there’s a good chance that even an improvement on the timer solution would still result in an audible click or in a perceptible break between the loop ending and starting again. Of course I say that having no idea how much effort it would be to use OpenAL’s mechanism.
It may be that iOS works differently since it uses an Apple OpenAL library rather than OpenAL-Soft
I’m afraid polling constantly may be too expensive?
Is that really expensive? Why do you think so? Timer checks if every frame specified time has elapsed, so it’s not very cheaper than polling every frame.
I finally got around to revisiting the problem I was having here, and came up with a solution that uses OpenAL looping instead of the current timer based mechanism for native platforms. This has fixed the glitching sound for me on iPhone.
Here’s the change I made (I also added the ability to set loops to = -1 to loop indefinitely, which required a slight change to openfl.media.Sound as well):