Search Unity

Integrating RTMidi with Unity

Discussion in 'Scripting' started by TheCheese, Jul 8, 2015.

  1. TheCheese

    TheCheese

    Joined:
    Nov 25, 2009
    Posts:
    82
    rtMidi is "A set of C++ classes that provide a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI) and Windows (Multimedia)". [https://github.com/thestk/rtmidi]

    The library amounts to 2 header files and a cpp file. I would like to implement rtMidi as a plugin in Unity, but I have no idea where to begin.

    My first question would be whether it is necessary to compile any of the given rtMidi code? Or can I just import the c++ files and access what I need in c# as is?

    Thanks!
     
  2. eisenpony

    eisenpony

    Joined:
    May 8, 2015
    Posts:
    974
    True, but that cpp file is almost 3000 lines long. Ouch.

    There is good documentation on this topic: http://docs.unity3d.com/Manual/Plugins.html
    Have you tried following that? Is there a particular step you are stuck on?

    rtMidi will need to be compiled first. Then you will reference the assembly from C# using interop services.

    Microsoft has some more documentation on interop here: https://msdn.microsoft.com/en-us/library/sd10k43k(v=vs.90).aspx
     
  3. NicolasHognon

    NicolasHognon

    Joined:
    Nov 15, 2010
    Posts:
    32
    hello
    did you succeed to use RtMidi with unity ?
    I'll certainly use a midi device for a forthcoming project ...
    And if no one has done it I'll certainly make my own integration for win32 and osx (and share it).
     
  4. wildgoose789

    wildgoose789

    Joined:
    Feb 7, 2023
    Posts:
    5
    Has anyone had any further luck with this? I have been using keijiro's minis within a unity project no issues however I want the quest to recognise midi / a midi keyboard when plugged in directly. I notice rtmidi is now meant to be android compatible, so is this the best solution or is there another? if it is how best to integrate this into a unity project for a relative novice? thanks in advance!