Struct portmidi::InputPort [] [src]

pub struct InputPort {
    // some fields omitted
}

Represents the input port of a PortMidi device.

Methods

impl InputPort
[src]

fn new(device: DeviceInfo, buffer_size: usize) -> Result<InputPort>

Construct a new InputPort for the given device and buffer size.

If the device is not an input device an Error::NotAnInputDevice is returned.

fn read_n(&self, cnt: usize) -> Result<Option<Vec<MidiEvent>>>

Returns a Vec<MidiEvent> with at most cnt elements. If there was no Midi event available, None is returned. If PortMidi fails to read from the device an Error::PortMidi(_) is returned.

fn read(&mut self) -> Result<Option<MidiEvent>>

Reads a single MidiEvent if one is avaible.

A Result of None means no event was available.

fn poll(&self) -> Result<bool>

Polls for available Midi events. Returns true if there are events available, otherwise false is returned. If the polling fails an Error::PortMidi(_) is returned.

fn device(&self) -> DeviceInfo

Returns the DeviceInfo of the Midi device that owns this port.

Trait Implementations

impl Drop for InputPort
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl Send for InputPort
[src]