MIDI

MIDI

This is an Ada implementation of the MIDI message protocol. The entire set of packages are arranged heirarchically as follows:

  • MIDI
  • MIDI.Receiver
  • MIDI.Transmitter

For example, if you only use receiving functions, you only need to use the MIDI and the MIDI.Receiver packages.

Package MIDI

This top-level package defines types and constants necessary for handling/generating the various MIDI messages.

package MIDI is
pragma Pure;

------------------------------------------------------------------
-- MIDI Data Types
------------------------------------------------------------------

type Note_Type          is new Unsigned_8   range 0..127;
type Channel_Type       is new Unsigned_8   range 0..15;
type Velocity_Type      is new Unsigned_8   range 0..127;
type Pressure_Type      is new Unsigned_8   range 0..127;
type Control_Type       is new Unsigned_8   range 0..127;
type Value_Type         is new Unsigned_8   range 0..127;
type Program_Type       is new Unsigned_8   range 0..127;

type Bend_Type          is                  range -2**14 .. 2**14;
for Bend_Type'Size      use 16;

type Manufacturer_Type  is new Unsigned_8   range 0..127;
type Beats_Type         is new Unsigned_16  range 0..2**14;
type Song_Selection_Type is new Unsigned_8  range 0..127;
type Status_Type        is new Unsigned_8;

type U8_Array is array (Unsigned_16 range <>) of Unsigned_8;
for U8_Array'Component_Size use 8;

------------------------------------------------------------------
-- I/O Procedures Used by MIDI
------------------------------------------------------------------

type Read_Byte_Proc    is access
procedure (Byte : out Unsigned_8);

type Poll_Byte_Proc    is access
function return Boolean;            -- Return True when Input available

type Write_Byte_Proc   is access
procedure (Byte : in  Unsigned_8);

type Idle_Proc         is access
procedure;

------------------------------------------------------------------
-- Initialization for MIDI I/O
------------------------------------------------------------------

type IO_Context is private;

procedure Initialize(
    Context :       in out  IO_Context;
    Receiver :      in      Read_Byte_Proc := null;
    Transmitter :   in      Write_Byte_Proc := null;
    Poll :          in      Poll_Byte_Proc := null
);

------------------------------------------------------------------
-- Compute a Serial Port Divisor for a MIDI Baud Rate
------------------------------------------------------------------

Standard_Baud_Rate :        constant := 31250;   -- Midi baud rate

function MIDI_Baud_Rate_Divisor(CPU_Clock_Freq : Unsigned_32) return Unsigned_16;

------------------------------------------------------------------
-- MIDI Commands
------------------------------------------------------------------

MC_NOTE_OFF :       constant := 16#80#;  -- Note off request
MC_NOTE_ON :        constant := 16#90#;  -- Note on request
MC_KEY_PRESSURE :   constant := 16#A0#;  -- Key pressure (AfterTouch)
MC_CTL_CHG :        constant := 16#B0#;  -- Control change
MC_PROGRAM_CHG :    constant := 16#C0#;  -- Program change
MC_CH_PRESSURE :    constant := 16#D0#;  -- Channel pressure change
MC_BEND :           constant := 16#E0#;  -- Bend (for channel)
MC_SYS :            constant := 16#F0#;  -- System message

------------------------------------------------------------------
-- MC_CTL_CHG Control values :
------------------------------------------------------------------

MC_CTL_ALLS_OFF :   constant := 16#78#;  -- All sounds off (120)
MC_CTL_RESET_C :    constant := 16#79#;  -- Reset controller
MC_CTL_LOCAL_C :    constant := 16#7A#;  -- Local on/off
MC_CTL_ALLN_OFF :   constant := 16#7B#;  -- All notes off
MC_CTL_OMNI_OFF :   constant := 16#7C#;  -- Omni off request
MC_CTL_OMNI_ON :    constant := 16#7D#;  -- Omni on request
MC_CTL_MONO_ON :    constant := 16#7E#;  -- Mono on == POLY OFF
MC_CTL_MONO_OFF :   constant := 16#7F#;  -- Mono off == POLY ON

------------------------------------------------------------------
-- MC_SYS "channel" op codes :
------------------------------------------------------------------

