I want to play some sound effects while animating an UI element (e.g. playing a movement sound while an UI object is moving), which requires precise timing and synchronization.
I really can’t figure out which framework I should be using from the descriptions in the Multimedia Programming Guide. So I need your kind help in choosing one.
What I want to do is:
- Play short (max 10 seconds) sound effects (e.g. a button tap sound).
- Being able to synchronize some of them with UI animations (e.g. a view appearance/disappearance).
I tried using the AudioServicesPlaySystemSound function from the AudioToolbox framework, sometimes it works great, but sometimes the sound won’t play instantly. For example when a button is clicked, its action is performed before the sound is played, even though the AudioServicesPlaySystemSound is called first in the button’s action method.
Thanks in advance,
Mota
Mixing audio waveforms into an already running RemoteIO Audio Unit configured with short buffers will have the lowest possible audio latency. The cost of this is a more complex to use API and the need for uncompressed audio assets.