Hi Dr.Venom,
There are two different issues going on there, each has its own explanation. I'm going to focus on one of your modelines as an example, the same applies to all of them.
1 - Refresh rate rate calculation
Modeline "256x240_57 15.64KHz 57.50Hz" 5.26 256 272 296 336 240 247 250 272 -hsync -vsync
So if you calculate the refresh out of the above values, you get: 5.26 * 1000000 / 336 / 272 = 57.5543 Hz (diff = 0.0543 Hz)
The key here is that the dotclock is calculated as a real number, but in order to pass it to the ATI drivers we need to round it to just two decimal figures, because that's the best precission that the drivers admit. So that's where the 5.26 value comes from.
If you tried the lower inmediate possible value, you'd get: 5.25 * 1000000 / 336 / 272 = 57.5449 Hz (diff = -0.0551 Hz)
So the absolute difference is bigger in this case and 5.26 MHz is selected as best possible dotclock.
Now this is the theoretical refresh due to the limitations imposed by the drivers. What about the real refresh obtained?
2 - Theoretical versus real refresh rate
256x240 57.5543 57.5821
So let's assume the refresh returned by the Freqtest program is accurate enough (I believe so). We do the opposite operation:
real_dotclock = 57.5821 * 336 * 272 = 5.2625432832 MHz (vs 5.26)
This value is the best approximation that the drivers can obtain for our requested value of 5.26 MHz.
You can easily see where I want to go: it's impossible to get an *exact* match for a given refresh for these two reasons:
- Dotclock granularity
- Dotclock uncertainty
While we can't do anything about the granularity (unless you created your own drivers), there's a way to reduce or eliminate the uncertainty: we can measure ALL possible real dotclocks and create a dotclock look-up table instead of assuming theoretical values. I did implement this for VMMaker and the Radeon 9250. There's a file named Ati9250.txt that contains all measured dotclocks.
However, this is just one part of the problem: it allows you to predict how much off you're going to be, but doesn't help to get any closer. So what else can we do to gain precission:
real_dotclock = 57.5821 * 336 *
272 We shouldn't play with Horizontal-total because that would ruin our geometry. On the other hand, adding extra lines to Vertical-Total is not going to change the geometry, it will only raise the horizontal frequency a bit. So we can try again with 273, 274, 275, etc. lines, just in case the our *real* precalculated dotclocks required for that combination happens to produce a value which is closer to the target refresh. This is implemented in VMMaker with an option named 'Iterations'. By doing this, you can get values that are just 0.02 Hz off or less, most of the times.
Before you ask, GroovyMAME does not implement this feature. The reason is that you need to create an unique dotclock look-up table for your specific card and drivers, and I should write some software to assist people doing this. Considering most users find it hard to figure out the porch values of their monitors with Arcade_OSD, leave apart understanding how these affect the picture, which is the ABC of the whole thing, I honestly don't believe it's worth the effort to create the required software for doing this and supporting this feature, being the only benefit that the obtained refresh is 0.03 Hz closer. (
http://en.wikipedia.org/wiki/Diminishing_returns ) I consider myself very obsessed with this stuff and I can't truly notice the difference.
Anyway, Arcade_OSD let's you play with the involved values and measure the real refresh rate (just like FreqTest), so you can come up with a modeline that's more accurate. GroovyMAME will allow you to enter a raw modeline in the near feature, so you will be able to use your own tweaked modelines.
Finally, regarding how this affects the sound accuracy, GM doesn't need to know the exact refresh in order to adjust the sound. It just uses the core speed percentage that's recalculated on the fly which has a precission of 1/1000 (1000 = 100%, 999 = 99.9 %), so that means that for a 60 Hz typical refresh the accuracy is only 0.06 Hz. This factor is applied to the sound buffer when doing the final mix. However, I need to clarify that this is NOT applied when the new -frame_delay option is enabled. The reason is that modifying the core speed made the -frame_delay code to go crazy and produce an erratic speed.