module PortMIDI

Overview

A wrapper around the non-stream-specific LibPortMIDI C bindings, plus some convenience functions for packing and unpacking PortMidi messages and to output midi device information.

Defined in:

port_midi/port_midi.cr

Constant Summary

VERSION = "0.1.0"

Class Method Summary

Class Method Detail

def self.bytes(event : LibPortMIDI::Event) : StaticArray(UInt8, 4) #

Returns an array of the four bytes contained in a PortMidi event.


[View source]
def self.bytes(message : UInt32) : StaticArray(UInt8, 4) #

Returns an array of the four bytes contained in a PortMidi message.


[View source]
def self.count_devices : Int32 #

Returns the number of attached MIDI input and output devices.


[View source]
def self.data1(message : UInt32) : UInt8 #

Extracts the first data byte from a PortMidi message.


[View source]
def self.data2(message : UInt32) : UInt8 #

Extracts the second data byte from a PortMidi message.


[View source]
def self.get_default_input_device_id : Int32 #

Returns the default input device ID, as defined by PortMidi.


[View source]
def self.get_default_output_device_id : Int32 #

Returns the default output device ID, as defined by PortMidi.


[View source]
def self.get_device_info(device_id : Int32) : DeviceInfo #

Returns a DeviceInfo for device device_id.


[View source]
def self.get_error_text(errnum : LibPortMIDI::PmError) : String #

Returns the error message that corresponds to errnum. Note that calling this method clears the error flag used by the code underlying PmStream#host_error?.


[View source]
def self.init #

Initializes the PortMidi system.


[View source]
def self.list_all_devices #

Lists all MIDI inputs and outputs, along with the port numbers that need to be passed to LibPortMIDI.


[View source]
def self.message(status, data1, data2) : UInt32 #

Creates a PortMidi message from three MIDI bytes.


[View source]
def self.raise_error(err : LibPortMIDI::PmError, msg : String) #

Given err, creates and raises an instance of the corresponding Exception subclass with the given msg.


[View source]
def self.status(message : UInt32) : UInt8 #

Extracts the status byte from a PortMidi message.


[View source]
def self.terminate #

Terminates PortMidi.


[View source]