Game MIDI out: Softsynth vs. real synth
Game MIDI out: Softsynth vs. real synth
- Subject: Game MIDI out: Softsynth vs. real synth
- From: Max Horn <email@hidden>
- Date: Tue, 21 Jun 2005 18:30:54 +0200
Hi there,
I have been a Mac & Unix developer for over a decade now, but CoreAudio
and MIDI on the Mac is a rather new topic for me. I hope the nice folks
on this list can give me some hints / pointers on the following
problem:
The short story (if you are interested in details, I've put the long
version at the end of this mail): I need advice (maybe a pointer to
sample code) regarding how I can pipe MIDI data (generated by old DOS
games) to either the DLS softsynth, or a user specified real MIDI
synth, depending on a user configuration switch; i.e. my code generates
raw MIDI data, which right now is always sent via MusicDeviceMIDIEvent
to the DLSSynth. What I'd like to do is offer the user a list of all
available real MIDI synths, plus the softsynth; the user chooses one,
and the program then sends data to the user chosen synth.
How would I go about that? Do I have to provide two code paths (one for
soft synth, one for the real MIDI synth) or can I do it with one? In
the latter case: how? I used MIDIGetNumberOfDevices/MIDIGetDevice to
iterate over the MIDI devices on my system; this shows the "IAC Driver"
(whatever that is?) and my USB<->MIDI adapter (I used "Audio MIDI
Setup" to configure my MIDI synth, I hope I did it right). It's not
clear to me whether one can address the softsynth via the MIDI* APIs,
too...
Also, while MusicDeviceMIDIEvent() does exactly what I need it for, I
am not sure MIDISend() does; if I read the specs right, it doesn't
allow for "running status", correct? In that case I guess I could add
code to "massage" my data before passing it to the system, but I am
interested whether there is an easier way to do this.
Can somebody roughly outline what I'd have to do, point me in the
direction I should look? Is there maybe some minimal sample code out
there to highlight this?
The long story:
Many old DOS games used MIDI for their music (and sometimes for SFX,
too). In the past years, several open source projects were started that
allow you to play many of these old DOS games on modern hardware and
modern OSes. Some of them are
* ScummVM (for LucasArts adventures) <http://www.scummvm.org>
* DOSBox (emulates a DOS PC, can run tons of old DOS games)
<http://dosbox.sf.net/>
* Exult (for Ultima 7) <http://exult.sf.net/>
* Pentagram (for Ultima 8) <http://pentagram.sf.net/>
* others...
All of these also exist for Mac OS X. And what the four above have in
common is the MIDI "driver" they use on OS X: A simple piece of code
that opens the DLS softsynth (using the old v1 AudioUnits API), and
then feeds data to it using MusicDeviceMIDIEvent. You can see one
version of it here:
<http://cvs.sourceforge.net/viewcvs.py/scummvm/scummvm/backends/midi/
coreaudio.cpp?view=markup>
Now, many of those old games didn't use General MIDI; rather they had
music custom tailored for one specific MIDI synth, the Roland MT-32.
This synth has a quite unique sound to it, and uses different
instruments than GM. For fans of those games, it's important to be able
to use an original MT-32 (or CM-32L or CM-64 or any of a list of
compatible devices) while playing their favorite classic games. There
is a MT-32 softsynth emu now, but it's very CPU intensive (not
everybody has a dual processor multi Ghz machine...) and not yet
faithful. Hence the Windows/Linux/PC versions of ScummVM/DOSBox etc.
all allow you to pipe the MIDI data to an attached MIDI devices. See
e.g. here:
<http://cvs.sourceforge.net/viewcvs.py/scummvm/scummvm/backends/midi/
windows.cpp?view=markup>
So, I now got myself a MT-32, and an USB<->MIDI adapter; I hooked the
MT-32 to my Mac. All I need now is to find the "proper" way to feed the
MIDI data generated by the programs listed above through to the
hardware synth, w/o loosing the ability to feed it to the softsynth
instead if no HW synth is present or if the user chooses so...
The end result hopefully will be an improved MIDI support for the above
programs under Mac OS X (and since they are open source, several
similar projects might benefit from it, too).
Best regards,
Max
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden