<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 19 Aug 2005 21:49:28 +0100
From   : "David Hunt" <dm.hunt@...>
Subject: Re: BeebEm bug?

Hi,

Have a look at MSDN website, this function is documented as being part of
the multimedia features introduced in Windows 95. I have used it where very
fast thread switching is required, especially in A/V apps where the FPS has
to be locked and normal timing is too lax and often varies from machine to
machine.

The prototype of the call is here
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/h
tm/_win32_timebeginperiod.asp>

An example of its use is here
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html
/introducingsomenewvideomixingrenderersampleapplica.asp>

I get next to no CPU utilisation playing Zalaga (measured over 20 minutes of
playing!) on my Dell Precision 670.

Keep up the good work!

Dave ;)


-----Original Message-----
From: Majordomo List Manager [mailto:majordomo@...] On Behalf Of
Tom Seddon
Sent: 19 August 2005 20:13
Cc: BBC Micro mailing list
Subject: Re: [BBC-Micro] BeebEm bug?

Richard_Talbot-Watkins@... wrote:
> Tom, I've also noticed that Model B runs at 99% on my home PC (or 49% on
my
> work PC which has hyperthreading on its single CPU), and I also wondered
if
> this needed to be the case.  I wonder what BeebEm 2.2 is doing to be able
> to cut its CPU use down to 10%?  Is it possible to Sleep() the process for
> the few microseconds required, rather than stalling it with a delay loop?
> (I am not a Windows programmer so I have no idea if sleeping for such a
> small amount of time is possible...)

I'd had very poor results (fairly random speed limiting in particular) 
when trying that kind of thing originally. Windows only lets processes 
sleep in increments of 1ms, and it's fairly sloppy about the amount of 
time they're suspended for. But it turns out that's just what BeebEm 
does, so I tried again -- turns out all you need is another call 
(timeBeginPeriod) to tighten up the system timer resolution for the 
current process. Once I'd done that, it all worked much better: and now, 
speed limited, with sound, model-b takes up about 35% CPU time on my 
650MHz Pentium III PC running WIndows 2000.

(Interestingly, beebem doesn't make this call, so I'm not at all sure 
how it works! It could be down to its running the windows message loop 
more frequently than model-b, which only does it 25 times per second.)

This timing 'trick' isn't officially documented as far as I'm aware, but 
apparently it works across all Windows versions. So, it's staying in, 
and will be present in the next version... whenever that comes out. (I 
just really haven't had the time or inclination to tie up the loose ends 
  and get a new version ready for release. I'll be honest -- it's much 
more fun adding new stuff :)

--Tom
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>