Fix for Linux ALSA MIDI Input devices with multiple inputs

Bit of an obscure one, but there is a problem with Linux ALSA MIDI Input devices when you have devices with multiple ports with the same name. For example, the drivers for my Axiom 25 have 2 ports (one for USB, one for the 5pin MIDI connector.)

In juce_linux_Midi.cpp iterateDevices, you do detect this situation and resolve it with a swift call to appendNumbersToDuplicates. This is fine when iterateDevices is called to iterateDevices, but when this function is called to retrieve a handle to a specific device, the while loop terminates with a break when a match is found. This causes a problem because it means the list doesn’t contain every device, which means duplicates aren’t detected, which means the name given to a device is different depending on the value of the deviceIndexToOpen parameter.

It’s an easy fix: remove the break at line 116.

returnedHandle = seqHandle; break;

Should be

returnedHandle = seqHandle;

Removing it doesn’t appear to be cause any other problems. I did however notice that this fix means that the portInfo for the selected device is now free’d, where before it wasn’t (which I strongly suspect was a memory leak.)

Ah! That certainly is obscure, but many thanks for the fix!