MC_SYS_EX :         constant := 16#00#;  -- Sys Ex transfer
MC_SYS_RES1 :       constant := 16#01#;  -- Reserved
MC_SYS_SNGPOS :     constant := 16#02#;  -- Song position
MC_SYS_SNGSEL :     constant := 16#03#;  -- Song selection
MC_SYS_RES4 :       constant := 16#04#;  -- Reserved
MC_SYS_RES5 :       constant := 16#05#;  -- Reserved
MC_SYS_TREQ :       constant := 16#06#;  -- Tune Request
MC_SYS_ENDX :       constant := 16#07#;  -- End SysEx transfer
MC_SYS_TCLK :       constant := 16#08#;  -- RT - Clock
MC_SYS_RES9 :       constant := 16#09#;  -- RT - Reserved
MC_SYS_START :      constant := 16#0A#;  -- RT - Start
MC_SYS_CONT :       constant := 16#0B#;  -- RT - Continue
MC_SYS_STOP :       constant := 16#0C#;  -- RT - Stop
MC_SYS_RESD :       constant := 16#0D#;  -- RT - Reserved
MC_SYS_ASENSE :     constant := 16#0E#;  -- RT - Active Sense
MC_SYS_RESET :      constant := 16#0F#;  -- RT - Reset

------------------------------------------------------------------
-- Some Combined MC_SYS values for convenience :
------------------------------------------------------------------

MC_SYS_EX_END :     constant := 16#F7#;  -- (MC_SYS|MC_SYS_ENDX)
MC_SYS_RT :         constant := 16#F8#;  -- (MC_SYS|MC_SYS_TCLK)
MC_SYS_SPOS :       constant := 16#F2#;  -- (MC_SYS|MC_SYS_SNGPOS)
MC_SYS_SSEL :       constant := 16#F3#;  -- (MC_SYS|MC_SYS_SNGSEL)

