iPhone SDK:记录播放序列中按钮的时间

发布于 2024-07-12 05:16:15 字数 393 浏览 3 评论 0原文

我正在开发一个应用程序,您可以在其中按下按钮以使用系统蜂鸣声播放声音。

我没有记录输出,而是考虑记录按下按钮的时间,因此当用户按下“播放”按钮时,按下按钮的时间与用户按下按钮的时间相同,因此它的作用就像iPhone 已经录制了声音,但它只是按顺序播放它们。 我希望在用户按下“录制”按钮后发生这种情况。

示例:

  1. 用户按下记录
  2. 计时开始
  3. 记录按下每个按钮的时间和时间

  4. 按下按钮后计时停止的时间
  5. 播放按钮回放事件序列

任何人都可以提供有关编码、要阅读的文档等的任何想法。

非常感谢!

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:

  1. User presses record
  2. Timing starts
  3. records timing of each button pressed and when

  4. Timing stops after a button has been pressed
  5. PLay button plays back the sequence of events

Can anybody give any ideas on coding, documents to read etc.

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光无声 2024-07-19 05:16:15

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!

止于盛夏 2024-07-19 05:16:15

许多系统时间方法都可以获取自纪元以来以秒为单位的值。
根据系统时钟的粒度,您可以仅获取按下开始按钮的系统时间,并在按下每个按钮时再次获取时间。
要计算时间,只需从按钮按下时间中减去开始时间即可。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文