Midi.Output.Device Class

 

About Midi.Output.Device Class

 

Midi.Output.Device class is mainly used for retrieving information about MIDI Output devices and for opening and closing MIDI Output devices.

 

Midi.Output.Device Class Methods

 

Midi.Output.Device.Count() returns the amount of connected MIDI Output devices. This function detects connected MIDI Output devices.

 

Midi.Output.Device.Name( uint DeviceIndex ) returns a string identifier for the specified MIDI Output device.

uint DeviceIndex: zero-based index of the device.

 

Midi.Output.Device.Open( uint DeviceIndex ) opens the specified MIDI Output device. Only open devices can receive messages.

uint DeviceIndex: zero-based index of the device.

 

Midi.Output.Device.OpenAll() opens all MIDI Output devices. Only open devices can receive messages.

 

Midi.Output.Device.IsOpen( uint DeviceIndex ) returns true if a MIDI Output device is open and false if not.

uint DeviceIndex: zero-based index of the device.

 

Midi.Output.Device.OpenCount() returns the amount of open MIDI Output devices.

 

Midi.Output.Device.Close( uint DeviceIndex ) closes the specified MIDI Output device. Note that when you call Midi.Deinitialize() function or when you unplug the device it will be closed automatically by Giavapps MIDI extension.

uint DeviceIndex: zero-based index of the device.

 

Midi.Output.Device.CloseAll() closes all open MIDI Output devices. Note that when you call Midi.Deinitialize() function or when you unplug the device it will be closed automatically by Giavapps MIDI extension.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.MIDI;

public class CodeExample : MonoBehaviour
{

void Awake()
{

//Prints all available MIDI Input devices
Debug.Log("MIDI INPUT DEVICES:");
uint i;
for(i=0; i < Midi.Input.Device.Count(); i++)
{
Debug.Log(Midi.Input.Device.Name(i));
}

//Prints all available MIDI Output devices
Debug.Log("MIDI OUTPUT DEVICES:");
for(i=0; i < Midi.Output.Device.Count(); i++)
{
Debug.Log(Midi.Output.Device.Name(i));
}

Midi.Input.Device.Open(2);//Opens the third MIDI Input Device ("Oxygen 49" MIDI Keyboard in my case)
Midi.Output.Device.Open(0);//Opens the first MIDI Output Device ("Microsoft GS Wavetable Synth" by default on Windows)
Midi.Input.Device.Connect(2, 0);//Sends all received MIDI Input Messages to the MIDI Output Device ("Oxygen 49" >>> "Microsoft GS Wavetable Synth" in my case)

}

void OnApplicationQuit()
{
Midi.Deinitialize();//Deinitializes Midi
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.