[][src]Struct portmidi::PortMidi

pub struct PortMidi { /* fields omitted */ }

The PortMidi base struct. Initializes PortMidi on creation and terminates it on drop.

Implementations

impl PortMidi[src]

pub fn new() -> Result<Self>[src]

Initializes the underlying PortMidi C library. PortMidi does not support hot plugging, this means that devices that are connect after calling new are not picked up.

pub fn device_count(&self) -> PortMidiDeviceId[src]

Return the number of devices. This number will not change during the lifetime of the program.

pub fn default_input_device_id(&self) -> Result<PortMidiDeviceId>[src]

Returns the PortMidiDeviceId for the default input device, or an Error::NoDefaultDevice if there is no available.

pub fn default_output_device_id(&self) -> Result<PortMidiDeviceId>[src]

Returns the PortMidiDeviceId for the default output device, or an Error::NoDefaultDevice if there is no available.

pub fn device(&self, id: PortMidiDeviceId) -> Result<DeviceInfo>[src]

Returns the DeviceInfo for the given device id or an Error::PortMidi(_) if the given id is invalid.

pub fn devices(&self) -> Result<Vec<DeviceInfo>>[src]

Returns a Vec<DeviceInfo> containing all known device infos. An Error::PortMidi(_) is returned if the info for a device can't be obtained.

pub fn default_input_port(&self, buffer_size: usize) -> Result<InputPort<'_>>[src]

Creates an InputPort instance with the given buffer size for the default input device.

pub fn input_port(
    &self,
    device: DeviceInfo,
    buffer_size: usize
) -> Result<InputPort<'_>>
[src]

Creates an InputPort instance for the given device and buffer size. If the given device is not an input device an Error::NotAnInputDevice is returned.

pub fn default_output_port(&self, buffer_size: usize) -> Result<OutputPort<'_>>[src]

Creates an OutputPort instance with the given buffer size for the default output device.

pub fn output_port(
    &self,
    device: DeviceInfo,
    buffer_size: usize
) -> Result<OutputPort<'_>>
[src]

Creates an OutputPort instance for the given device and buffer size. If the given device is not an output device an Error::NotAnOutputDevice is returned.

Trait Implementations

impl Drop for PortMidi[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.