RtMidi.Output.Message Class

 

About RtMidi.Output.Message Class

 

RtMidi.Output.Message class is mainly used for sending MIDI Messages to MIDI Output devices.

 

RtMidi.Output.Message Class Methods

 

RtMidi.Output.Message.Clear() clears the MIDI Message Buffer. This function removes all bytes previously stored in the MIDI Message Buffer.

 

RtMidi.Output.Message.Size() returns the amount of bytes stored in the MIDI Message Buffer.

 

RtMidi.Output.Message.Byte( byte Byte ) Adds one byte to the MIDI Message Buffer.

byte Byte: value from 0 to 255.

 

RtMidi.Output.Message.Send() sends the MIDI Message Buffer previously created with RtMidi.Output.Message.* functions to the open MIDI Output device.

 

Code Example

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

public class CodeExample : MonoBehaviour
{

void Awake()
{
RtMidi.Initialize();///Initializes RtMidi
RtMidi.Output.Device.Open(0);//Opens the first MIDI Output Device ("Microsoft GS Wavetable Synth" by default on Windows)
}

void Update()
{

//Checks if space key is pressed
if
(Input.GetKeyDown(KeyCode.Space))
{
//NOTE C5 ON – CHANNEL 1 – VELOCITY 100
RtMidi.Output.Message.Clear();//Clears the MIDI Message buffer
RtMidi.Output.Message.Byte(144);//Adds one byte to the MIDI Message buffer
RtMidi.Output.Message.Byte(60);//Adds one byte to the MIDI Message buffer
RtMidi.Output.Message.Byte(100);//Adds one byte to the MIDI Message buffer
RtMidi.Output.Message.Send();//Sends the MIDI Message to the MIDI Output Device
}

}

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.