devela::_dep::midir

Trait MidiIO

pub trait MidiIO {
    type Port: Clone;

    // Required methods
    fn ports(&self) -> Vec<Self::Port> ;
    fn port_count(&self) -> usize ;
    fn port_name(&self, port: &Self::Port) -> Result<String, PortInfoError> ;
}
Available on crate feature dep_midir only.
Expand description

Trait that abstracts over input and output ports.

Required Associated Types§

type Port: Clone

Type of an input or output port structure.

Required Methods§

fn ports(&self) -> Vec<Self::Port>

Get a collection of all MIDI input or output ports. The resulting vector contains one object per port, which you can use to query metadata about the port or connect to it.

fn port_count(&self) -> usize

Get the number of available MIDI input or output ports.

fn port_name(&self, port: &Self::Port) -> Result<String, PortInfoError>

Get the name of a specified MIDI input or output port.

An error will be returned when the port is no longer valid (e.g. the respective device has been disconnected).

Implementors§