Note: am cc'ing the freesci-developers list. This is results of testing a
win32 binary based on the current CVS.
On Tue, 15 May 2001, Taylor Barratt wrote:
> Okay your latest build seems better but the same... few things I noticed
>
> - When it's playing slow, it's playing faster than with the last version
> - I just have to simply CLICK on the window's title bar (I don't have to
> drag the window around) for the music to play at-speed.
I just tried this clicking myself, and noticed that the main thread goes
down to <1% CPU, probably because it's not redrawing while the window is
being moved. Then the main thread is down, the music plays correctly.
I've noticed this method especially works in LSL3 on the "Bail Out"/"Try
to Offend Me!" screen after the intro. If I click to move the window
(effectively suspending the main/drawing thread), the music plays more
perfectly than it ever has.
> - Not only are some notes missing, I think they're playing at various
> speeds.. some notes seem squashed together (i.e. 2 notes are play at the
> same time when one of them should have played a fraction of a second
> earlier). I used LSL3's music at the start of the game (because I know it
> pretty well).
> - The MT32 stuff sounds like SHIT (sorry.. but it's terrible). Why is it so
> bad? The GM conversion stuff sounds better... WAY better and it's a
> conversion! It's still off, but comparatively it's very close. I would think
> the MT32 mode should just pass the data out. I'm sure you don't have sysex
> uploading happening yet, but I can't imagine there was much in the way of
> sysex on LSL3. I think LSL2 had NO sysex data.. I should try it. anyhow..
> it's more than just the lack of sysex.. I think it might be playing the
> same instrument for all tracks. I don't know how to operate the MT32
> manually (i.e. the controls) to find out. But it sounds that way.
Thanks for articulating this so well, I had difficulty explaining it to
Chris and Solomon.
> Oh you didn't send me any perfmon info.. but I tried a couple things.. when
> I click on the title bar, the thread gets privileged CPU time, when I let
> go, no privileged CPU time. And of course when I click on the title bar the
> total cpu utilization is reduced from 100%, but when I let go it goes back
> up. Maybe the thread priority of the graphics processing is just too high
> for the audio to get anything done. *shrug* I know NOTHING of the structure
> of freesci, but if it were my program and it did that, I would have to
> consider the thread priorities, and even sleep commands to free up the cpu.
> I am a developer, but haven't done anything low level like freesci which
> probably makes me more dangerous than someone who knows squat about
> development, so just ignore all that :)
In the SDL soundserver, the sound is done in a separate thread. We have
been trying sleeps in various places, which kind of worked. What we ended
up with is using sched_yield() on systems that have it, and usleep(0) (or
Sleep(0) on win32) on systems that don't. The SDL soundserver always uses
the *leep(0) method, since that works on a thread level; sched_yield
appears to work at the process level (which is why it works on the unix
soundserver and not SDL). Unfortuneately, I don't know if SDL allows us to
dictate thread priorities or not. That definitely might help things...
In short, your analysis is pretty much correct. It's just a matter of
putting the sched_yield and *sleep(0)'s in the right places :)
If you want to get into the code, I can honestly say that this dev team
was very helpful to me, and I never really did much coding before. (I
would say I'm not doing that much now, even ;>). If you use VC++ 6
already, you're halfway there as far as I'm concerned :)
> If I get masochistic anymore tonight or tomorrow I'll try the new one under
> Win98.
Thanks! For measuring CPU usage by thread there, get WinTop. It's on MS's
site in the "Kernel Toys" package. I'll try to get on an NT/2k machine
tomorrow to find the exacy steps for using PerfMon to monitor this. The
gist is you want to "add" the "thread" object type, and choose the
SCIV.EXE threads. The graph should show what's up, though I'm pretty sure
the results will be consistent with win9x.
--
http://www.clock.org/~matt