2010-09-07 63 views
0

我使用AudioServices在我的應用程序播放聲音AudioServices最佳替代:在iPhone上

AudioServicesCreateSystemSoundID(soundFileURLRef,& soundFileObject);

然後

AudioServicesPlaySystemSound(soundFileObject);

聲音播放,但因爲我需要經常播放它(0.24秒長),我得到一個奇怪的不自然的聲音重複。

您可以在http://testing.lukem.co.uk/Simulator/Simulator.html

聽到它的其他噪音干擾我調節音量 - 哎呀。

謝謝!

回答

0

如果您想要對聲音重複的時間進行最精確的控制,請使用音頻隊列或音頻單元RemoteIO,並在開始填充回調緩衝區的位置與聲音的原始/ PCM樣本陣列之間對樣本進行計數。

+0

下面是一些RemoteIO示例代碼的鏈接:http://sites.google.com/site/iphonecoreaudiodevelopment/remoteio-playback – morgancodes 2010-09-07 16:39:14

+0

這似乎是嚴重的矯枉過正。如果系統在完成之前再次觸發,系統是否會播放完成? AVPlayer會有不同的表現嗎? – codecowboy 2010-09-09 11:11:48