WindowsMidiInputMBS.Open "There is not enough memory available..."

I find that it is possible to get the Windows MIDI system in such a state that any attempt to call Open on an instance of WindowsMidiInputMBS results in LastError = 7, which is "There is not enough memory available for this task. Quit one or more applications… " etc. There is certainly plenty of memory available for both the Xojo app and the system; I don’t believe that that’s really the problem.

It’s not just my own code that exhibits this behavior, the example project included with MBS plugins does it, too, once Windows has gotten into this state:

memory error 2

Quitting the application and relaunching does not solve the issue, nor does any combination of closing the port, instantiating a new one, etc. The only way I’ve found to clear the issue is to disconnect the MIDI device from the USB and reconnect it, then everything works OK again. It’d be great if there was a way to do it programmatically, as telling my users to disconnect and reconnect is not an appealing solution.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.