Skip to content

dingari/winrt-midi-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinRT/C++ - Concurrent MIDI/BLE communications

This is a sample application written using the JUCE framework (just for GUI and some simple utility) and the WinRT/C++ library. It demonstrates a pretty strange scenario where a connection to more than one MidiInPort and their corresponding BluetoothLEDevice instance seems to severly limit the throughput of other such connections.

This sample program is performing roughly these steps:

  • Check for available MIDI devices using a DeviceWatcher.
  • Check for available Bluetooth LE devices using another instance of a DeviceWatcher.
  • Match discovered MIDI and BluetoothLE devices on their ContainerId property (see DeviceInfo for details). This is the method JUCE employs in the native WinRT code for their library, and works as expected.
  • Open the MIDI port and attach a handler to the MessageReceived event (see the code).
  • This causes the system to create a connection to the Bluetooth LE device. The program detects this state change, creates a BluetoothLEDevice, we perform GATT service discovery and attach a handler to the ValueChanged event for the characteristic we're interested in notifications from (see the code).

The program then counts how many MIDI messages are received on each port and how many BLE notifications are received from the corresponding device.

The behaviour we notice is that data from the most recently connected device streams just fine, while the throughput for the others is severly limited. We are at quite a standstill regarding this issue, and are not sure where the problem may lie.

Below are screenshots of two sample runs (about 10s each) with two devices sending MIDI messages and BLE notifications through a proprietary service. Notice that the "most recently connected" (further down the list) device recevies a bit more MIDI messages, but far more BLE packets.

alt text alt text

To build & run

The setup for this example is a bit specific, as you'd need at least two BLE MIDI devices that are actively sending MIDI and BLE notifications through a proprietary service at a pretty high rate. But I'll include this section for completeness.

  • Run git submodule update --init to get the JUCE framework.
  • You'll probably need to install the Windows 10 SDK as well, if you haven't already.

This is a CMake based project, so you can either load it up in CLion, Visual Studio, etc. Or alternatively from the command line:

cmake . -b cmake-build
cmake --build cmake-build --target WinRTMidiTest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published