I didn’t actually think to try the Emulator - I’ll try that in a bit - great idea.
For the record, I can confirm that my second-hand Nexus 5X by LG reports the MIDI service! Unfortunately, the device has a USB-C port, so I need to get an adaptor before I can test it with external MIDI hardware
It seems that not all Marshmallow devices are equal; I suspect that for many of the cheaper ones, the USB connector might not be capable of acting as a host, and therefore the MIDI service won’t be enabled. This is a bit of a minefield for Android developers and users wanting to work with MIDI!
Anyhow, I think it’d be useful if other Juce Android developers could add their devices to this thread, on which they’ve found Juce MIDi to work. Might be a useful resource.
I’d be really interested to know if Chromebooks (with Android capability) support MIDI devices, for example…
In case anybody is interested, I’ve found a few things
your users might need to have developer mode enabled, in order to configure the USB port to work with MIDI data
not all cables and adaptors work - this is particularly hard to track down - good luck!
even though a device has Marshmallow, and claims to support MIDI USB - it might not work; I’ve only yet seen it work with Nexus 5X; that might be due to cables/adaptors, of course…
when you open the Juce MIDI device, you cannot query it immediately for devices; you need to wait a bit before trying this (as the underlying Java API is asynchronous in this regard). Note to devs: ideally, the Juce MIDI API would allow a listener to be attached, so the app can be notified as devices come-and-go - that’d be far nicer than having a timer-base poller.
Hi, interesting findings. TBH, i’ve got a number of users on a number of different devices and never had any issues reported such as you describe in points 1-3.
Interesting findings Pete, thanks. Yes, it is frustrating that the behaviour is not consistent across Android devices, and it’s often the case for other functionalities too. A listener for MIDI devices becoming available / unavailable is a good feature request. We will add it to the backlog.
Another request: would it be possible for a Juce Android project to be configured such that it could run on (say) Android 4.4, but support MIDI if the device were running Android 6 or later? My understanding is that this isn’t possible right now with Juce. If I’m wrong, please let me know
Have you got a rough date for when this feature might arrive?
The reason I’m so interested, is that it affects our ability to sell effectively though the Amazon App Store (where really, you’re limited to Android 5 as a baseline for apps… due to the fact that FireOS (used by Kindles) is based on 5.1.1…)
For my own interest, I’ve dug-around, and see that code like this:
DECLARE_JNI_CLASS (MidiDeviceManager, JUCE_ANDROID_ACTIVITY_CLASSPATH “$MidiDeviceManager”)
… wasn’t designed to work with optional classes. I guess that’ll be the sort of thing you’re having to tidy-up right now!
That’s exactly the stuff we are tidying up - we will basically access the classes either through reflection or only load bytecode if we now that the depending classes are available.