Hi all,
I'm making a game similar to "Gitar Hero" but I have a problem of synchronization.
I'm using the OnTimer event to move the blocks N pixels in each run. The problem is that sometimes OnTimer not work and out of sync the music with the blocks.
I have a csv file with the times in milliseconds which each block must pass over the push area.
I also calculated how many pixels you have to move the block in each run of OnTimer. In the player of Gideros the game working properly but when I run in mobile I have problems of synchronization (tested on Samsung Galaxy and Xperia Neo)
Any advice? Can you think of an alternative solution? How to make a game like "Gitar Hero"?
Thank you very much!
(Sorry for my english!)
Comments
I wonder why timer is out of sync?
Maybe because sound channel needs some time to load, while timer is already activated, etc.
What music format are you using? mp3 or wav?
-WAV files: Entire sound is loaded into memory. Consumes little CPU while playing. Suitable for simultaneously played sound effects.
-MP3 files: Sound is played by reading small chunks therefore consumes little memory. Consumes more CPU compared to WAV files. Suitable for background music/speech.
It's hard to tell, what would be better, maybe using wav to load song completely into memory would do the job.
You can also try using SoundChannel:getPosition() to see miliseconds passed from sound start and adjust block movements to it inside timer.
I will try the SoundChannel:getPosition() method... May be it is a solution...
My game is already uploaded to Google Play. It's called "Ritmo Cofrade Linares".
https://play.google.com/store/apps/details?id=com.santacenero.ritmocofradelinares
You can download it if you want and check the problem of which I speak. I will try to fix it in netx versions ...
Thank you very much!
Likes: gorkem
Now I use the SoundChannel:getPosition() method.
Thank you very much!