------------------------------------------------------------------
-- MIDI Note Values
------------------------------------------------------------------
C_0 :           constant := 12;
C_Sharp_0 :     constant := 13;
D_Flat_0 :      constant := 13;
D_0 :           constant := 14;
D_Sharp_0 :     constant := 15;
E_Flat_0 :      constant := 15;
E_0 :           constant := 16;
F_0 :           constant := 17;
F_Sharp_0 :     constant := 18;
G_Flat_0 :      constant := 18;
G_0 :           constant := 19;
G_Sharp_0 :     constant := 20;
A_Flat_0 :      constant := 20;
A_0 :           constant := 21;
A_Sharp_0 :     constant := 22;
B_Flat_0 :      constant := 22;
B_0 :           constant := 23;
C_1 :           constant := 24;
C_Sharp_1 :     constant := 25;
D_Flat_1 :      constant := 25;
D_1 :           constant := 26;
D_Sharp_1 :     constant := 27;
E_Flat_1 :      constant := 27;
E_1 :           constant := 28;
F_1 :           constant := 29;
F_Sharp_1 :     constant := 30;
G_Flat_1 :      constant := 30;
G_1 :           constant := 31;
G_Sharp_1 :     constant := 32;
A_Flat_1 :      constant := 32;
A_1 :           constant := 33;
A_Sharp_1 :     constant := 34;
B_Flat_1 :      constant := 34;
B_1 :           constant := 35;
C_2 :           constant := 36;
C_Sharp_2 :     constant := 37;
D_Flat_2 :      constant := 37;
D_2 :           constant := 38;
D_Sharp_2 :     constant := 39;
E_Flat_2 :      constant := 39;
E_2 :           constant := 40;
F_2 :           constant := 41;
F_Sharp_2 :     constant := 42;
G_Flat_2 :      constant := 42;
G_2 :           constant := 43;
G_Sharp_2 :     constant := 44;
A_Flat_2 :      constant := 44;
A_2 :           constant := 45;
A_Sharp_2 :     constant := 46;
B_Flat_2 :      constant := 46;
B_2 :           constant := 47;
C_3 :           constant := 48;
C_Sharp_3 :     constant := 49;
D_Flat_3 :      constant := 49;
D_3 :           constant := 50;
D_Sharp_3 :     constant := 51;
E_Flat_3 :      constant := 51;
E_3 :           constant := 52;
F_3 :           constant := 53;
F_Sharp_3 :     constant := 54;
G_Flat_3 :      constant := 54;
G_3 :           constant := 55;
G_Sharp_3 :     constant := 56;
A_Flat_3 :      constant := 56;
A_3 :           constant := 57;
A_Sharp_3 :     constant := 58;
B_Flat_3 :      constant := 58;
B_3 :           constant := 59;
C_4 :           constant := 60;
C_Sharp_4 :     constant := 61;
D_Flat_4 :      constant := 61;
D_4 :           constant := 62;
D_Sharp_4 :     constant := 63;
E_Flat_4 :      constant := 63;
E_4 :           constant := 64;
F_4 :           constant := 65;
F_Sharp_4 :     constant := 66;
G_Flat_4 :      constant := 66;
G_4 :           constant := 67;
G_Sharp_4 :     constant := 68;
A_Flat_4 :      constant := 68;
A_4 :           constant := 69;
A_Sharp_4 :     constant := 70;
B_Flat_4 :      constant := 70;
B_4 :           constant := 71;
C_5 :           constant := 72;
C_Sharp_5 :     constant := 73;
D_Flat_5 :      constant := 73;
D_5 :           constant := 74;
D_Sharp_5 :     constant := 75;
E_Flat_5 :      constant := 75;
E_5 :           constant := 76;
F_5 :           constant := 77;
F_Sharp_5 :     constant := 78;
G_Flat_5 :      constant := 78;
G_5 :           constant := 79;
G_Sharp_5 :     constant := 80;
A_Flat_5 :      constant := 80;
A_5 :           constant := 81;
A_Sharp_5 :     constant := 82;
B_Flat_5 :      constant := 82;
B_5 :           constant := 83;
C_6 :           constant := 84;
C_Sharp_6 :     constant := 85;
D_Flat_6 :      constant := 85;
D_6 :           constant := 86;
D_Sharp_6 :     constant := 87;
E_Flat_6 :      constant := 87;
E_6 :           constant := 88;
F_6 :           constant := 89;
F_Sharp_6 :     constant := 90;
G_Flat_6 :      constant := 90;
G_6 :           constant := 91;
G_Sharp_6 :     constant := 92;
A_Flat_6 :      constant := 92;
A_6 :           constant := 93;
A_Sharp_6 :     constant := 94;
B_Flat_6 :      constant := 94;
B_6 :           constant := 95;
C_7 :           constant := 96;
C_Sharp_7 :     constant := 97;
D_Flat_7 :      constant := 97;
D_7 :           constant := 98;
D_Sharp_7 :     constant := 99;
E_Flat_7 :      constant := 99;
E_7 :           constant := 100;
F_7 :           constant := 101;
F_Sharp_7 :     constant := 102;
G_Flat_7 :      constant := 102;
G_7 :           constant := 103;
G_Sharp_7 :     constant := 104;
A_Flat_7 :      constant := 104;
A_7 :           constant := 105;
A_Sharp_7 :     constant := 106;
B_Flat_7 :      constant := 106;
B_7 :           constant := 107;
C_8 :           constant := 108;
C_Sharp_8 :     constant := 109;
D_Flat_8 :      constant := 109;
D_8 :           constant := 110;
D_Sharp_8 :     constant := 111;
E_Flat_8 :      constant := 111;

MIDI Types

Many MIDI values are 7-bits in size. In Ada strong typing tradition, these are declared with their own types.

Some values like the Channel_Type are only 4-bits wide. The Bend_Type is a signed 14-bit value (in a 16-bit type).

type Note_Type          is new Unsigned_8   range 0..127;
type Channel_Type       is new Unsigned_8   range 0..15;
type Velocity_Type      is new Unsigned_8   range 0..127;
type Pressure_Type      is new Unsigned_8   range 0..127;
type Control_Type       is new Unsigned_8   range 0..127;
type Value_Type         is new Unsigned_8   range 0..127;
type Program_Type       is new Unsigned_8   range 0..127;

type Bend_Type          is                  range -2**14 .. 2**14;
for Bend_Type'Size      use 16;

