OPL3 Music Emulation in KotC

This is the place to talk about KotC, ask for help, and report bugs.

OPL3 Music Emulation in KotC

Postby Saikou » Sat Aug 10, 2019 7:36 am

Hey all! This is perhaps kind of a weird question, and almost certainly a long shot, but here goes. I was checking out the demo of KotC1 and really enjoying it, but the MSGS MIDI sound really started to wear on me after a while. I figured I really wanted to capture the feeling of the old computer-RPGs like Dark Sun the game claims to follow after, so with the help of some friends, I figured out how to set up OPL3 emulation (an FM-synthesis sound card common in the mid-to-late 90s) in Windows 10. And, as expected, when I play MIDIs out of the demo's included MIDI folder, it sounds just like those old games. However, when I boot up KotC to actually play the game, the music is the same old general-MIDI as ever.
In short, I'm wondering if this is anything I have any control over or if it's just not possible without the developer explicitly coding in support for non-default MIDI devices. It would really enhance the experience to be able to pair the old-timey sprite graphics with some period-appropriate OPL synth sounds, but as of yet my only option to do so is to keep the soundtrack folder open and swap the songs out manually with the actual game audio muted, which not only is a bit of a pain in general but also breaks the immersion pretty hard. Any help, advice, or stories of anyone doing a similar thing would be much appreciated.
Saikou
Kobold (CR 1/4)
 
Posts: 1
Joined: Sat Aug 10, 2019 7:24 am

OPL3 Music Emulation in KotC

Advert
 

Re: OPL3 Music Emulation in KotC

Postby BlueSalamander » Tue Aug 13, 2019 5:30 pm

Hello and welcome Saikou, thank you for your post. I'm afraid I don't have enough knowledge of non-default MIDI devices to be able to answer properly. Sorry about that!
'Say there is a chunk of meat. Pirates will have a banquet and eat it! But heroes will share it with other people. I want all the meat!!' - Luffy in One Piece
User avatar
BlueSalamander
Master Conjuror
 
Posts: 1438
Joined: Sun May 18, 2008 6:20 pm

Re: OPL3 Music Emulation in KotC

Postby galneon » Fri Sep 13, 2019 2:38 am

I'm an enthusiast of this sort of thing and use VirtualMidiSynth set as the default MIDI device. Unfortunately, KOTC either has a built-in MIDI player, or it's coded to throw not to the default MIDI device, but specifically to MSGS. If it's the latter, the game just needs to instead default to the default system MIDI device rather than MSGS.

This actually has nothing to do with the consistently downgraded and, as of Windows 10, now non-existent Windows MIDI device selector--3rd party programs allow you to specify a default device like before MS gutted this core OS functionality. Setting VirtualMidiSynth as the default using the related 3rd party MIDIMapper program results in the expected functionality in DOSBox and all Windows programs--except KOTC.

This is actually preventing me from doing a replay... I've been spoiled in recent years by using better soundfonts with old DOS games, and KOTC's instruments sound inferior to all of them. It's too hard to go back. :/

Pierre, if only it were picking the default device (device #0) we'd be happy. Please see if you've perhaps hardcoded Microsoft GS Wavetable Synth and could instead have the game select the default MIDI device? None of the Windows 8/10 changes are relevant for your purposes: Windows 8/10 no longer allows the user to choose a default (without an application like MIDIMapper), but enumeration is randomized and inconsistent, and whatever gets labeled device #0 is effectively the default which is selected when an application doesn't specify a destination for MIDI output.

All this means the bulk of your users who don't care much about sound won't be affected one way or the other, but those of us who do care will get proper softsynth playback.

If I've been less than clear about any of this, I'm happy to clarify. I care more about audio than graphics, and this should be a rather simple tweak (unless the game is indeed using an integrated player).
galneon
Chimera (CR 7)
Knights of the Chalice
 
Posts: 23
Joined: Fri May 29, 2015 5:44 pm

Re: OPL3 Music Emulation in KotC

Postby BlueSalamander » Wed Sep 18, 2019 6:47 pm

To be honest I know nothing about all this. I didn't write any of the MIDI playback code. I just used the old DirectX component called DirectMusic. The code to initialise DirectMusic is just the following:

IDirectMusicPerformance8* m_pDMPerformance;
IDirectMusicLoader8* m_pDMLoader;
CoCreateInstance(CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (void**)&m_pDMLoader);
CoCreateInstance(CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC, IID_IDirectMusicPerformance8, (void**)&m_pDMPerformance);
m_pDMPerformance->InitAudio(NULL, NULL, m_hWnd, DMUS_APATH_SHARED_STEREOPLUSREVERB, 128, DMUS_AUDIOF_ALL, NULL);

The relevant pages are the following:
https://docs.microsoft.com/en-us/previous-versions/ms809711(v%3Dmsdn.10)
https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/midi-and-directmusic-filters
https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/midi-and-directmusic-components

So if you know what needs to be changed, okay, I can try that. Otherwise we're stuck. :|
'Say there is a chunk of meat. Pirates will have a banquet and eat it! But heroes will share it with other people. I want all the meat!!' - Luffy in One Piece
User avatar
BlueSalamander
Master Conjuror
 
Posts: 1438
Joined: Sun May 18, 2008 6:20 pm

Re: OPL3 Music Emulation in KotC

Postby galneon » Wed Sep 18, 2019 10:47 pm

Thanks so much for the response and info! I'm going to dig around a bit.
galneon
Chimera (CR 7)
Knights of the Chalice
 
Posts: 23
Joined: Fri May 29, 2015 5:44 pm

Re: OPL3 Music Emulation in KotC

Postby BlueSalamander » Thu Sep 19, 2019 3:45 pm

Okey dokey, thank you :-)
'Say there is a chunk of meat. Pirates will have a banquet and eat it! But heroes will share it with other people. I want all the meat!!' - Luffy in One Piece
User avatar
BlueSalamander
Master Conjuror
 
Posts: 1438
Joined: Sun May 18, 2008 6:20 pm


Return to About the Knights of the Chalice cRPG

Who is online

Users browsing this forum: No registered users and 5 guests

cron