thestk / rtmidi

A set of C++ classes that provide a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI) and Windows (Multimedia)
Other
986 stars 274 forks source link

Cannot open certain port on Windows #234

Open crankedguy opened 3 years ago

crankedguy commented 3 years ago

Hello, I opened this issue on python-rtmidi as I have problems opening a certain Midi port with rtmidi which works flawlessly in other applications.

https://github.com/SpotlightKid/python-rtmidi/issues/78

As the issue happens in the rtmidi code here https://github.com/thestk/rtmidi/blob/84d130bf22d878ff1b0e224346e2e0f9e3ba8099/RtMidi.cpp#L2604 I decided to ask also here about the issue

Basically you have the following ports D:\Development\Push2\push2-captureone>python try_rtmidi.py Bome MIDI Translator 1 0 Ableton Push 2 1 MIDIIN2 (Ableton Push 2) 2

You can open the first 2 ports without any issue but if you want to open port 2 "MIDIIN2..." you get the following error from rtmidi Traceback (most recent call last): File "D:\Development\Push2\push2-captureone\try_rtmidi.py", line 10, in midiin.open_port(2) File "src/_rtmidi.pyx", line 586, in rtmidi._rtmidi.MidiBase.open_port File "src/_rtmidi.pyx", line 220, in rtmidi._rtmidi._cb_error_func File "src/_rtmidi.pyx", line 408, in rtmidi._rtmidi._default_error_handler rtmidi._rtmidi.SystemError: MidiInWinMM::openPort: error creating Windows MM MIDI input port.

Hope you can help with that as I cannot see any issue with this port. It works, sends and receives data.

Thanks

SpotlightKid commented 3 years ago

My suspicion would be that it has to do with the parentheses in the port name, but I'm only guessing.

crankedguy commented 3 years ago

That was actually my first guess when I saw it, that this goes into the direction of a parsing error/not allowed chars in the name

SpotlightKid commented 3 years ago

It would be helpful, if RtMidi included the the error code in the return value of WinMM midiInOpen in its error message.

jean-emmanuel commented 3 years ago

I'm also interested in this, having some users on Windows reporting similar issues (although not necessarely related to parentheses in port names). Any chance this is related to the limitation mentionned in https://github.com/thestk/rtmidi/issues/102 ?

crankedguy commented 3 years ago

@jean-emmanuel Hi, thanks for this hint. That seems to be exactly the problem. I now opened the other port in BOME Midi Translator Pro. And then I can't open the - before working - port in rtmidi anymore. This is typical for all that Windows sh.t. Nothing works really practical. So it has nothing to do with parenthesis and is obviously not a bug as the WIN10 functionality is not implemented in rtmidi.

For now that renders my whole application unusable where I spent 3 full days now on figuring out how to hack this thing. I need to have the same port open both from BOME Midi Translator and from my own application.

If anyone knows any solution for this using python please leave me a message. Many thanks

SpotlightKid commented 3 years ago

@crankedguy You need to use a virtual midi cable solution. For example http://www.tobias-erichsen.de/software/virtualmidi.html.

crankedguy commented 3 years ago

@SpotlightKid Yea I just realized after writing this that I can use virtual routing out of BOME Pro directly, so I am thinking of routing the in port I use in BOME to a Virtual Out Port which routes to another Virtual In port that I use in python then.

Thanks

insolace commented 2 years ago

It would be helpful, if RtMidi included the the error code in the return value of WinMM midiInOpen in its error message.

In the past I've had to manually pipe the error codes out using cout to troubleshoot the issue, so I would welcome this change.