Skip to content

Releases: microsoft/MIDI

Removing some friction: SDK interim developer preview 002

02 Jul 21:57
e29b263
Compare
Choose a tag to compare

Similar use as the previous release: this is primarily for testing that you can build your apps against the SDK.

Note: As before, many method calls will result in no-impl errors. This is by design. To know which methods are supposed to be working, look at the sdk-core-cpp-winrt-tests project and look at the test cpp files in there. All tests in the SDK project are currently passing.

Updated Targets in NuGet Package

The dll, winmd, and pri files are all copied to the output directory now. The Pri file isn't currently used, but will be in the future. The WinMD file is needed for compilation, but not to run. The DLL is required with your application.

When compiling an app using the SDK

  • Add the NuGet package (use a local package respository. I use D:\peteb\Documents\GitHub\microsoft\midi\publish\ and have it set up in the NuGet Package Manager in Visual Studio
  • If you see an error about a missing MIDI header file, build or rebuild the project.

New dependency for building the SDK

You don't need to build the SDK, but if you want to, you'll need the new dependency.

The Windows MIDI Services SDK has a dependency on boost 1.82 header libraries because I hate reinventing things. The root Boost install folder should be in the system environment variable %BOOST_ROOT% and in your Visual Studio project include path for all build configurations. This is internal, though, and only a consideration if you are building the SDK yourself.

Breaking changes in SDK

  • CheckForWindowsMidiServices has different signature and updated return type now
  • MidiSession uses an IMapView instead of IVector for the list of endpoint connections. This gives you O(1) access to the endpoints without you having to keep your own list
  • Session.ConnectToEndpoint has the redundant boolean parameter removed
  • Probably a few others, but we're not yet at the point where we track them that closely

Faked results

Some calls, like MidiServices::CheckForWindowsMidiServices() return fake results right now.

Updated Sample

The sdk-client-basics sample has been updated to use the NuGet directly, and to be in line with the SDK changes. I've also commented out a few lines that throw exceptions right now so you can run it without getting thrown into the debugger.

SDK-local inproc loopback for testing

This has not yet been implemented, but you may see some of the code and wonder about it.

  • This is an SDK-only MIDI loopback that you'll be able to use for testing in future builds. It has no dependency on the MIDI Services Windows Service or API.
  • I've started implementing this, but it is not currently functional beyond creating the stub of the endpoint. If you try to use it beyond simply creating the two UMP Endpoints, expect errors.

NuGet and Code below are in sync. I will not update this release in any way that gets them out of sync

Thanks to Geil Bremmers and muzak for their testing of the previous preview!

Updated: Core SDK Shape Developer Preview 1

26 Jun 20:09
fd31e77
Compare
Choose a tag to compare

PLEASE READ THIS ENTIRE POST

Note: Rather than create a new release, I've updated this one. I won't usually do that, but really this was about getting a first release that folks can compile against, and the previous NuGet package failed there. The source code in the zip is out of date.

I know many DAW and audio developers are new to WinRT, so this release is to help you get started with it and also to be able to look at the SDK in the context of your own project, and provide feedback. The Core SDK is neither complete in shape nor functional. The packages in this release are for Intel x64 architecture only, not Arm64.

ALMOST ALL SDK CALLS WILL FAIL WITH AN EXCEPTION. THIS IS BY DESIGN

The implementation of almost every method call is this:

throw hresult_not_implemented();

One exception to that (no pun intended) is the MidiServices::SdkVersion call. That will return a valid string. You can use that to verify you can call methods/properties and that the toolchain is working for you. Additionally, there's now a DummyClass which you can use to verify calls work. See the SDK Test project for an example of calling that.

The intent here is to provide a set of .winmd and .dll files that developers can use to make sure they are able to reference the WinRT library and call functions in their code.

Please refer to this documentation for getting set up:

For developers (C++) who need to access the DLL and WinMD directly, here are the steps. Right now, everything is part of the same NuGet package and installation is somewhat manual. That will change in the future as we break everything out by the type of client.

Current Way for Visual Studio:

  1. Set up a local NuGet Package Repository on your dev PC. On my setup, it's the "publish" folder under the "midi" root of the GitHub project. Easiest way to do this is to go into the NuGet Package Manager, click the settings button, and then add a local repo. I called mine "MIDI Services Local" and have the SDK NuGet generation steps throw the files in that folder.
  2. Put the downloaded NuGet package in that folder
  3. In the Project, add a NuGet reference to the package (Manage NuGet Packages)
  4. After that, until the .targets are set up properly, there's one manual step: in the same project, click "Add Reference" and then "Browse" to the project file's packages subfolder, then to the folder for this NuGet package, and in there, down to the runtimes\win10-x64\native folder (there will be a .winmd a .dll, and a .pri file in there) and reference the .winmd directly. This will force C++/WinRT to generate the projection. And, if you were building the sample project, remove the error about the missing Microsoft.Devices.Midi2.h file.

Alternative way for all tools:

  1. If you do not have Visual Studio 2022 installed, and don't plan to use it, then install the latest VC runtime for your platform. NOTE: The first preview here will only work with setups that have Visual Studio 2022 installed as it has a dependency on the debug VC++ runtimes. Working on it.
  2. Download the NuGet package.
  3. Change the file extension of the package to .zip from .nuget
  4. Inside the file, copy the .winmd and .dll files from runtimes\win10-x64\native\ to your project. Put them both in the same folder.
  5. In Visual Studio, add a reference to the .winmd file (see Get Started documentation in this repo for more information on this, including using with other toolchains.)

The root namespace is Microsoft::Devices::Midi2

Everything (SDK calls, namespaces, etc.) is subject to change, but it is getting more solidified over time. Feedback and discussion welcome in GitHub and on Discord.

Note: the C# projection is in the same NuGet package. Please see the Gett Started documentation for how to use the C# NuGet.