Struct jack::Port [−][src]
An endpoint to interact with JACK data streams, for audio, midi, etc…
The Port
struct contains mostly metadata and exposes data as raw pointers. For a better data
consumption/production API, see the AudioInPort
, AudioOutPort
, MidiInPort
, and
MidiOutPort
.
Most JACK functionality is exposed, including the raw pointers, but it should be possible to
create a client without the need for calling unsafe
Port
methods.
Also, ports can be compared and hashed using their raw pointers.
Implementations
impl Port<AudioIn>
[src]
impl Port<AudioOut>
[src]
pub fn as_mut_slice<'a>(&'a mut self, ps: &'a ProcessScope) -> &'a mut [f32]
[src]
Get a slice to write audio data to.
impl Port<MidiIn>
[src]
pub fn iter<'a>(&'a self, ps: &'a ProcessScope) -> MidiIter<'a>ⓘ
[src]
Get an iterator over midi events.
impl Port<MidiOut>
[src]
pub fn writer<'a>(&'a mut self, ps: &'a ProcessScope) -> MidiWriter<'a>
[src]
Create a writer that can write midi events to the specified midi port. Calling this function clears the midi buffer.
impl<PS> Port<PS>
[src]
pub fn spec(&self) -> &PS
[src]
Returns the spec that was used to create this port.
pub fn clone_unowned(&self) -> Port<Unowned>
[src]
Return a copy of port as an unowned port that can still be used for querying information.
pub fn name(&self) -> Result<String, Error>
[src]
Returns the full name of the port, including the “client_name:” prefix.
pub fn short_name(&self) -> Result<String, Error>
[src]
Returns the short name of the port, it excludes the “client_name:” prefix.
pub fn flags(&self) -> PortFlags
[src]
The flags for the port. These are set when the port is registered with its client.
pub fn port_type(&self) -> Result<String, Error>
[src]
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.
pub fn connected_count(&self) -> Result<usize, Error>
[src]
Number of ports connected to/from &self
.
pub fn is_connected_to(&self, port_name: &str) -> Result<bool, Error>
[src]
Returns true
if the port is directly connected to a port with the
name port_name
.
pub fn aliases(&self) -> Result<Vec<String>, Error>
[src]
Get the alias names for self
.
Will return up to 2 strings.
pub fn is_monitoring_input(&self) -> Result<bool, Error>
[src]
Returns true
if monitoring has been requested for self
.
pub fn request_monitor(&self, enable_monitor: bool) -> Result<(), Error>
[src]
Turn input monitoring for the port on or off.
This only works if the port has the CAN_MONITOR
flag set.
pub fn ensure_monitor(&self, enable_monitor: bool) -> Result<(), Error>
[src]
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.
pub fn set_name(&mut self, short_name: &str) -> Result<(), Error>
[src]
Set’s the short name of the port. If the full name is longer than PORT_NAME_SIZE
, then it
will be truncated.
pub fn set_alias(&mut self, alias: &str) -> Result<(), Error>
[src]
Sets alias
as an alias for self
.
May be called at any time. If the alias is longer than PORT_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.
pub fn unset_alias(&mut self, alias: &str) -> Result<(), Error>
[src]
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
.
pub unsafe fn from_raw(
spec: PS,
client_ptr: *mut jack_client_t,
port_ptr: *mut jack_port_t,
client_life: Weak<()>
) -> Self
[src]
spec: PS,
client_ptr: *mut jack_client_t,
port_ptr: *mut jack_port_t,
client_life: Weak<()>
) -> Self
Create a Port from raw JACK pointers.
This is mostly for use within the jack crate itself.
pub fn client_ptr(&self) -> *mut jack_client_t
[src]
Obtain the client pointer that spawned this port.
This is mostly for use within the jack crate itself.
pub fn raw(&self) -> *mut jack_port_t
[src]
Obtain the ffi port pointer.
This is mostly for use within the jack crate itself.
pub unsafe fn buffer(&self, n_frames: Frames) -> *mut c_void
[src]
Obtain the buffer that the Port is holding. For standard audio and midi ports, consider
using the AudioInPort
, AudioOutPort
, MidiInPort
, or MidiOutPort
adapter. For more
custom data, consider implementing your own adapter that safely uses the Port::buffer
method.
pub fn set_latency_range(&self, mode: LatencyType, range: (Frames, Frames))
[src]
Set the minimum and maximum latencies defined by mode for port, in frames.
The range
argument is a tuple of (min, max)
.
See Managing and determining latency for a description of what the latency values mean and some best practices. This function should only be used inside a latency callback.
pub fn get_latency_range(&self, mode: LatencyType) -> (Frames, Frames)
[src]
Returns a tuple of the minimum and maximum latencies defined by mode for port, in frames.
See Managing and determining latency for a description of what the latency values mean and some best practices. This is normally used in the LatencyCallback. and therefore safe to execute from callbacks.
Trait Implementations
impl Clone for Port<Unowned>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<PS: PortSpec> Debug for Port<PS>
[src]
impl<PS> Eq for Port<PS>
[src]
impl<PS> Hash for Port<PS>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<PS> Ord for Port<PS>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<PS> PartialEq<Port<PS>> for Port<PS>
[src]
impl<PS> PartialOrd<Port<PS>> for Port<PS>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<PS: PortSpec + Send> Send for Port<PS>
[src]
impl<PS: PortSpec + Sync> Sync for Port<PS>
[src]
Auto Trait Implementations
impl<PS> RefUnwindSafe for Port<PS> where
PS: RefUnwindSafe,
PS: RefUnwindSafe,
impl<PS> Unpin for Port<PS> where
PS: Unpin,
PS: Unpin,
impl<PS> UnwindSafe for Port<PS> where
PS: UnwindSafe,
PS: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,