type Manufacturer_Type  is new Unsigned_8   range 0..127;
type Beats_Type         is new Unsigned_16  range 0..2**14;
type Song_Selection_Type is new Unsigned_8  range 0..127;
type Status_Type        is new Unsigned_8;

I/O Procedures

No actual I/O is provided by the MIDI package directly. I/O is performed by
using user supplied byte read/write/poll routines.

Read_Byte_Proc

type Read_Byte_Proc    is access
procedure (Byte : out Unsigned_8);

This is a user supplied procedure that returns one read MIDI byte. The
procedure does not return until a byte is read.

Poll_Byte_Proc

type Poll_Byte_Proc    is access
function return Boolean;            -- Return True when Input available

This user supplied routine should return True when a MIDI byte
is available to be read. This routine is only provided by the
user when a polled input is possible (or desireable).

Write_Byte_Proc

type Write_Byte_Proc   is access
procedure (Byte : in  Unsigned_8);

This routine is supplied when the application expects to generate MIDI
messages. This procedure is called whenever there is a byte to be
transmitted.

Idle_Proc

type Idle_Proc         is access
procedure;

This optional procedure is supplied when the user's calling application
wishes to do things while the MIDI package is still waiting for more input
MIDI bytes (and a polling procedure has been provided).

When there is nothing for the MIDI package to do, the idle procedure is
called.

IO_Context

Before any I/O occurs in the MIDI package, the user must initialize an
IO_Context object with user supplied procedures.

type IO_Context is private;

procedure Initialize(
    Context :       in out  IO_Context;
    Receiver :      in      Read_Byte_Proc := null;
    Transmitter :   in      Write_Byte_Proc := null;
    Poll :          in      Poll_Byte_Proc := null
);

If your application only receives messages, only the Receiver argument is mandatory. If your
I/O process polls for received data, you should supply a Poll argument, so that Idle_Proc
calls can be made in certain situations.

If your application only transmits MIDI data, then only the Transmitter argument is mandatory.

Baud Rate Divisor

This baud rate divisor convenience procedure is provided, along with the
constant Standard_Baud_Rate. The MIDI_Baud_Rate_Divisor function computes a divisor
for the given CPU_Clock_Freq (frequency). It's use is optional.

Standard_Baud_Rate :        constant := 31250;   -- Midi baud rate

function MIDI_Baud_Rate_Divisor(CPU_Clock_Freq : Unsigned_32) return Unsigned_16;

MIDI Commands

The following MIDI commands are supported:

MC_NOTE_OFF :       constant := 16#80#;  -- Note off request
MC_NOTE_ON :        constant := 16#90#;  -- Note on request
MC_KEY_PRESSURE :   constant := 16#A0#;  -- Key pressure (AfterTouch)
MC_CTL_CHG :        constant := 16#B0#;  -- Control change
MC_PROGRAM_CHG :    constant := 16#C0#;  -- Program change
MC_CH_PRESSURE :    constant := 16#D0#;  -- Channel pressure change
MC_BEND :           constant := 16#E0#;  -- Bend (for channel)
MC_SYS :            constant := 16#F0#;  -- System message

Control Changes

The following control changes are supported:

MC_CTL_ALLS_OFF :   constant := 16#78#;  -- All sounds off (120)
MC_CTL_RESET_C :    constant := 16#79#;  -- Reset controller
MC_CTL_LOCAL_C :    constant := 16#7A#;  -- Local on/off
MC_CTL_ALLN_OFF :   constant := 16#7B#;  -- All notes off
MC_CTL_OMNI_OFF :   constant := 16#7C#;  -- Omni off request
MC_CTL_OMNI_ON :    constant := 16#7D#;  -- Omni on request
MC_CTL_MONO_ON :    constant := 16#7E#;  -- Mono on == POLY OFF
MC_CTL_MONO_OFF :   constant := 16#7F#;  -- Mono off == POLY ON

System Channels

The following system channels are supported:

