Struct jack::Client [] [src]

pub struct Client(_, _);

A client to interact with a JACK server.

Example

let c_res = jack::Client::new("rusty_client", jack::ClientOptions::NO_START_SERVER);
match c_res {
    Ok((client, status)) => println!(
        "Managed to open client {}, with
status {:?}!",
        client.name(),
        status
    ),
    Err(e) => println!("Failed to open client because of error: {:?}", e),
};

Methods

impl Client
[src]

[src]

Opens a JACK client with the given name and options. If the client is successfully opened, then Ok(client) is returned. If there is a failure, then Err(Error::ClientError(status)) will be returned.

Although the client may be successful in opening, there still may be some errors minor errors when attempting to opening. To access these, check the returned ClientStatus.

[src]

Begin processing in real-time using the specified NotificationHandler and ProcessHandler.

[src]

The sample rate of the JACK system, as set by the user when jackd was started.

[src]

The current CPU load estimated by JACK. It is on a scale of 0.0 to 100.0.

This is a running average of the time it takes to execute a full process cycle for all clients as a percentage of the real time available per cycle determined by the buffer size and sample rate.

[src]

Get the name of the current client. This may differ from the name requested by Client::new as JACK will may rename a client if necessary (ie: name collision, name too long). The name will only the be different than the one passed to Client::new if the ClientStatus was NAME_NOT_UNIQUE.

[src]

The current maximum size that will every be passed to the process callback.

[src]

Change the buffer size passed to the process callback.

This operation stops the JACK engine process cycle, then calls all registered buffer size 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.

[src]

Returns a vector of port names that match the specified arguments

port_name_pattern - A regular expression used to select ports by name. If None or zero lengthed, no selection based on name will be carried out.

type_name_pattern - A regular expression used to select ports by type. If None or zero lengthed, no selection based on type will be carried out. The port type is the same one returned by PortSpec::jack_port_type(). For example, AudioIn and AudioOut are both of type "32 bit float mono audio".

flags - A value used to select ports by their flags. Use PortFlags::empty() for no flag selection.

[src]

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.

The port_spec specifies the IO direction and data type. Oftentimes, the built-in types (AudioIn, AudioOut, MidiIn, MidiOut) can be used.

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. Port::name_size() is the maximum length of the full name. Exceeding that will cause the port registration to fail and return Err(()).

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

[src]

Get a Port by its port id.

[src]

Get a Port by its port name.

[src]

The estimated time in frames that has passed since the JACK server began the current process cycle.

[src]

The estimated current time in frames. This function is intended for use in other threads (not the process callback). The return value can be compared with the value of last_frame_time to relate time in other threads to JACK time. To obtain better time information from within the process callback, see ProcessScope.

TODO

  • test

[src]

The estimated time in microseconds of the specified frame time

TODO

  • Improve test

[src]

The estimated time in frames for the specified system time.

TODO

  • Improve test

[src]

Returns true if the port port belongs to this client.

[src]

Toggle input monitoring for the port with name port_name.

Err(Error::PortMonitorError) is returned on failure.

Only works if the port has the CAN_MONITOR flag, or else nothing happens.

[src]

Establish a connection between two ports by their full name.

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

On failure, either a PortAlreadyConnected or PortConnectionError is returned.

Preconditions

  1. The port types must be identical
  2. The port flags of the source_port must include IS_OUTPUT
  3. The port flags of the destination_port must include IS_INPUT.
  4. Both ports must be owned by active clients.

[src]

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.

On failure, either a PortAlreadyConnected or PortConnectionError is returned.

Preconditions

  1. The port types must be identical
  2. The port flags of the source_port must include IS_OUTPUT
  3. The port flags of the destination_port must include IS_INPUT.
  4. Both ports must be owned by active clients.

[src]

Remove all connections to/from the port.

[src]

[src]

Remove a connection between two ports.

[src]

Remove a connection between two ports.

[src]

The buffer size of a port type

Unsafe

  • This function may only be called in a buffer size callback.

[src]

Expose the underlying ffi pointer.

This is mostly for use within the jack crate itself.

[src]

Create a Client from an ffi pointer.

This is mostly for use within the jack crate itself.

Trait Implementations

impl Send for Client
[src]

impl Drop for Client
[src]

Close the client.

[src]

Executes the destructor for this type. Read more

impl Debug for Client
[src]

[src]

Formats the value using the given formatter.