pub struct JackConnection<T> { /* private fields */ }
Expand description

A connection to a JACK server (known as a “client” in the JACK docs).

Exists in two types: JackConnection<Activated> when activate() has been called (i.e. audio is being processed), and <Deactivated> when this has not happened, or deactivate() has been called.

Implementations

Get the sample rate of the JACK server.

Get the CPU load of the JACK server.

Get the buffer size passed to the process() callback.

Change the buffer size passed to the process() callback.

This operation stops the JACK engine process cycle, then calls all registered bufsize_callback functions before restarting the process cycle. This will cause a gap in the audio flow, so it should only be done at appropriate stopping points.

Parameters
  • bufsize: new buffer size. Must be a power of two.
Errors
  • NotPowerOfTwo: if the new buffer size isn’t a power of two
  • UnknownErrorCode

Establish a connection between two ports.

When a connection exists, data written to the source port will be available to be read at the destination port.

Preconditions
  • The port types must be identical.
  • The JackPortFlags of the source_port must include PORT_IS_OUTPUT.
  • The JackPortFlags of the destination_port must include PORT_IS_INPUT.
Errors
  • InvalidPortType: when the types are not identical
  • InvalidPortFlags: when the flags do not satisfy the preconditions above
  • UnknownErrorCode

Remove a connection between two ports.

When a connection exists, data written to the source port will be available to be read at the destination port.

Preconditions
  • The port types must be identical.
  • The JackPortFlags of the source_port must include PORT_IS_OUTPUT.
  • The JackPortFlags of the destination_port must include PORT_IS_INPUT.
Errors
  • InvalidPortType: when the types are not identical
  • InvalidPortFlags: when the flags do not satisfy the preconditions above
  • UnknownErrorCode

Get a port from the JACK server by its name.

Errors
  • PortNotFound: if no port with that name was found
  • NulError: if any &str argument contains a NUL byte (\0).

Get all (or a selection of) ports available in the JACK server.

Parameters
  • port_filter: A regular expression used to select ports by name. If None, no selection based on name will be carried out.
  • type_filter: A regular expression used to select ports by type. If None, no selection based on type will be carried out.
  • flags_filter: A value used to select ports by their flags. If None, no selection based on flags will be carried out.
Errors
  • NulError: if any &str argument contains a NUL byte (\0).
  • ProgrammerError: if I’ve made a mistake, or your program is utterly degenerate

Create a new port for the client.

This is an object used for moving data of any type in or out of the client. Ports may be connected in various ways.

Each port has a short name. The port’s full name contains the name of the client concatenated with a colon (:) followed by its short name. The jack_port_name_size() is the maximum length of this full name. Exceeding that will cause the port registration to fail and return ProgrammerError.

The port_name must be unique among all ports owned by this client. If the name is not unique, the registration will fail.

All ports have a type, which may be any non-NULL and non-zero length string, passed as an argument. Some port types are built into the JACK API, like JACK_DEFAULT_AUDIO_TYPE or JACK_DEFAULT_MIDI_TYPE. [By default, sqa-jack makes a JACK_DEFAULT_AUDIO_TYPE port - this will be changeable in later releases.]

Errors
  • NulError: if any &str argument contains a NUL byte (\0).
  • PortRegistrationFailed: if port registration failed (TODO: why could this happen?)

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

Errors
  • PortNotMine: if you deregister a port that this client doesn’t own
  • InvalidPort
  • UnknownErrorCode

Open an external client session with a JACK server, optionally specifying a number of JackOpenOptions.

Errors
  • JackOpenFailed(status): if the connection could not be opened. Contains a JackStatus detailing what went wrong.
  • NulError: if any &str argument contains a NUL byte (\0).

Register a handler (a struct that implements JackHandler).

Safety

Warning: Your handler will never be deallocated / Dropped.

Errors
  • UnknownErrorCode

Tell the Jack server that the program is ready to start processing audio.

Returns

Returns the Activated connection type on success, or the current structure and an error on failure.

Errors
  • UnknownErrorCode

Tell the Jack server to remove this client from the process graph. Also, disconnect all ports belonging to it, since inactive clients have no port connections.

Returns

Returns the Dectivated connection type on success, or the current structure and an error on failure.

Errors
  • UnknownErrorCode

Trait Implementations

Executes the destructor for this type. 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 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.