pub struct PortMidi { /* private fields */ }
Expand description
The PortMidi base struct. Initializes PortMidi on creation and terminates it on drop.
Implementations
sourceimpl PortMidi
impl PortMidi
sourcepub fn new() -> Result<Self>
pub 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.
sourcepub fn device_count(&self) -> PortMidiDeviceId
pub fn device_count(&self) -> PortMidiDeviceId
Return the number of devices. This number will not change during the lifetime of the program.
sourcepub fn default_input_device_id(&self) -> Result<PortMidiDeviceId>
pub 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.
sourcepub fn default_output_device_id(&self) -> Result<PortMidiDeviceId>
pub 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.
sourcepub fn device(&self, id: PortMidiDeviceId) -> Result<DeviceInfo>
pub 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.
sourcepub fn devices(&self) -> Result<Vec<DeviceInfo>>
pub 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.
sourcepub fn default_input_port(&self, buffer_size: usize) -> Result<InputPort<'_>>
pub fn default_input_port(&self, buffer_size: usize) -> Result<InputPort<'_>>
Creates an InputPort
instance with the given buffer size for the default input device.
sourcepub fn input_port(
&self,
device: DeviceInfo,
buffer_size: usize
) -> Result<InputPort<'_>>
pub 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.
sourcepub fn default_output_port(&self, buffer_size: usize) -> Result<OutputPort<'_>>
pub fn default_output_port(&self, buffer_size: usize) -> Result<OutputPort<'_>>
Creates an OutputPort
instance with the given buffer size for the default output device.
sourcepub fn output_port(
&self,
device: DeviceInfo,
buffer_size: usize
) -> Result<OutputPort<'_>>
pub 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
Auto Trait Implementations
impl RefUnwindSafe for PortMidi
impl Send for PortMidi
impl Sync for PortMidi
impl Unpin for PortMidi
impl UnwindSafe for PortMidi
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more