Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
826 views
in Technique[技术] by (71.8m points)

audio - Preload sounds played via iPhone AudioServices

I built an iPhone app using AudioServices to play short sounds. The first time a sound is played, there's a delay of half a second or so while the sound loads before it plays. This definitely makes for an awkward user experience.

Is there a way to preload sounds for AudioServices to play, or do I need to switch to audioQueues or some other method of playing sounds?

Thanks, Maha

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a well known problem. Everything in AudioServices is initialized lazily.

I think that your best choice is between Core Audio or OpenAL. OpenAL might be overkill, but it has a simple API. The oalTouch example is a good place to start.

Core Audio is a bit more raw, but it's well documented. The iPhone's OpenAL SDK is built on top of it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...