Port

Struct Port 

Source
pub struct Port { /* private fields */ }
Expand description

An endpoint to interact with Jack data streams, for audio, midi, etc…

Implementations§

Source§

impl Port

Source

pub fn name_size() -> usize

The maximum length of a full Jack port name. Unlike the “C” Jack API, this does not count the NULL character and corresponds to a string’s .len().

The port’s full name contains the owning client name concatenated with a colon (:) followed by its short name.

This value is constant

Source

pub fn type_size() -> usize

The maximum length of a port type. Unlike the “C” Jack API, this does not count the NULL character and corresponds to a string’s .len().

This value is constant.

Source

pub fn unregister(self) -> Result<(), JackErr>

Remove the port from the client, disconnecting any existing connections.

Source

pub fn name<'a>(&'a self) -> &'a str

Returns the full name of the port, including the “client_name:” prefix.

Source

pub fn short_name<'a>(&'a self) -> &'a str

Returns the short name of the port, it excludes the “client_name:” prefix.

Source

pub fn uuid(&self) -> u64

Returns the uuid of the port as a u64.

Source

pub fn flags(&self) -> PortFlags

The flags for the port. These are set when the port is registered with its client.

Source

pub fn port_type<'a>(&self) -> &'a str

The port type. Jack’s built in types include “32 bit float mono audio” and “8 bit raw midi”. Custom types may also be used.

Source

pub fn connected_count(&self) -> usize

Number of ports connected to/from

Source

pub fn is_connected_to(&self, port_name: &str) -> bool

Returns true if the port is directly connected to a port with the name port_name.

Source

pub unsafe fn connections(&self) -> Vec<String>

Full port names to which self is connected to. This combines Jack’s jack_port_get_all_connections() and jack_port_get_connections(). If the client from which port was spawned from is the owner, then it may be used in the graph reordered callback or else it should not be used.

§Unsafe
  • Can’t be used in the callback for graph reordering under certain conditions.
Source

pub fn aliases(&self) -> Vec<String>

Get the alias names for self.

Will return a vector of strings of up to 2 elements.

§TODO: Implement
Source

pub fn is_monitoring_input(&self) -> bool

Returns true if monitoring has been requested for self.

Source

pub fn set_name(&self, short_name: &str) -> Result<(), JackErr>

Set’s the short name of the port. If the full name is longer than Port::name_size(), then it will be truncated.

Source

pub fn set_alias(&self, alias: &str) -> Result<(), JackErr>

Sets alias as an alias for self.

May be called at any time. If the alias is longer than Client::name_size(), it will be truncated.

After a successful call, and until Jack exists, or the alias is unset, alias may be used as an alternate name for the port.

Ports can have up to two aliases - if both are already set, this function will return an error.

Source

pub fn unset_alias(&self, alias: &str) -> Result<(), JackErr>

Remove alias as an alias for port. May be called at any time.

After a successful call, alias can no longer be used as an alternate name for self.

Source

pub fn request_monitor(&self, enable_monitor: bool) -> Result<(), JackErr>

Turn input monitoring for the port on or off.

This only works if the port has the CAN_MONITOR flag set.

Source

pub fn ensure_monitor(&self, enable_monitor: bool) -> Result<(), JackErr>

If the CAN_MONITOR flag is set for the port, then input monitoring is turned on if it was off, and turns it off if only one request has been made to turn it on. Otherwise it does nothing.

Source

pub fn disconnect(&self) -> Result<(), JackErr>

Perform the same function as Client::disconnect_ports(), but with a port handle instead.

Avoids the name lookup inherent in the name-based version.

Clients connecting their own ports are likely to use this function, while generic connection clients (e.g. patchbays) would use Client::disconnect_ports().

Source

pub unsafe fn buffer(&self, n_frames: u32) -> *mut c_void

Returns a pointer to the memory area associated with the specified port. For an output port, it will be a memory area that can be written to; for an input port, it will be an area containing the data from the port’s connection(s), or zero-filled. If there are multiple inbound connections, the data will be mixed appropriately.

Do not cache the returned address across process() calls. Port buffers have to be retrieved in each callback for proper functioning.

Source

pub unsafe fn as_slice<T>(&self, n_frames: u32) -> &[T]

Interprets the buffer as a slice of type T with length n_frames.

Source

pub unsafe fn as_slice_mut<T>(&self, n_frames: u32) -> &mut [T]

Interprets the buffer as a mutable slice of type T with length n_frames.

Trait Implementations§

Source§

impl Clone for Port

Source§

fn clone(&self) -> Port

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Port

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Port

Auto Trait Implementations§

§

impl Freeze for Port

§

impl RefUnwindSafe for Port

§

impl !Send for Port

§

impl !Sync for Port

§

impl Unpin for Port

§

impl UnwindSafe for Port

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.