MC_SYS_EX :         constant := 16#00#;  -- Sys Ex transfer
MC_SYS_RES1 :       constant := 16#01#;  -- Reserved
MC_SYS_SNGPOS :     constant := 16#02#;  -- Song position
MC_SYS_SNGSEL :     constant := 16#03#;  -- Song selection
MC_SYS_RES4 :       constant := 16#04#;  -- Reserved
MC_SYS_RES5 :       constant := 16#05#;  -- Reserved
MC_SYS_TREQ :       constant := 16#06#;  -- Tune Request
MC_SYS_ENDX :       constant := 16#07#;  -- End SysEx transfer
MC_SYS_TCLK :       constant := 16#08#;  -- RT - Clock
MC_SYS_RES9 :       constant := 16#09#;  -- RT - Reserved
MC_SYS_START :      constant := 16#0A#;  -- RT - Start
MC_SYS_CONT :       constant := 16#0B#;  -- RT - Continue
MC_SYS_STOP :       constant := 16#0C#;  -- RT - Stop
MC_SYS_RESD :       constant := 16#0D#;  -- RT - Reserved
MC_SYS_ASENSE :     constant := 16#0E#;  -- RT - Active Sense
MC_SYS_RESET :      constant := 16#0F#;  -- RT - Reset

Named Notes

The MIDI package also defines note values of the form:

C_0 :           constant := 12;
C_Sharp_0 :     constant := 13;
D_Flat_0 :      constant := 13;
D_0 :           constant := 14;
D_Sharp_0 :     constant := 15;
E_Flat_0 :      constant := 15;
E_0 :           constant := 16;
...
D_8 :           constant := 110;
D_Sharp_8 :     constant := 111;
E_Flat_8 :      constant := 111;

Package MIDI.Receiver

MIDI messages are received with the help of an initialized IO_Context type. This
routine is the connection to the user input and poll routines.

The Recv_Context type defines the connection to the user callback routines, for each
message received.

Messages are received and digested by the Receive procedure. Once a
valid message is received, the message is passed to the user callback
with the arguments extracted from the message. If there is no callback
registered for a particular MIDI message, the message is silently discarded.

package MIDI.Receiver is

------------------------------------------------------------------
-- MIDI Receive Context
------------------------------------------------------------------
type Recv_Context is private;

------------------------------------------------------------------
-- Receive One MIDI Message and issue Callback
------------------------------------------------------------------
procedure Receive(
    Obj :         in out Recv_Context;          -- MIDI Context
    IO :          in     IO_Context;            -- I/O Context
    Max_Sysex :   in     Unsigned_16 := 32);    -- Buffer size max

------------------------------------------------------------------
-- Reset the State of the MIDI Context
------------------------------------------------------------------
procedure Reset(Obj : in out Recv_Context);

------------------------------------------------------------------
--                M I D I   C A L L B A C K S
------------------------------------------------------------------

------------------------------------------------------------------
-- Note On/Off
------------------------------------------------------------------
type Note_On_Off_Proc is access
procedure(Channel :  Channel_Type;
    Note :     Note_Type;
    Velocity : Velocity_Type;
    Note_On :  Boolean);

------------------------------------------------------------------
-- Pressure Change
------------------------------------------------------------------
type Pressure_Proc is access
procedure(Channel :  Channel_Type;
             Note :  Note_Type;
         Pressure : Pressure_Type);

------------------------------------------------------------------
-- Control Changes Callbacks for:
--
--  All_Sounds_Off
--  Reset_Controller
--  Local_Controller
--  All_Notes_Off
--
------------------------------------------------------------------
type Control_Proc is access
procedure(Channel : Channel_Type;
            Value :   Value_Type);

------------------------------------------------------------------
-- Unsupported Control Type
------------------------------------------------------------------
type Unsupported_Control_Proc is access
procedure(Channel : Channel_Type;
          Control : Control_Type;
            Value : Value_Type);

------------------------------------------------------------------
-- Omni On/Off
------------------------------------------------------------------
type Omni_Proc is access
procedure(Channel : Channel_Type;
            Value : Value_Type;
          Omni_On : Boolean);

------------------------------------------------------------------
-- Mono On/Off
------------------------------------------------------------------
type Mono_Proc is access
procedure(Channel : Channel_Type;
            Value : Value_Type;
          Mono_On : Boolean);

------------------------------------------------------------------
-- Program Selection
------------------------------------------------------------------
type Program_Proc is access
procedure(Channel : Channel_Type;
          Program : Program_Type);

