Huhu, the f0dder needs some help :/.

Recently, while bugfixing a wonderful game (for those interested,
look at http://f0dder.has.it - essays/xcom pitchpatching), I noticed
that mci under NT based windowses is totally borked... from you
issue a


mciSendString("open test.mid type sequencer alias MUSIC", NULL, 0, NULL);

it takes 1-5 seconds before the music starts playing. And what's
worse, the mciSendString doesn't return before music starts playing,
which means your thread freezes for some time. My solution to this
is a "worker thread" that issues mci command strings, and helper
functions that spawn temporary threads that pass on commands to
the helper threads. Did I mention that mci is not thread-safe? All
mci commands must be sent from the same thread. All this is pretty
darn dirty, but at least it works.

I'm wondering whether there are any cleaner methods to solve this
problem? Perhaps by not using MCI (can't really say I like that API).
The music files are stored as 100% standard midi files, and my only
requirements are that the amount of code shouldn't be too overwhelming
(compared to my current fix, this shouldn't be too hard to achieve),
and that a change of music happens instantaneously (well, ok, a few
miliseconds pause is okay ;) ).

Btw, if you look at the code in the xcom bugfix loaders, please
realize that I wanted to get the job done, not do anything optimized
or pretty&clean ;).
Posted on 2002-01-06 04:22:09 by f0dder
there is an own midi API, all functions called midiXXX.

There is also an example midi player
available at microsoft using this API.
Posted on 2002-01-07 11:16:44 by beaster