iPhone SDK:记录播放序列中按钮的时间
我正在开发一个应用程序,您可以在其中按下按钮以使用系统蜂鸣声播放声音。
我没有记录输出,而是考虑记录按下按钮的时间,因此当用户按下“播放”按钮时,按下按钮的时间与用户按下按钮的时间相同,因此它的作用就像iPhone 已经录制了声音,但它只是按顺序播放它们。 我希望在用户按下“录制”按钮后发生这种情况。
示例:
- 用户按下记录
- 计时开始
记录按下每个按钮的时间和时间
- 按下按钮后计时停止的时间
- 播放按钮回放事件序列
任何人都可以提供有关编码、要阅读的文档等的任何想法。
非常感谢!
I've got an app in development where you press a button to play a sound using System beep.
Instead of recording the output, I was thinking of recording the timing of when the buttons were pressed, so when the user presses a 'Play' button, the buttons are pressed in the same timing the user has pressed them, so it acts like the iPhone has recorded the sounds, but it's just playing them in sequence. I'd like this to occur once the user has pressed a Record button.
Example:
- User presses record
- Timing starts
records timing of each button pressed and when
- Timing stops after a button has been pressed
- PLay button plays back the sequence of events
Can anybody give any ideas on coding, documents to read etc.
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://pastie.org/376474
希望这对您有所帮助。
它本质上是有效的,尽管我还没有实际测试过它,所以我不确定它是否有效。
我假设您可以通读它并找到一种方法将其适合您自己的代码。
祝你好运!
http://pastie.org/376474
This should hopefully help you out a bit.
It works in essence, though I haven't actually tested it, so I'm not positive it works.
I assume you can read through it and find a way to fit it in your own code.
Good luck!
许多系统时间方法都可以获取自纪元以来以秒为单位的值。
根据系统时钟的粒度,您可以仅获取按下开始按钮的系统时间,并在按下每个按钮时再次获取时间。
要计算时间,只需从按钮按下时间中减去开始时间即可。
Many system time methods have a way to get the value in seconds since the epoch.
Depending on the granularity of the system clock you can just grab the system time of the start button press and grab the time again when each button is pressed.
To calculate the timing just subtract the start time from the button press time.