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
impl MidiOutput
sourcepub fn new(client_name: &str) -> Result<Self, InitError>
pub fn new(client_name: &str) -> Result<Self, InitError>
Creates a new MidiOutput
object that is required for any MIDI output functionality.
sourcepub fn ports(&self) -> MidiOutputPorts
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.
sourcepub fn port_count(&self) -> usize
pub fn port_count(&self) -> usize
Get the number of available MIDI output ports that midir can connect to.
sourcepub fn port_name(&self, port: &MidiOutputPort) -> Result<String, PortInfoError>
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).
sourcepub fn connect(
self,
port: &MidiOutputPort,
port_name: &str
) -> Result<MidiOutputConnection, ConnectError<MidiOutput>>
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).