Support for the Windows 10 WinRT MIDI API

Hi all.

Following some recent fixes in the latest version of Windows 10 (1809, October 2018 Update) JUCE is now compatible with the WinRT MIDI API. From this commit

https://github.com/WeAreROLI/JUCE/commit/d83360a7714700ddc7aa145eb55746d205ca88e2

selecting the JUCE_USE_WINRT_MIDI option in the juce_audio_devices module will mean that when running on the latest version of Windows and beyond your JUCE apps will use the new MIDI API. On Windows versions before this your code will automatically fall back to using the older Win32 API.

BREAKING CHANGE: This behaviour is slightly different to what we had previously. If you are already using the JUCE_USE_WINRT_MIDI option then you must also set the preprocessor macro JUCE_FORCE_WINRT_MIDI to continue using with WinRT API on versions of Windows with problematic MIDI stacks.

The primary benefit of using the WinRT MIDI API is that Bluetooth Low Energy MIDI devices are supported, but you should also see a speed increase when sending large amounts of data over a connection.

You will probably need to download the Windows Standalone SDK to get the WinRT headers necessary to compile the new WinRT interface, and you may also need to add the path to these headers to your compiler search paths. If required, the path to the headers will be something similar to C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt.

When using the WinRT MIDI API there are a few key differences to the old Win32 API:

  1. The advertised MIDI device names will be different. Over USB devices will likely have a [n] suffix on their name (or (n) if it has unified IO) where n is an integer. Over BLE the device will be named something like DeviceName (Bluetooth MIDI IN).
  2. Over BLE the devices will always be shown as “available” via the WinRT API once they are paired. Attempting to connect to an absent BLE device will take a while before the request hits a timeout.

It’s also difficult to get the latest version of Windows to try things out on. The current public rollout, scheduled for October, has been paused as the update was deleting some users’ files. You can, however, force update to the latest version by signing up to the Windows Insider programme.

4 Likes

Awesome. Thanks for all your hard work, Tom!

Pete

Tom, it’s my understanding that the numeric suffix is not an indicator of input or output, but rather an index for people who have more than one of the same device. Without the index, multiples of the same device would be indistinguishable from each other in the list of MIDI devices.

3 Likes

Thanks for spotting that - I’ve updated my post.

Just a heads-up for Windows MIDI devs. The october 2018 update is available again.