Struct portmidi::PortMidi [] [src]

pub struct PortMidi {
    // some fields omitted
}

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

Methods

impl PortMidi
[src]

fn new() -> Result<Self>

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.

fn device_count(&self) -> PortMidiDeviceId

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

fn default_input_device_id(&self) -> Result<PortMidiDeviceId>

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

fn default_output_device_id(&self) -> Result<PortMidiDeviceId>

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

fn device(&self, id: PortMidiDeviceId) -> Result<DeviceInfo>

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

fn devices(&self) -> Result<Vec<DeviceInfo>>

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

fn default_input_port(&self, buffer_size: usize) -> Result<InputPort>

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

fn input_port(&self, device: DeviceInfo, buffer_size: usize) -> Result<InputPort>

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.

fn default_output_port(&self, buffer_size: usize) -> Result<OutputPort>

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

fn output_port(&self, device: DeviceInfo, buffer_size: usize) -> Result<OutputPort>

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]

fn drop(&mut self)

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