llloret / osmid

osmid is a tool to bridge MIDI and OSC. It is currently in use in Sonic Pi
Other
72 stars 12 forks source link

Support for multiple similar out ports #22

Closed samaaron closed 5 years ago

samaaron commented 7 years ago

With two similar USB MIDI ports connected, I am only able to send MIDI events to one of the devices despite using the * identifier.

Here's the MIDI input listing:

λ ./m2o -l
Found 4 MIDI inputs.
   (0): E-MU Xmidi 2x2 Midi In 1
   (1): E-MU Xmidi 2x2 Midi In 2
   (2): E-MU Xmidi 2x2 Midi In 1
   (3): E-MU Xmidi 2x2 Midi In 2

However, MIDI events sent to * only appear on one of the devices.

This raises an additional question: how do I refer to each device independently? Is the sticky index part of its name?

samaaron commented 7 years ago

Additionally...

With the following listing:

λ ./m2o -l
Found 4 MIDI inputs.
   (0): E-MU Xmidi 2x2 Midi In 1
   (1): E-MU Xmidi 2x2 Midi In 2
   (2): E-MU Xmidi 2x2 Midi In 1
   (3): E-MU Xmidi 2x2 Midi In 2

When I pull one of the devices out and ask for the listing again I see:

λ ./m2o -l
Found 4 MIDI inputs.
   (0): E-MU Xmidi 2x2 Midi In 1
   (1): E-MU Xmidi 2x2 Midi In 2

which makes sense. If I plug the device back in and ask for a listing I see:

λ ./m2o -l
Found 4 MIDI inputs.
   (0): E-MU Xmidi 2x2 Midi In 1
   (1): E-MU Xmidi 2x2 Midi In 2
   (2): E-MU Xmidi 2x2 Midi In 1
   (3): E-MU Xmidi 2x2 Midi In 2

So far so good.

However, when I detach the other devices I see:

λ ./m2o -l
Found 4 MIDI inputs.
   (0): E-MU Xmidi 2x2 Midi In 1
   (1): E-MU Xmidi 2x2 Midi In 2

this is surprising. I was expecting to see:

λ ./m2o -l
Found 4 MIDI inputs.
   (2): E-MU Xmidi 2x2 Midi In 1
   (3): E-MU Xmidi 2x2 Midi In 2
samaaron commented 7 years ago

Ah, this is probably because I'm running the command fresh every time and the stickiness doesn't work across processes ;-)

However, when looking at the debug of the heartbeat messages for both devices connected I see:

[2017-01-26 17:17:02.458] [console] [debug] *2017-01-26 17:17:02.458473*: : sending OSC: [/o2m/heartbeat] ->
[2017-01-26 17:17:02.458] [console] [debug]    0, E-MU Xmidi 2x2 Midi In 1
[2017-01-26 17:17:02.458] [console] [debug]    1, E-MU Xmidi 2x2 Midi In 2
[2017-01-26 17:17:02.458] [console] [debug]    0, E-MU Xmidi 2x2 Midi In 1
[2017-01-26 17:17:02.458] [console] [debug]    1, E-MU Xmidi 2x2 Midi In 2

Which doesn't match the ./m2o -l listing which also has devices 2 and 3.

samaaron commented 7 years ago

Perhaps one solution to addressing multiple similar ports is to also allow the port name to be specified by its integer index rather than the string name.

samaaron commented 7 years ago

This explains the discrepancy between the sticky port IDs in the -l listing and those in the OSC heartbeat messages:

https://github.com/llloret/osmid/blob/master/src/o2m.cpp#L51

The -l listing just prints an incrementing integer :-)

llloret commented 5 years ago

Hi, @samaaron, is this still an issue?

samaaron commented 5 years ago

Good question! I no longer have two identical out devices to try this out on...

llloret commented 5 years ago

Ok, I think you already figured out that the -l is a short-lived execution of the m2o server, so any stickiness will be lost when you run it again. That is why the best it can do is show an incrementing integer.

I am not sure I understand the origin of the thread, though. You mention sending MIDI events to the MIDI inputs with m2o, but m2o RECEIVES events from MIDI and sends to OSC...

samaaron commented 5 years ago

Yeah, it does seem a bit confused. I'm happy to close this now as I'm not having issues with this anyway, and if I come across something more specific in the future we can discuss that in a different issue :-)

llloret commented 5 years ago

Thank you!

On Thu, 6 Jun 2019 at 16:21, Sam Aaron notifications@github.com wrote:

Closed #22 https://github.com/llloret/osmid/issues/22.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/llloret/osmid/issues/22?email_source=notifications&email_token=AAJOL47UI7XRIWBYGACFY5DPZETRFA5CNFSM4C53RGFKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOR26J64I#event-2394726257, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJOL44IZ7YZ4IRWHBZPACTPZETRFANCNFSM4C53RGFA .