Struct jack::Port

source ·
pub struct Port<PS> { /* private fields */ }
Expand description

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§

Read the received audio data.

Get a slice to write audio data to.

Get an iterator over midi events.

Create a writer that can write midi events to the specified midi port. Calling this function clears the midi buffer.

Returns the spec that was used to create this port.

Return a copy of port as an unowned port that can still be used for querying information.

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

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

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

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.

Number of ports connected to/from &self.

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

Get the alias names for self.

Will return up to 2 strings.

Returns true if monitoring has been requested for self.

Turn input monitoring for the port on or off.

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

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.

Set’s the short name of the port. If the full name is longer than PORT_NAME_SIZE, then it will be truncated.

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.

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.

Create a Port from raw JACK pointers.

This is mostly for use within the jack crate itself.

Safety

It is unsafe to create a Port from raw pointers.

Obtain the client pointer that spawned this port.

This is mostly for use within the jack crate itself.

Obtain the ffi port pointer.

This is mostly for use within the jack crate itself.

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.

Safety

It is unsafe to extract a buffer. Prefer to use one of the type specific wrappers such as .as_mut_slice() for audio and .midi_iter for midi.

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.

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.