Struct rtmidi::RtMidiOut[][src]

pub struct RtMidiOut(_);

Realtime MIDI output

This provides a common, platform-independent API for MIDI output. It allows one to probe available MIDI output ports, to connect to one such port, and to send MIDI bytes immediately over the connection. Create multiple instances to connect to more than one MIDI device at the same time. With the macOS, Linux ALSA and JACK MIDI APIs, it is also possible to open a virtual port to which other MIDI software clients can connect.

use rtmidi::RtMidiOut;

// Initialise MIDI output with default arguments
let output = RtMidiOut::new(Default::default()).unwrap();

// List output ports
for port in 0..output.port_count().unwrap() {
    println!("{}: {}", port+1, output.port_name(port).unwrap());
}

Implementations

impl RtMidiOut[src]

pub fn new(args: RtMidiOutArgs<'_>) -> Result<Self, RtMidiError>[src]

Default constructor that allows an optional api and client name using the RtMidiOutArgs type.

An exception will be thrown if a MIDI system initialization error occurs.

If no API argument is specified and multiple API support has been compiled, the default order of use is ALSA, JACK (Linux) and CORE, JACK (macOS).

pub fn current_api(&self) -> RtMidiApi[src]

Returns the MIDI API specifier for the current instance

pub fn open_port<T: AsRef<str>>(
    &self,
    port_number: RtMidiPort,
    port_name: T
) -> Result<(), RtMidiError>
[src]

Open a MIDI output connection

pub fn open_virtual_port<T: AsRef<str>>(
    &self,
    port_name: T
) -> Result<(), RtMidiError>
[src]

Create a virtual output port, with a name, to allow software connections (macOS, JACK and ALSA only).

This function creates a virtual MIDI output port to which other software applications can connect. This type of functionality is currently only supported by the macOS, Linux ALSA and JACK APIs (the function does nothing with the other APIs). An error is returned if an error occurs while attempting to create the virtual port.

pub fn close_port(&self) -> Result<(), RtMidiError>[src]

Close an open MIDI connection (if one exists)

pub fn port_count(&self) -> Result<RtMidiPort, RtMidiError>[src]

Return the number of available MIDI output ports

pub fn port_name(&self, port_number: RtMidiPort) -> Result<&str, RtMidiError>[src]

Return a string identifier for the specified MIDI output port number

pub fn message(&self, message: &[u8]) -> Result<(), RtMidiError>[src]

Immediately send a single message out an open MIDI output port.

An error is returned if an error occurs during output or an output connection was not previously established.

Trait Implementations

impl Drop for RtMidiOut[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.