Hi,
I've been doing some more testing, which confirms the link between the platform timer that is used and sound stability. A reduction by a factor of ten for the amount of overflows is shown in the example below.
The timing in MAME uses a function QueryPerformancecCounter/Frequency that depends on the platformtimer in the computer (CPU and/or motherboard). There have been various types of timers evolving over the years, leading to a situation where Windows has a choice from various hardware timers in a PC. Such as HPET, TSC's, LAPIC's or a combination. Windows has some intelligent decision making baked in the OS to decide which is best for the specific combination of hardware and OS.
In my previous post I stated that when the High Precision Event Timer (HPET) is enabled in the BIOS, together with the useplatformclock set to TRUE in Windows, I may experience erratic results with the FreqTest tool in combination with
PCI-Express audio cards. Just as some of the other users have reported.
Now I found out another interesting thing. When I disable the HPET in the BIOS, BUT set Windows 7 to use the platformclock, then *another* hardware timer is used! So for my system there are three possibilities:
1.Bios HPET ON & W7 useplatformclock=TRUE
2.Bios HPET OFF & W7 useplatformclock=TRUE
3.Bios HPET OFF & W7 useplatformclock=FALSE
1= HPET = 14.31818Mhz
2= LAPICs = 3.57955Mhz
3= TSC+LAPICs = 3.41806Mhz
Earlier I reported on the erratic results that came up with setting 1 (in hindsight the main reason for starting this thread). So I'll not focus any further on that. Instead, I have now done a more extensive test for 2 and 3. Both provide stable results in Freqtest, although 2 being slightly better than 3 (see attached pictures). Next up is a more extensive run in GroovyMAME. Note that in this test I have been running the MESS MSX2 driver vsynced at audio latency setting of 1.0(!), with framedelay at 7, each for
half an hour.
2.Bios HPET OFF & W7 useplatformclock=TRUE (3.57955Mhz)Average speed: 100.00% (1883 seconds)
Sound: buffer overflows=2 underflows=1
Average time between overflows: 941 seconds
3.Bios HPET OFF & W7 useplatformclock=FALSE (3.41806Mhz)Average speed: 100.00% (1831 seconds)
Sound: buffer overflows=22 underflows=1
Average time between overflows: 83 seconds
The bottomline:The results speak for itself, it makes a material difference for GroovyMAME what hardware counter is used as default in Windows. When Windows is set to use the counter in option 3, GroovyMAME runs at about ten times as many overflows. With option 2 it runs near perfect. Interestingly in a default setup where HPET is
off in the BIOS, Windows7 will default to option 3, the worse of the two.
If you want to test for yourself, you can try between all
four combinations* of A) enabling/disabling HPET in your
BIOS and B) enabling/disabling the useplatformclock
in Windows. In Windows 7 you can set the useplatformclock to true or false by running a CMD shell with admin privileges and then do:
"bcdedit /set useplatformclock true" to enable the HPET (when enabled in the BIOS) or some other platformclock (when HPET disabled in the BIOS)
"bcdedit /deletevalue useplatformclock" to set it to false
* Note: for me there are three different results as HPET ON and platformclock false gives the same result as 3 for me.
After doing a change a reboot is required for the new settings to take effect. Download the tool WinTimerTester (here:
http://www.mediafire.com/?xzo9n84d8lze9nb) to check what timer frequency is used for QPF. Only look at the Mhz number at the top of the window, disregard the rest. After each reboot and verification with WinTimerTester that the QPF value is different, you could run FrequencyTest and additionally do a GroovyMAME test comparable to mine. That should give you an idea on which timer is best for your system.
Of course as always, the usual disclaimers apply: for some this may make a difference, but for others it may do nothing. As the saying goes, if it ain't broke, don't fix it