-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Windows UWP MIDI API to enable BLE MIDI (Bluetooth MIDI) #299
Conversation
This commit upgrades a Visual Studio solution/project from VS2008 to VS2019. `msw/` contained the Visual Studio 2008 project. Now, you can use the solution file `msw/rtmidilib.sln` to build a static library with Visual Studio Community 2019.
This commit upgrades a Visual Studio solution/projects in `tests/` to VS2019. `tests/` contained the old Visual C++ projects. Now, you can use the solution file `tests/RtMidi.sln` to build test commands with Visual Studio Community 2019.
There was no VS project for test commands apinames, midiclock, testcapi. This commit adds them.
The macro that is pre-defined in the compilation for the Windows environment is `_WIN32`. This commit fix to determine by `_WIN32` instead of `WIN32`.
C++/WinRT is required to use Windows UWP MIDI.
This commit adds new WINDOWS_UWP API enum and name to use Windows UWP MIDI.
This commit adds the new macro `__WINDOWS_UWP__` definition to the VS2019 project for using Windows UWP MIDI.
This commit adds new `MidiInWinUWP` and `MidiOutWinUWP` classes and its stub member functions to use WINDOWS UWP.
This commit adds the class `UWPMidiClass` to handle UWP MIDI, its stub member functions, and the construction/cleanup of its instance.
This commit adds functions to find and create a list of UWP MIDI ports. Now, we can get and handle the number of UWP MIDI ports.
This commit adds functions to treat UWP MIDI device name as port name. Now, we can get UWP MIDI device names.
In UWP MIDI, device names may be duplicated, however still be distinguished by their ID strings. The port ID string contains eight hexadecimal digits that uniquely identify the port. Therefore, the port name can be made unique by using this digits appended to the device name as the port name.
There is an issue on Windows 10 UWP MIDI that the MIDI OUT port names for the conventional MIDI devices are all the very same `MIDI`. This commit add function to fix the MIDI OUT port names to MIDI IN port names with similar ID strings.
The commands in `tests/` did not have the function to select the MIDI API. This commit enables the commands to choose which API to use when RtMidi is compiled with multiple APIs.
The API may raise an `hresult_error` exception. This commit adds a function that raises it as an error of RtMidi.
Now, we can open and close UWP MIDI ports.
Now, we can send MIDI messages to UWP MIDI ports.
I've implemented MIDI port open/close and MIDI message output. |
Now, we can receive MIDI messages from UWP MIDI ports.
The port specification with command line options was ignored when API was specified. The port name of number 0 was displayed even if a port number other than 0 was specified. This commit fixes them.
tests/sysextest.cpp may not accept key input when selecting whether or not to use a virtual port, making it impossible to make a selection. tests/cmidiin.cpp did not have this issue. This commit fixes tests/sysextest.cpp to prevent the issue in the same manner as tests/cmidiin.cpp.
I've implemented MIDI message input. |
The time type TimeSpan used in C++/WinRT has 100 nanosecond periods, not nanosecond periods. Substituting it into std::chrono::nanoseconds causes an extra conversion of the period. This commitment suppresses the extra conversions by using a variable with the same period as TimeSpan instead of std::chrono::nanoseconds to store time.
At least in Windows 10 21H2, UWP MIDI produces wrong timestamps from BLE-MIDI IN ports. https://github.com/trueroad/BLE_MIDI_packet_data_set#page-7-overflow-low https://github.com/trueroad/BLE_MIDI_packet_data_set#page-7-overflow-both This commit adds a workaround that fixes the wrong timestamps.
I've found that Windows UWP timestamp bug. So I've added a workaround to fix the wrong timestamps. For example, YAMAHA MD-BT01 V1.0.7 (the latest firmware) generates such BLE packets, so the timestamps are incorrect without the workaround. |
This PR adds Windows UWP MIDI API to enable BLE MIDI (Bluetooth MIDI).
In my experiment, both MIDI IN/OUT with a BLE MIDI device works fine.
Building requires: Visual Studio Community 2019
See #145