开发者

How can I sync background music to visuals on the screen?

I'm creating a guitar hero type game for my class and I'm having开发者_JS百科 issues syncing the music with the moving notes. I open a thread and sleep for a few seconds to start the song so that it will wait for the notes to move across the screen. That specific sleep time works for the simulator but not my actual iPod. And it seems when I first load the program into the simulator the timing is off.

Im using the the AVAudioPlayer class for the music.

Thank you for any insight!


Calling prepareToPlay before play should minimise any lag so that you don't need to do that sleep operation at all. Once prepareToPlay has returned start your thread and call play and you should be pretty much in sync.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