Halting a playing sound sample on iPhone using AudioServices

[亡魂溺海] 提交于 2019-12-11 15:59:35

问题


I am implementing a sound effect that plays while a user is dragging a UISlider.

Here is the IBAction: called by the UISlider's Value Changed event

-(IBAction)playTone4; {
    AudioServicesPlaySystemSound(soundID4); 
}

I would like the sound to halt when the user is not dragging the slider but has not released it.

Is there a way to do that? There doesn't seem to be an AudioServicesStopSystemSound() function.


回答1:


System sounds cannot be stopped.

See the iPhone Programming Guide: section Multimeda Support for more information.

To accomplish the desired effect, I would recommend using AVAudioPlayer or audioQueues. The Programming Guide I addressed covers everything you want to know about these techniques.



来源:https://stackoverflow.com/questions/929785/halting-a-playing-sound-sample-on-iphone-using-audioservices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!