How to get iPhone OS 3.1 muffled keyboard sound?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 13:36:47

Using 0x450 as the SystemSoundID works for me at the correct volume - note that it doesn't respect the keyboard clicks on/off preference.

I'm not sure how portable this is - it works for me on the simulator and on an iPod Touch 3rd gen. I suspect it works on all devices but could change without notice in a software update.

I got this number by setting a breakpoint on AudioServicesPlaySystemSound and pressing a normal keyboard key - the first assembly instruction copies the SystemSoundID into a register, so you can see it in the Registers view in the debugger.

Use AVAudioPlayer instead of AudioServices and you will have access to a volume property that allows you to lower and raise the volume of the sound.

This is probably stupid, but I've seen in other sample code that there is also a tick sound file. And from the examples I've seen, it's ofType:@"caf", so that's worth a try as well. Sorry if I'm way off.

By using a customer input view that supports UIInputViewAudioFeedback, you can play the sound at the correct volume and honor the users key click sound settings.

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