Open AntonioND opened 1 year ago
I recall there were issues with fixing that, but not the details involved.
Some research:
>>> 16756991 / int(16777216 / 22050)
22048.672368421052
>>> 16756991 / int(16756991 / 22050)
22077.722002635048
In the former case (current), a 22050Hz timer would run at 22048Hz (a little bit slower); in the latter case (after the fix), a 22050Hz timer would run at 22077Hz (a larger bit faster).
Adding proper rounding fixes this:
>>> 16756991 / int((16756991 + ((22050 + 1) >> 1)) / 22050)
22048.672368421052
It also leads to more accurate values in some cases:
>>> 16756991 / int(16777216 / 240)
239.71090766039626
>>> 16756991 / int((16756991 + ((240 + 1) >> 1)) / 240)
239.99929820541098
However, such a change still requires fairly extensive testing, IMO.
The bug aspect of this has been somewhat fixed; however, the issue of "creating an in-sync ring buffer between ARM7 and ARM9" remains open. Perhaps a helper calculator tool (like mtheall's VRAM allocation tool) would be the right approach here?
Yeah, that's a good idea.
Issue reported originally by @Gericom:
Follow-up: