On Fri, 30 Nov 2001, Alexander R Angas wrote:

> Speaking of timeSetEvent() - have a look at what I'm about to put into CVS
> (which will solve the linking problem BTW). This has millisecond resolution
> and should set a lightweight event object every 17ms (as close to 16.6667 as
> possible). The event sound server waits on this object and then immediately
> calls do_sound() to play the next waiting MIDI command when the object is
> signalled. Yet when using this, I only get reasonable sound speed when I
> drop the timer value from 17 to about 7 or 8. Even then it's not as smooth
> as the polled server when it's working properly. What does that say about NT
> scheduling? Or perhaps my event SS code (which I don't _think_ is faulty but
> could be!) How does it sound on your speed machine, Matt?

It does sound a bit slow on my machine. The code looks fine, other than
you are specifying a 2ms timer accuracy to timeSetEvent and you really
want 1ms.

I asked the CTO of my company how he would solve this problem. What we can
do it use timeSetEvent or another waitable timer to signal us at 14 or
15ms. Then, we can poll a high resolution timer (I would prefer
QueryPerformanceCounter since it doesn't require DX8) for the remainder
and process the event. Because we are only polling for the last bit of the
cycle, CPU usage should remain fairly low. We'll have to actually
implement this to see how it works out, though.

Let me know if you need any help on the implementation side of this, Alex.


> > Given these facts, it might be wise to take a step back in order to take a
> > step forward. Some important restructuring was done to the sound subsystem
> > (that really needed to be done, IMO) to add the possibility of an event
> > soundserver. I'm not saying we should give up on the event soundserver,
> > but see what this refactoring and trials can give us in the polled
> > soundserver.
>
> I 100% agree with this. The flow of the polled sound server is difficult to
> follow (IMHO), and now it can use the shared sound functions in
> soundserver.c.

I noticed you fixed some soundserver synchronization problems in the event
soundserver -- do any of those apply to the polled soundserver as well?


--
http://www.clock.org/~matt


Reply via email to