RtMidi.Output.Device Class

 

About RtMidi.Output.Device Class

 

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

 

RtMidi.Output.Device Class Methods

 

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

 

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

uint DeviceIndex: zero-based index of the device.

 

RtMidi.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.

 

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

 

RtMidi.Output.Device.Close() closes an open MIDI Output device (if exists).

 

Code Example

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

public class CodeExample : MonoBehaviour
{

void Awake()
{
RtMidi.Initialize();//Initializes RtMidi

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

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

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

}

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

}

 

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.