Skip to content

Instantly share code, notes, and snippets.

@drozdziak1
Last active October 13, 2019 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drozdziak1/23a518c4196f8526edaeeefb489a986c to your computer and use it in GitHub Desktop.
Save drozdziak1/23a518c4196f8526edaeeefb489a986c to your computer and use it in GitHub Desktop.
fn jack_sanity<F>() -> Result<AsyncClient<(), ClosureProcessHandler<F>>, Error>
where
F: 'static + Send + FnMut(&Client, &ProcessScope) -> Control,
{
let (client, _status) = Client::new("anal", ClientOptions::NO_START_SERVER)?;
let in_1 = client.register_port("in_1", AudioIn::default())?;
let in_2 = client.register_port("in_2", AudioIn::default())?;
let process_callback = move |_client: &Client, ps: &jack::ProcessScope| -> Control {
let data_1 = in_1.as_slice(ps);
let data_2 = in_2.as_slice(ps);
dbg!(data_1);
Control::Continue
};
let process = ClosureProcessHandler::new(process_callback);
let active_client = client.activate_async((), process)?;
Ok(active_client)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment