Struct jack::AsyncClient

source ·
pub struct AsyncClient<N, P> { /* private fields */ }
Expand description

A JACK client that is processing data asynchronously, in real-time.

To create input or output (either sound or midi), a Port can be used within the process callback. See Client::register_port on creating ports. Also, see Port for documentation on the API for port.

Example

// Create a client and a handler
let (client, _status) =
    jack::Client::new("my_client", jack::ClientOptions::NO_START_SERVER).unwrap();
let process_handler = jack::ClosureProcessHandler::new(
    move |_: &jack::Client, _: &jack::ProcessScope| jack::Control::Continue,
);

// An active async client is created, `client` is consumed.
let active_client = client.activate_async((), process_handler).unwrap();
// When done, deactivate the client.
active_client.deactivate().unwrap();

Implementations§

source§

impl<N, P> AsyncClient<N, P>where
N: 'static + Send + Sync + NotificationHandler,
P: 'static + Send + ProcessHandler,

source

pub fn new(
client: Client,
notification_handler: N,
process_handler: P
) -> Result<Self, Error>

Tell the JACK server that the program is ready to start processing audio. JACK will call the methods specified by the NotificationHandler and ProcessHandler objects.

On failure, either Err(Error::CallbackRegistrationError) or Err(Error::ClientActivationError) is returned.

notification_handler and process_handler are consumed, but they are returned when Client::deactivate is called.

source§

impl<N, P> AsyncClient<N, P>

source

pub fn as_client(&self) -> &Client

Return the underlying jack::Client.

source

pub fn deactivate(self) -> Result<(Client, N, P), Error>

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.

The handler that was used for Client::activate is returned on success. Its state may have changed due to JACK calling its methods.

In the case of error, the Client is destroyed because its state is unknown, and it is therefore unsafe to continue using.

Trait Implementations§

source§

impl<N, P> Debug for AsyncClient<N, P>

source§

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

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

impl<N, P> Drop for AsyncClient<N, P>

Closes the client.

source§

fn drop(&mut self)

Deactivate and close the client.

source§

impl<N, P> Send for AsyncClient<N, P>

source§

impl<N, P> Sync for AsyncClient<N, P>

Auto Trait Implementations§

§

impl<N, P> !RefUnwindSafe for AsyncClient<N, P>

§

impl<N, P> Unpin for AsyncClient<N, P>

§

impl<N, P> !UnwindSafe for AsyncClient<N, P>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.