About how to send MIDI information from Unity.

I am trying to build a Midi controller that can controlled by Leapmotion. So I want to use Unity to build this. But is anyone know how to send MIDI information out from Unity? I already bought MIDI Unified. But I dont know how to use it for setting how to send midi information.
Please help me.
Thank you very much.

@wzhao19871001

This is my first posting and the lines of my message are going to be messy. Variable names are in spanish too, but they should be easy to understand.

I hope that you were able to solve your problem. Just in case it helps, I had to struggle with the same problem. This lines of code are working for me:


int canalMidiForiero = 15;

if (MidiOut.channelCache [canalMidiForiero].notes [p_notaEnFormatoMidi].on == true)
{
    int canalOcupado = canalMidiForiero;
    canalMidiForiero = BuscarCanalForieroLibre (p_notaEnFormatoMidi);
    Debug.Log ("CANAL FORIERO " + canalOcupado + " CHANNEL IS BUSY, maybe the note won't sound. I choose the channel  " + canalMidiForiero);
}

MidiOut.SetInstrument (instrumentacionVoces [voz], canalMidiForiero); // instrumento, canal 

MidiOut.NoteDispatch (p_notaEnFormatoMidi, segs - 0.01f, 0f, (int)volumenMidiCalculado, canalMidiForiero);

int  BuscarCanalForieroLibre (int notaFormatoMidi)
{
    for (int canalLibre = 0; canalLibre < 16; canalLibre++)
    {
        if (MidiOut.channelCache [canalLibre].notes [notaFormatoMidi].on == false)
        {
            return (canalLibre);
        }
    }

    return (0);
}