[][src]Crate coremidi

This is a CoreMIDI library for Rust built on top of the low-level bindings coremidi-sys. CoreMIDI is a macOS framework that provides APIs for communicating with MIDI (Musical Instrument Digital Interface) devices, including hardware keyboards and synthesizers.

This library preserves the fundamental concepts behind the CoreMIDI framework, while being Rust idiomatic. This means that if you already know CoreMIDI, you will find very easy to start using it.

Please see the examples for an idea on how it looks like, but if you are eager to see an example, this is how you would send some note:

extern crate coremidi;
use std::time::Duration;
use std::thread;
let client = coremidi::Client::new("example-client").unwrap();
let output_port = client.output_port("example-port").unwrap();
let destination = coremidi::Destination::from_index(0).unwrap();
let note_on = coremidi::PacketBuffer::new(0, &[0x90, 0x40, 0x7f]);
let note_off = coremidi::PacketBuffer::new(0, &[0x80, 0x40, 0x7f]);
output_port.send(&destination, &note_on).unwrap();
thread::sleep(Duration::from_millis(1000));
output_port.send(&destination, &note_off).unwrap();

If you are looking for a portable MIDI library then you can look into:

For handling low level MIDI data you may look into:

Structs

AddedRemovedInfo
Client

A MIDI client.

Destination

A MIDI source owned by an entity.

Destinations

Destination endpoints available in the system.

Device

A MIDI object.

Endpoint

A MIDI source or source, owned by an entity. See MIDIEndpointRef.

IOErrorInfo
InputPort

An input MIDI port owned by a client.

Object

A MIDI Object.

OutputPort

An output MIDI port owned by a client.

Packet

A collection of simultaneous MIDI events. See MIDIPacket.

PacketBuffer

A mutable PacketList builder.

PacketList

A list of MIDI events being received from, or being sent to, one endpoint.

PacketListIterator
Port

A MIDI connection port owned by a client. See MIDIPortRef.

Properties

The set of properties that might be available for MIDI objects.

PropertyChangedInfo
Source

A MIDI source owned by an entity.

Sources

Source endpoints available in the system.

VirtualDestination

A MIDI virtual destination owned by a client.

VirtualSource

A MIDI virtual source owned by a client.

Enums

Notification

A message describing a system state change. See MIDINotification.

ObjectType

Traits

PropertyGetter
PropertySetter

Functions

flush

Unschedules previously-sent packets for all the endpoints. See MIDIFlushOutput.

restart

Stops and restarts MIDI I/O. See MIDIRestart.