waddlesplash / QMidi

Qt library for MIDI output & MIDI file I/O.
MIT License
84 stars 38 forks source link

MacOS (11.4 and others) with multi Midi devices #28

Open Yutang31 opened 3 years ago

Yutang31 commented 3 years ago

Hello,

QMidi library does not return an error on connection but I encounter a problem during its use in case where there are several devices available in list returned by QMidiIn::devices(). In all cases, QMidi connects to first device in list according to selected device.

Bless Yutang

Yutang31 commented 3 years ago

I think that problem is on deprecated function "MIDIInputPortCreate" that must be replaced by "MIDIInputPortCreateWithProtocol"

waddlesplash commented 3 years ago

I did not write the macOS backend and I'm not very familiar with it. Perhaps @CodeforEvolution or @mickymuis might be able to comment?

pauloord123 commented 2 years ago

In QMidi_CoreMidi.cpp line 54 a new NativeMidiOutInstances is created. This prevents other ports to connect. I changed this to: if (!fConnected) //only with first connect fMidiPtrs = new NativeMidiOutInstances; and comment/delete lines 50 and 51

With a new call to connect you can switch between different ports/devices.