gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > It is impossible to synchronize it!!!

#140568 - Blue Frenzy - Mon Sep 17, 2007 5:59 pm

I surrender. I tryed docens of ways to synchronize the song with a simple value. The variable is always under the song time because, when i get 59 or less fps, the counter grows slower. When that is made 20 times, i have a huge delay very noticeable on a game like ouendan.

I tryed using ticks, but the value randomly increases much more so i can't get an exact value in miliseconds.

There is no way to know the playing time of the raw, so I cannot retrieve that value and operate with it.

I also tryed to, if fps is 59, add 1 to counter. It failed because, the real framerate is not an exact number, so if game runs at 59.2 or 59.6 it finishes delaying again, but this time with unpredictalbe results.

please, any help here?

#140569 - Mighty Max - Mon Sep 17, 2007 6:38 pm

First thing:
Do not use VBLANK for arm9/arm7 communication when you need exact timings, as doing so will often mean that your arm7 receives the commands a frame later then the arm9 sends it. (Setting the data might not be finished when it is checked for read). Use the IPC-FIFO.

Then, use the counters. Set one to reach 0 after 1ms and increase the ms counter on timerirc. However if you have the cpu longer times in IRQ state, the irq might delay. If you have such an design (like doing many things in vblank) use another timer that gets increased once the first hits 0 again.
_________________
GBAMP Multiboot