Struct midir::MidiOutput

source ·
pub struct MidiOutput { /* private fields */ }
Expand description

An instance of MidiOutput is required for anything related to MIDI output. Create one with MidiOutput::new.

Implementations§

source§

impl MidiOutput

source

pub fn new(client_name: &str) -> Result<Self, InitError>

Creates a new MidiOutput object that is required for any MIDI output functionality.

source

pub fn ports(&self) -> MidiOutputPorts

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

source

pub fn port_count(&self) -> usize

Get the number of available MIDI output ports that midir can connect to.

source

pub fn port_name(&self, port: &MidiOutputPort) -> Result<String, PortInfoError>

Get the name of a specified MIDI output port.

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

source

pub fn connect( self, port: &MidiOutputPort, port_name: &str ) -> Result<MidiOutputConnection, ConnectError<MidiOutput>>

Connect to a specified MIDI output port in order to send messages. The connection will be kept open as long as the returned MidiOutputConnection is kept alive.

The port_name is an additional name that will be assigned to the connection. It is only used by some backends.

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

Trait Implementations§

source§

impl MidiIO for MidiOutput

§

type Port = MidiOutputPort

Type of an input or output port structure.
source§

fn ports(&self) -> MidiOutputPorts

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.
source§

fn port_count(&self) -> usize

Get the number of available MIDI input or output ports.
source§

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

Get the name of a specified MIDI input or output port. Read more
source§

impl VirtualOutput for MidiOutput

source§

fn create_virtual( self, port_name: &str ) -> Result<MidiOutputConnection, ConnectError<MidiOutput>>

Creates a virtual output port. Once it has been created, other applications can connect to this port and will receive MIDI messages that are sent to this port.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.