VirtualMIDISynth "looses connection" with a game

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!
Posts: 3
Joined: April 23, 2018 - 23:44
VirtualMIDISynth "looses connection" with a game

I have a weird problem. There's a game that depends on DirectMusic for playing MIDI and it uses the default port, which is Microsoft Synthesizer. Using Microsoft Detours, I'm injecting a DLL I wrote into the process address space which hooks IDirectMusicPerformance::AddPort and creates a port linked to VirtualMIDISynth #1. The problem is that it works fine on the first run (after reboot), but not on the successive runs. First I create the port with IDirectMusic::CreatePort, then add it to the performance with IDirectMusicPerformance::AddPort, then activate the port with IDirectMusicPort::Activate and finally, assign performance channel block with IDirectMusicPerformance::AssignPChannelBlock - all these calls succeed, but the music is not playing.

Both Munt MT-32 emulator and Microsoft Synthesizer work as expected every time I start the game, so I'm pretty sure the problem is with VirtualMIDISynth.

The problem, it seems, is that VirtualMIDISynth sometimes "looses connection" with the game while the game is still running. Looking in the About window as I start the game I see the process name, but few seconds later, it changes to "free".

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: VirtualMIDISynth "looses connection" with a game

VirtualMIDISynth 2.4.0 was released today; it fixes some issues on device open/close at driver side.
You should update to it and check if it fixes your issue.

Also, I wonder if you already tried CoolSoft MIDIMapper to let the game use VMS without DLL injections.
It should be a better choice other than DLL injection and process patching...

Posts: 3
Joined: April 23, 2018 - 23:44
Re: VirtualMIDISynth "looses connection" with a game

Grateful for your reply and suggestions.

I've tried CoolSoft MIDIMapper just now. During the installation, I've got the following error message "Error executing the command RegisterDriver through x64 proxy: Process must exit before requested information can be determined", so I uninstalled it, rebooted my PC and tried to install it again. This time the installation process went smoothly, but after that I still got the similar message (probably from the configurator tool): "Error executing the command GetMIDIDevices through x64 proxy: Process must exit before requested information can be determined". I've tried it anyway and I'm not sure if it's because of this problem, but MIDIMapper didn't work for the game.

As for the newly released VirtualMIDISynth 2.4.0, the problem still persists. I've started the game 4 times in succession, starting it and then quitting (not too quickly though, to give VMS some time to acknowledge that the process was no longer running) - the first 3 times all was fine, on the 4th it lost connection with the game again. I think I never had this problem until I upgraded to Windows 10.

If you have the time to look into it, I can upload the demo of the game (it's only about 30mb I think) and my DLL/injector.

Posts: 3
Joined: April 23, 2018 - 23:44
Re: VirtualMIDISynth "looses connection" with a game

Here's to illustrate what happens. Working as it should:

https://www.youtube.com/watch?v=C0y-Ga7Nqhw

Not working, suddenly the connection between VMS and the game is lost:

https://www.youtube.com/watch?v=_o-MLJddYKQ

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: VirtualMIDISynth "looses connection" with a game
Solanacean wrote:
I've tried CoolSoft MIDIMapper just now. During the installation, I've got the following error message "Error executing the command RegisterDriver through x64 proxy: Process must exit before requested information can be determined", so I uninstalled it, rebooted my PC and tried to install it again. This time the installation process went smoothly, but after that I still got the similar message (probably from the configurator tool): "Error executing the command GetMIDIDevices through x64 proxy: Process must exit before requested information can be determined". I've tried it anyway and I'm not sure if it's because of this problem, but MIDIMapper didn't work for the game.

There should be something preventing MIDIMapper.ConfiguratorProxy.exe to run correctly (antivirus? antimalware?)
MIDIMapper.ConfiguratorProxy.exe is an x64 binary used by MIDIMapper.Configurator.exe (which is an x86 binary) to read/configure x64 MIDI devices.

It will be great if you could run a quick test for me, if possible, to check what's wrong:

  1. open a command prompt into CoolSoft MIDIMapper installation folder (usually C:\WINDOWS\SysWOW64\MIDIMapper or C:\WINDOWS\System32\MIDIMapper)
  2. run command MIDIMapper.ConfiguratorProxy.exe /GetMIDIDevices (beware of case of /GetMIDIDevices parameter)

You should get a list of x64 MIDI devices as reply, like this:

C:\WINDOWS\SysWOW64\MIDIMapper> MIDIMapper.ConfiguratorProxy.exe /GetMIDIDevices
0:CoolSoft MIDIMapper
1:Microsoft GS Wavetable Synth
2:VirtualMIDISynth #1
3:VirtualMIDISynth #2
4:VirtualMIDISynth #3
5:VirtualMIDISynth #4

If you got any other output or error please post it here.

Solanacean wrote:
If you have the time to look into it, I can upload the demo of the game (it's only about 30mb I think) and my DLL/injector.

Of course I'll try to have a look (time permitting); upload it to a filelocker (like WeTransfer) and post the link here.
Please prepare, if possible, a fool-proof archive with a ready-to-use and preconfigured setup, together with some instruction steps on how to reproduce the issue ;)
You said it's a demo, so I suppose it's freely distributable; anyway if you don't like the content to be public, make a password protected archive and send me the password by email (use the account you're receiving forum notifications from).

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: VirtualMIDISynth "looses connection" with a game

I've fixed a bug in driver<-->server watchdog that caused unexpected client disconnection.

The fix has been applied to the current 2.5.x beta version here.
Please test it and report your feedback in this thread.