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]
&self,
port_number: RtMidiPort,
port_name: T
) -> Result<(), RtMidiError>
Open a MIDI output connection
pub fn open_virtual_port<T: AsRef<str>>(
&self,
port_name: T
) -> Result<(), RtMidiError>
[src]
&self,
port_name: T
) -> Result<(), RtMidiError>
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
Auto Trait Implementations
impl RefUnwindSafe for RtMidiOut
impl !Send for RtMidiOut
impl !Sync for RtMidiOut
impl Unpin for RtMidiOut
impl UnwindSafe for RtMidiOut
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,