Peter D'Hoye wrote:
this is a small but effective patch that makes the W32
simulator stop putting load on the CPU while having audio playback.
In the yield() implementation I've added a mechanism that
alternates between Sleep(0) and Sleep(1). This is because
Sleep(1) makes the app run too slow (no audio), and Sleep(0)
hogs the CPU (but gives sound).
I wrote it so that it calls Sleep(1) every 256 calls to
yield. All other times it does Sleep(0).
I'll give it a go, but I've noticed that the yield() implementation is
tricky to get right. I guess it depends a lot on how often yield() is
called from the rest of Rockbox.
I've also added a Sleep() in sleep().
But there was already a sleep in sleep, so I don't see the point. (Your
patch does make there's always a "real" sleep, even if HZ should ever be
> 1000...)
Magnus