iPhone 录音时不振动
我正在修改 AurioTouch 示例。我想振动手机以响应特定的声音输入。我可以检测输入并 printf
它们,但是 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
在会话为 kAudioSessionCategory_PlayAndRecord
时不会执行任何操作。
I am modifying the AurioTouch example. I want to vibrate the phone in response to particular sound inputs. I can detect the inputs and printf
them, but AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
doesn't do anything while the session is kAudioSessionCategory_PlayAndRecord
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是苹果不允许这样做。所有允许录音的音频会话都会关闭振动。
The answer is that Apple doesn't allow this. All audio sessions that allow recording turn off vibration.
需要同时振动和录音吗?
如果不这样做,您可以在振动时停止音频单元,将音频会话类型更改为实时音频,通过音频服务播放振动系统声音,然后将会话切换回播放和录制,然后重新启动音频再次单元录音。
Do you need to vibrate and record at the same time?
If you don't, you can stop your audio unit when it's time to vibrate, change the audio session type to live audio, play the vibrate system sound thru audio services, then switch the session back to play and record, and restart your audio unit recording again.