------------------------------------------------------------------
-- Channel Pressure
------------------------------------------------------------------
type Channel_Pressure_Proc is access
procedure(Channel : Channel_Type;
         Pressure : Pressure_Type);

------------------------------------------------------------------
-- Channel Bend
------------------------------------------------------------------
type Bend_Proc is access
procedure(Channel : Channel_Type;
             Bend : Bend_Type);

------------------------------------------------------------------
-- SysEx Message
------------------------------------------------------------------
type Sysex_Proc is access
procedure(Manufacturer_ID : Manufacturer_Type;
                    Sysex : U8_Array;
                Truncated : Boolean);

------------------------------------------------------------------
-- Unsupported MIDI Message
------------------------------------------------------------------
type Unsupported_Proc is access
procedure(Message : U8_Array);

------------------------------------------------------------------
-- Song Position
------------------------------------------------------------------
type Song_Position_Proc is access
procedure(Beats : Beats_Type);

------------------------------------------------------------------
-- Song Selection
------------------------------------------------------------------
type Song_Selection_Proc is access
procedure(Selection : Song_Selection_Type);

------------------------------------------------------------------
-- Tune Request
------------------------------------------------------------------
type Tune_Request_Proc is access
    procedure;

------------------------------------------------------------------
-- Realtime Message
------------------------------------------------------------------
type Realtime_Proc is access
    procedure(Cmd : Status_Type);

------------------------------------------------------------------
-- Callback Registrations (all inlined) :
------------------------------------------------------------------

procedure Register_Note_On_Off(Obj : in out Recv_Context; Callback : Note_On_Off_Proc);
procedure Register_Pressure(Obj : in out Recv_Context; Callback : Pressure_Proc);
procedure Register_All_Sounds_Off(Obj : in out Recv_Context; Callback : Control_Proc);
procedure Register_Reset_Controller(Obj : in out Recv_Context; Callback : Control_Proc);
procedure Register_Local_Controller(Obj : in out Recv_Context; Callback : Control_Proc);
procedure Register_All_Notes_Off(Obj : in out Recv_Context; Callback : Control_Proc);
procedure Register_Omni(Obj : in out Recv_Context; Callback : Omni_Proc);
procedure Register_Mono(Obj : in out Recv_Context; Callback : Mono_Proc);
procedure Register_Unsupported_Control(Obj : in out Recv_Context; Callback : Unsupported_Control_Proc);
procedure Register_Program(Obj : in out Recv_Context; Callback : Program_Proc);
procedure Register_Channel_Pressure(Obj : in out Recv_Context; Callback : Channel_Pressure_Proc);
procedure Register_Bend(Obj : in out Recv_Context; Callback : Bend_Proc);
procedure Register_Sysex(Obj : in out Recv_Context; Callback : Sysex_Proc);
procedure Register_Unsupported(Obj : in out Recv_Context; Callback : Unsupported_Proc);
procedure Register_Song_Pos(Obj : in out Recv_Context; Callback : Song_Position_Proc);
procedure Register_Song_Selection(Obj : in out Recv_Context; Callback : Song_Selection_Proc);
procedure Register_Tune_Request(Obj : in out Recv_Context; Callback : Tune_Request_Proc);
procedure Register_Realtime(Obj : in out Recv_Context; Callback : Realtime_Proc);

procedure Register_Idle(Obj : in out Recv_Context; Callback : Idle_Proc);

Registration of Callbacks

The Recv_Context object is where the user MIDI message callback routines are registered.
There is no requirement for all possible callbacks to be registered. Unregistered callbacks
simply have their messages ignored.

To register interest in a particular MIDI message, simply register a callback procedure
for it. For example:

procedure Register_Note_On_Off(Obj : in out Recv_Context; Callback : Note_On_Off_Proc);

allows the user to register a callback for all Note On or Note Off events. The type of
arguments accepted by the callback, are defined by the callback type. In this example
the type is Note_On_Off_Proc:

type Note_On_Off_Proc is access
procedure(Channel : Channel_Type;
             Note : Note_Type;
         Velocity : Velocity_Type;
          Note_On : Boolean);

