What is the best way to play sound quickly upon fast button presses Xcode?

前端 未结 5 1282
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 12:59

I have a soundboard it\'s just a screen with about 8 buttons. each individual button will have its own sound which will be played upon button press There are a couple of way

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 13:25

    22/03/2014 - Update: Got rid of my overly excited post (which was written a long time ago) and updated to portray a more appropriate answer.

    I had to achieve fine control over audio so opted to use OpenAL. WOW is one way to sum it up. As soon as I took it upon myself to use OpenAL which required a bit of extra leg work, getting all the required methods implemented and setting everything up; I found myself with practically no noticeable latency at all. I was absolutely pleased with the excellent results.

    I was able to achieve both fine control and no latency at all. I remember jumping in joy at the time when I had it working.

    Here are the resources I used that helped ease the endeavor of implementing OpenAL for the first time:

    1. OpenAL on the iPhone
    2. It was because of this link this video tutorial that I was able to create an excellent sound manager singleton. This allowed me to play all the sounds that I needed from any class that I wanted with little sound management, the singleton took care of everything for me.

    I humbly suggest everyone to use OpenAL if you require fine control over your audio, and more importantly if you require a low-latency on-demand audio, specially for games when you need to make sure sound is played there and then when you require and expect it to, an audio based application for example.

提交回复
热议问题