Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

midiOutOpen on Windows 10 using Microsoft GS Wavetable Synth fails

I have an application that relies on the in built Microsoft GS Wavetable Synth. It has worked flawlessly on Windows XP, Vista, 7, 8 and 8.1. While the first call to midiOutOpen on Windows 10 works, subsequent calls result in error code 1, meaning 'Unspecified error'. The code is simple:

result = midiOutOpen(&_midiOutHandle, midiOutputDevice, NULL, 0, CALLBACK_NULL);

Any ideas regarding how to resolve this hugely appreciated.

like image 315
fhevol Avatar asked Jul 31 '15 18:07

fhevol


People also ask

Can I disable Microsoft GS wavetable synth?

Right click on Start and select Device Manager. Click on View menu and click on Show hidden devices. Expand Software devices. Right click on Microsoft GS Wavetable Synth and select Disable device and click Yes to confirm the action.

What is GS Software wavetable synthesizer?

Microsoft GS Wavetable Synth is the MIDI Synth that is bundled with Windows releases. It is licensed by Roland and based on the first release version of Virtual Sound Canvas, at the time a commercial product.


1 Answers

I see it. Tracing through the machine code, I see the modMessage() function fail and return MMSYSERR_ERROR. Exactly why isn't clear to me, it looks like a missing initialization problem.

What is strange about this mishap is that there are not a lot of complaints about it, you'd expect plenty of other programs fall over as well. Or for that matter for them to be tested before Win10 shipped. Next thing I tried is adding the one thing that happens in any non-trivial audio app that I skipped in my test program. Partly inspired by seeing "ATL" back in the symbols of modMessage, although it wasn't anywhere close. I added this as the first line in main():

   CoInitializeEx(NULL, COINIT_MULTITHREADED);

Badaboom, no more error. Use COINIT_APARTMENTTHREADED if you call this on the main thread of a UI thread. CoUninitialize() at the end to clean up.

Explaining it is difficult, initializing COM should not be necessary when you use MIDI. With it in place, calling midiOutOpen gets one more DLL loaded, clbcatq.dll. That's a COM+ support module. So sure looks like Win10 requires COM to be initialized.

like image 80
Hans Passant Avatar answered Oct 21 '22 02:10

Hans Passant