std1.0.0-beta-7 SafeC docs

std :: audio::midi

Struct std::MidiMsg

#include <std/audio/midi.h> source

struct MidiMsg {
    unsigned char data[3];
    int len;
}

A MIDI message of up to 3 bytes: everything but sysex.

Fields

§unsigned char data[3]source
§int lensource

Methods

§static struct MidiMsg note_on(int channel, int note, int velocity)source · definition
§static struct MidiMsg note_off(int channel, int note, int velocity)source · definition
§static struct MidiMsg poly_pressure(int channel, int note, int pressure)source · definition
§static struct MidiMsg control_change(int channel, int controller, int value)source · definition
§static struct MidiMsg program_change(int channel, int program)source · definition
§static struct MidiMsg channel_pressure(int channel, int pressure)source · definition
§static struct MidiMsg pitch_bend(int channel, int value)source · definition

value: -8192 .. 8191 (0 = centre)

§static struct MidiMsg song_position(int beats)source · definition

0 .. 16383 sixteenth notes

§static struct MidiMsg song_select(int song)source · definition
§static struct MidiMsg system(int status)source · definition

A one-byte system message: MIDI_CLOCK, MIDI_START, MIDI_STOP, ...

§static struct MidiMsg of([]const unsigned char bytes)source · definition

'bytes' (1..3 of them) as a message (len 0 if it's empty or longer).

§[]const unsigned char bytes() constsource · definition

The message's bytes (data[0..len]).

§int status() constsource · definition

the status byte (0 for an empty message)

§int type() constsource · definition

status & 0xF0 for channel messages, else the status

§int channel() constsource · definition

0..15 for channel messages, -1 otherwise

§int data1() constsource · definition

first data byte (note, controller, program), -1 if none

§int data2() constsource · definition

second data byte (velocity, value), -1 if none

§int is_note_on() constsource · definition

note on with velocity > 0

§int is_note_off() constsource · definition

note off, or note on with velocity 0

§int pitch_bend_value() constsource · definition

-8192 .. 8191 for a pitch bend, 0 otherwise