#8067 closed patch
GMD tracks through IMuseAdlib
Reported by: | SF/jamieson630 | Owned by: | SF/ender |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | ||
Cc: | Game: | Sam and Max |
Description
This patch augments IMuseAdlib with support for playing GMD (General MIDI) tracks using Adlib output.
Some notes:
* GMD tracks are now given a comparison priority even if _use_adlib is true. This allows GMD tracks to be selected in the absence of ADL (Adlib) tracks, where previously no track was selected at all.
* A table mapping GM programs to FM instrument definitions has been dropped into imuse.cpp. This table was built by matching up DOTT instrument definitions with GM program changes. While is still has gaps, it has been verified to provide reasonable output with the whole of DOTT and the Sam & Max demo.
* Program change messages cause IMuseAdlib to use the _glob_instr table ONLY if it has determined that anything was ever loaded into it (through SysEx command 0x11). Otherwise, it draws off the GM-to-FM mapping table.
Some attention areas:
* Percussion is not implemented. If IMuseAdlib detects anything coming in on the percussion channel, it throws it out. NOTE that this may actually be too indiscriminatory, i.e. actual Adlib tracks don't have a predefined percussion track and may use that channel legitimately. Probably need a way for IMuseAdlib to determine if it's a GM or Adlib track and filter channels accordingly. I didn't notice it kicking out Adlib parts, but I'm not certain that it NEVER does that.
* The mapping table currently provides definitions for about 70 out of 128 possible programs. If you want to help in making it complete, run ScummVM with Sam & Max full version, using debug level 2, and capture the output and send it to me. Program changes recorded in the debug output will tell me which programs are being used that are not implemented yet.
Hope this helps bring Sam & Max to life on those Linux systems! :-)
Ticket imported from: #615745. Ticket imported from: patches/172.
Attachments (2)
Change History (12)
by , 22 years ago
Attachment: | gm_to_adlib.diff added |
---|
by , 22 years ago
Attachment: | gm_to_adlib.rev2.diff added |
---|
Revised patch against September 28 snapshot
comment:1 by , 22 years ago
I just attached a revised patch to use instead. This patch fixes the problem of possibly filtering out legit Adlib parts. It uses the same approach as MT32-emulation, by checking whether the track is actually a GM track. This approach gives IMuseAdlib more reliable control over when to do things the Adlib way and when to do things the GM way.
comment:2 by , 22 years ago
Wouldn't "isMidi" be more appropriate instead of "isGM" ?
comment:3 by , 22 years ago
Personally, I think the term "isMidi" can be misleading. For one thing, all of the non-digi music tracks (except possibly for those old 'AD' blocks I saw mentioned in resource.cpp?) are formatted according to the standardized MIDI file format. Second, by the time a non-digi music track gets piped through IMuse, it's a MIDI stream no matter what.
"isGM", to me, is more specific in that it differentiates between MIDI tracks that assume a General MIDI (GM) instrument set, MIDI tracks that assume a Roland MT32 instrument set, and MIDI tracks that have no meaning unless you interpret the Adlib instrument definitions in the SysEx blocks.
Not all "MIDIs" are created equal....
comment:4 by , 22 years ago
By the way, I finally got a version of Sam & Max to test music tracks beyond the scenes in the demo. Already I see some tweaks that will need to happen to the FM instrument set I dropped into imuse.cpp (why's the pan flute sound like an annoying "quack" in the carnival music?!?), and some Sam & Max tracks have short drum solos that don't sound at all through Adlib right now. Still, overall the output seems to be pretty good, to the extent that ScummVM is playing Sam & Max music properly in the first place.
comment:5 by , 22 years ago
I've applied this, with some other changes.. but I'm going to leave this patch open because I suspect there will be improvements :)
Oh, and if you feel like looking at the OTHER sam and max imuse problems.. http://www.enderboi.com/saminfo.txt gives the info we've already discovered/guessed.
comment:6 by , 22 years ago
Owner: | set to |
---|
comment:7 by , 22 years ago
Ender, thanks for the URL. :) After reading it, I gather that it deals mostly with the API side of iMuse. My area of focus instead will be on MIDI parsing issues. In particular, I want to deal with the issue of tracks not looping in Sam & Max, as well as the use of extended Control Change messages in the MIDI files.
I'll deal with MIDI parsing and leave the rest of iMuse in the hands of the pros for now. ;)
comment:8 by , 22 years ago
Status: | new → closed |
---|
comment:9 by , 22 years ago
I wish it was that easy :)
Most of the sound problems in Sam are related to the imuse control system,
not the underlying midi code. And unfortunatly, when it comes to the rest
of imuse... none of us have a clue, there IS no 'pro' :)
Ok, I might as well close this patch after all. The emulation works almost perfectly, to my amazement - thank you! :)
comment:10 by , 6 years ago
Component: | → Engine: SCUMM |
---|---|
Game: | → Sam and Max |
Patch against a September 24 CVS snapshot