From this you see that a Note On/Off event passes in the Channel, Note, Velocity and whether it is On or Off (in argument Note_On).

Package MIDI.Transmitter

This package permits an application to generate MIDI messages (by MIDI message type). For example, to
generate a Note On or Off event, the user simply calls Note_On_Off, supplying the necessary IO_Context
object and the Note On/Off parameter values.

package MIDI.Transmitter is

------------------------------------------------------------------
-- Set Note On/Off
------------------------------------------------------------------
procedure Note_On_Off(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Note :          Note_Type;              -- MIDI Note Number
   Velocity :      Velocity_Type;          -- Note velocity value
   Note_On :       Boolean                 -- Note on (True) or off (False)
);

------------------------------------------------------------------
-- Set Pressure
------------------------------------------------------------------
procedure Pressure(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Note :          Note_Type;              -- MIDI Note Number
   Pressure :      Pressure_Type           -- Pressure value
);

------------------------------------------------------------------
-- Set All Sounds Off
------------------------------------------------------------------
procedure All_Sounds_Off(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type              -- Value for the Control
);

------------------------------------------------------------------
-- Reset Controller
------------------------------------------------------------------
procedure Reset_Controller(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type              -- Value for the Control
);

------------------------------------------------------------------
-- Set Local Controller
------------------------------------------------------------------
procedure Local_Controller(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type              -- Value for the Control
);

------------------------------------------------------------------
-- Set All Notes Off
------------------------------------------------------------------
procedure All_Notes_Off(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type              -- Value for the Control
);

------------------------------------------------------------------
-- Set Omni On/Off
------------------------------------------------------------------
procedure Omni(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type;             -- Value for the Control
   Omni_On :       Boolean                 -- On (True) or Off (False)
);

------------------------------------------------------------------
-- Set Mono On/Off
------------------------------------------------------------------
procedure Mono(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Value :         Value_Type;             -- Value for the Control
   Mono_On :       Boolean                 -- On (True) or Off (False)
);

------------------------------------------------------------------
-- Set Program Number
------------------------------------------------------------------
procedure Program(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Program :       Program_Type            -- Program Number
);

------------------------------------------------------------------
-- Set Channel Pressure
------------------------------------------------------------------
procedure Channel_Pressure(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Pressure :      Pressure_Type           -- Pressure Value
);

------------------------------------------------------------------
-- Issue Bend Command
------------------------------------------------------------------
procedure Bend(
   Context :       IO_Context;             -- I/O Context
   Channel :       Channel_Type;           -- MIDI Channel Number
   Bend :          Bend_Type               -- Bend Value
);

------------------------------------------------------------------
-- Issue Sysex Message
--
-- Note: Sysex data bytes are "anded" with 16#07F# to enforce
--       the MIDI data rule (high bit must be zero).
------------------------------------------------------------------
procedure Sysex(
   Context :       IO_Context;             -- I/O Context
   Manufacturer_ID : Manufacturer_Type;    -- Manufacturer ID Value
   Sysex :         U8_Array                -- Sysex information
);

------------------------------------------------------------------
-- Set Song Position
------------------------------------------------------------------
procedure Song_Pos(
   Context :       IO_Context;             -- I/O Context
   Beats :         Beats_Type              -- Number of beats
);

------------------------------------------------------------------
-- Set Song Selection
------------------------------------------------------------------
procedure Song_Selection(
   Context :       IO_Context;             -- I/O Context
   Selection :     Song_Selection_Type     -- Song selection number
);

------------------------------------------------------------------
-- Issue Tune Request
------------------------------------------------------------------
procedure Tune_Request(
   Context :       IO_Context              -- I/O Context
);

------------------------------------------------------------------
-- Issue Realtime Command:
--
-- Realtime_Cmd must be one of:
--
-- MC_SYS_TCLK | MC_SYS_START | MC_SYS_CONT | MC_SYS_STOP
--             | MC_SYS_ASENSE | MC_SYS_RESET
------------------------------------------------------------------
procedure Realtime(
   Context :       IO_Context;             -- I/O Context
   Realtime_Cmd :  Status_Type             -- MIDI Realtime command (see above)
);

Related

Wiki: Examples
Wiki: Home
Wiki: Setup

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks