VOGONS


DOSBox w/ built in MUNT Emulation

Topic actions

First post, by priestlyboy

User metadata
Rank Oldbie
Rank
Oldbie

Hey guys,

Thanks to Gulikoza for giving me the patch to work from to get MT32 emulation into DOSBox. I changed the way he did it some. I split his patch up into two diffs and fixed a few mistakes when he was "#ifdef"ing and "#endif"ing the mt32emu source. I also followed a different procedure in building it into DOSBox.

My way of doing it is to build the mt32emu library as a MinGW lib and then building DOSBox with a link to that library.

If necessary you should get the latest version of MinGW which is being built into a large distribution file at the moment (they've been doing RCs) and then get MSYS and the MSYSDEVKit plus update the automake, autoconf, and libtool librarys from the ftp.gnu.org. (This is how my system is setup at the moment)

The mt32emu patch changes ONLY the synth->printDebug or printDebug statements in various files to the standard DOSBox logging output format. It also puts some in #ifdef blocks so that you won't be bombarded with multiple lines of certain output. It also comments out the functions that would be called by the printDebug statements. The patch puts in a "#define MT32DEBUG" for enabling the more intensive debugging statements in the "mt32emu.h" header which is commented out by default. It also adds the "logging.h" header to the mt32emu source from the DOSBox source to match the DOSBox console/debugger output.

Get the mt32emu CVS source although I don't think it's any different from the current release source.
Put mt32emu.diff in the mt32emu dir source not the mt32emu/src dir.
In MinGW go to the mt32emu dir and type "patch -up1 < mt32emu.diff"
Then "./autogen.sh"
Then "./configure --prefix=/mingw"
Then "make && make install"
That will set you up to build DOSBox with MT32 Emulation.

This dbmt32 patch adds the mt32 option lines to DOSBox.conf, adds the mt32 and mt32samplerate understanding to midi.cpp, and the midi_mt32.h (thanks to Srecko/Gulikoza) tweaked to make it all work.

Get the latest DOSBox CVS source.
Put the dbmt32.diff patch into the DOSBox dir source not DOSBox/src dir.
In MinGW go to the dosbox dir and type "patch -up1 < dbmt32.diff"
Then "./autogen.sh"
Then "export LIBS="-lmt32emu"" so that the mt32emu library links to DOSBox makefiles.
Then "./configure <your options>"
Then "make"

*If the above doesn't seem to work and you get errors about mt32emu. Just edit the 'Makfile' in the dosbox/src directory and put "-lmt32emu" at the end and do "make" again*

- Don't forget to strip dosbox.exe at the end -

Hopefully I didn't mess anything up. I had to fix a few things that Guli did because in a few places he put a #endif or a #ifdef MT32DEBUG in the wrong place which makes his version sound... weird. Although it seems that MT32 emulation needs a lot of work anyways. hehe.

Gulikoza also added in a "mt32rate" option which sets the frequency rate of the MT32 emulation in the DOSBox.conf (which I moved slightly) and DOSBox defaults to "win32" so you have to set "device=" to "mt32" in the DOSBox.conf to enable mt32 emulation.

Note: When you first run DOSBox with mt32 enabled you will have to wait a minute or two because it has to create the waveformcache-<samplerate>-440.00.raw based on the rate you choose. Also the, MT32 Emulation is very CPU intensive and right now the default is 22050 which is decent enough (though it sounds better at 44100.) I think Dynamic Emulation does help out with the CPU load.

You should be able to use DOSBox with MT32 emulation as long as you have a proper MT32_CONTROL.ROM and a MT32_PCM.ROM in the DOSBox directory.

Otherwise you won't get any MT32 emulation.

The patches to the sources are attached below.

Enjoy.
/Ieremiou

Ieremiou
----------
Helping Debug DOSBox.

Reply 1 of 41, by priestlyboy

User metadata
Rank Oldbie
Rank
Oldbie

My latest build on rdu.dk contains the MT32 patch but you need the roms yourself to use it.
Enjoy.

/Ieremiou

Ieremiou
----------
Helping Debug DOSBox.

Reply 2 of 41, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

🤣...I was somewhat hungover when writing those ifdef's, quite possibly I messed something up 🤣
I'd like to mention also that Srecko said to put #include "midi_mt32.h" after alsa (at the end), but this makes the default option try mt32 first then fallback to win32. But since I doubt many people would want mt32 as default (if they even have the roms...) I decided that dosbox should try mt32 last. Also I guess config= option could be used for passing samplerate but a seperate option is more consistent since other soundsections use it as well...

Reply 3 of 41, by Srecko

User metadata
Rank Member
Rank
Member

That part comes from canadacow's dosbox mt32 versions which had midi.cpp changed and included midi_mt32.h. I took needed source files to be able to compile mt32 support with dosbox cvs versions.
Later, when munt was released, I only had to adapt midi_mt32 to munt structures (very similar).

Reply 4 of 41, by moturimi

User metadata
Rank Newbie
Rank
Newbie

@ priestlyboy

Thanks so much. Works better than some other CVS with MT32 support. But I have to say the original DOSBOX 0.61 with MT32.ROM instead of MUNT works best with e.g. Kyrandia1.
The new version seems to have wrong instruments settings/sounds. And I also get some errors in the dialog box with some games like Monkey Island II and Lost files of Sherlock Holmes (e.g. MT32:Rhythm : Setting bend (8192) not supported on rhythm).
I don't have problems when I use SCUMMVM with MUNT.

Reply 5 of 41, by priestlyboy

User metadata
Rank Oldbie
Rank
Oldbie

Yeah, it sounds weird. I've noticed there is a lot of things commented out and such in the source code so I'm sure there's a lot not done. It also seems to be like around 8 weeks since work has been done on the MUNT source.

Personally, Canadacow's (the original MT32 supporting DOSBox) sounds alot better comparatively to me. All I did was use Srecko's and Gulikoza's work and fix it up a little bit and patch it into DOSBox and hoped for the best. As it did work I hope more work will be put into MUNT sometime.

/Ieremiou

Ieremiou
----------
Helping Debug DOSBox.

Reply 6 of 41, by Zorbid

User metadata
Rank Member
Rank
Member

The most up to date version of the MT-32 emulator is the one integrated in ScummVM. King Guppy uses it as a test platform, then backports the changes to the Munt CVS.

Reply 7 of 41, by Magamo

User metadata
Rank Member
Rank
Member

I've backported this patch to dosbox-0.63 release sources.

Reply 8 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Does the CVS patch still work with the latest MUNT and DOSBox CVS? I'll give it a try and see.

EDIT: Well I tried the Munt patch first and it bombed. I guess I'll have to look at it and see if I can patch it by hand.

EDIT 2: Finished the job manually, replacing all missed printDebug stuff with LOG_MSG or whatever. Now autogen.sh is bombing because it wants my Autoconf version to be 2.59 or higher instead of the 2.56 version that I currently have in MinGW/MSYS. I'm not sure where to grab the newest version, so I edited configure.ac to allow version 2.56 to work...

EDIT 3: configure worked and Munt compiled on the first try! I moved on to running the patch on the latest DOSBox CVS and it choked on midi.cpp. Investigating now...

EDIT 4: Got it working! I need to comment out some of the logging statements though because I didn't pay attention to which ones the patch would've commented out if it had been successful. The Wizardry 7 intro song sounds noticeably different from the Munt Win32 driver that I've been using; if anyone is interested I can record and post comparison .mp3s.

Reply 9 of 41, by static-

User metadata
Rank Member
Rank
Member

I'd definitly be curious in checking that out. Would you mind posting the two? Unless it's too much trouble

Reply 10 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Okay here you go. The Munt CVS recording is captured directly via DOSBox's capture feature, while I had to use Nero Wave Editor to record the Munt Win32 driver version because its sound doesn't go through DOSBox's internal mixer. Both recordings were made at 48000Hz, 16bit and then compressed to joint stereo 48000Hz 160kbps CBR mp3s using WinLAME rc3 (finally got off my ass and re-downloaded it).

Sorry they're still big, but at least they're only 10% of the size of the original wav recordings.

Reply 11 of 41, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

There have been significant changes in the cvs since the last munt release. Unless you're building the win32 driver from cvs as well...
But yeah...it's kinda pita to keep both sources in sync 😀

Reply 12 of 41, by static-

User metadata
Rank Member
Rank
Member

sounds cool dude. I'd be curious to check out your bin and compare it with a few other games. Let me know if you get around to posting your bin 😁

Thanks for ripping those m3ps.

Reply 13 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

The Win32 driver recordings are from the last official release, as I don't have Visual Studio installed and set up to compile the CVS sources.

It's been two months since the last change to the Munt CVS, but much longer since the last Win32 driver release. I also see that KingGuppy hasn't made any significant changes to the SCUMMVM flavor of Munt, which sometimes gets updated first.

Reply 14 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Okay, you twisted my arm. Included is:
- dosbox.mt32.exe, built from latest DOSBox CVS (5/26/05) and Munt CVS
- dosbox.conf set to mt32 mode @ 48KHz (modify as desired)
- SDL.dll from 1.2 CVS tree, modified to use hardware DirectX surfaces
- CVS changelogs for versions of DOSBox, SDL 1.2, and Munt used in this package (open in something other than notepad - such as wordpad - since they're in Unix text format)

Notes:
- Compiled with Athlon XP optimizations, so if you're on something else then I don't know what will happen
- You'll need files not in this package to make it run (e.g. MT-32 ROMs)
- I don't add in extra goodies (except for NASM optimizations) like networking, OGG, PNG, etc. It's pretty much a vanilla build except for MT-32 support

Reply 15 of 41, by static-

User metadata
Rank Member
Rank
Member

Dude, awesome! Thanks for this. I'm gonna try it now =)

Cheers!

Reply 16 of 41, by canadacow

User metadata
Rank Member
Rank
Member

Thanks for the help with releasing a build. I really should get off my ass and do a full official build. To be honest with you I'm a little afraid to release the control panel app since its still in .NET and uses the Roland face-plate and all. We'll see.

In other news, my life is slowing down a bit again so I should get more time work on this again.

Reply 17 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

canadacow! That's great news. I'd love to see a new Win32 driver build, epecially if it has new control panel features.

What kinds of things are you thinking of working on if/when you spend some time on Munt in the near future?

Also, no problem on releasing the build. If I was less lazy I'd probably at least make a new pair of patches, but that would take some work especially since I haven't done it before.

Reply 18 of 41, by Snover

User metadata
Rank l33t++
Rank
l33t++

It would be nice to remove .NET, as I don't have it installed and I have no desire for it to be installed 😀

Yes, it’s my fault.

Reply 19 of 41, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Probably, but it'd be worth putting up with .NET to get a sexy control panel, n'est-ce pas?