Crate jack [−] [src]
extern crate jack; fn main() { // Create client let (mut client, _status) = jack::Client::open("rust_jack_simple", jack::client_options::NO_START_SERVER) .unwrap(); // Register ports. They will be used in a callback when new data is available. let in_a = client.register_port("rust_in_l", jack::AudioInSpec::default()).unwrap(); let in_b = client.register_port("rust_in_r", jack::AudioInSpec::default()).unwrap(); let mut out_a = client.register_port("rust_out_l", jack::AudioOutSpec::default()).unwrap(); let mut out_b = client.register_port("rust_out_r", jack::AudioOutSpec::default()).unwrap(); let process_callback = move |ps: &jack::ProcessScope| -> jack::JackControl { let mut out_a_p = jack::AudioOutPort::new(&mut out_a, ps); let mut out_b_p = jack::AudioOutPort::new(&mut out_b, ps); let in_a_p = jack::AudioInPort::new(&in_a, ps); let in_b_p = jack::AudioInPort::new(&in_b, ps); out_a_p.clone_from_slice(&in_a_p); out_b_p.clone_from_slice(&in_b_p); jack::JackControl::Continue }; // Activate the client, which starts the processing. let active_client = client.activate(process_callback).unwrap(); // Wait for user input to quit use std::io; println!("Press enter/return to quit..."); let mut user_input = String::new(); io::stdin().read_line(&mut user_input).ok(); active_client.deactivate().unwrap(); }
Modules
client_options |
Contains |
client_status |
Contains |
port_flags |
Contains |
Structs
ActiveClient |
A |
AudioInPort |
Safetly wrap a |
AudioInSpec |
|
AudioOutPort |
Safetly wrap a |
AudioOutSpec |
|
CLIENT_NAME_SIZE |
The maximum string length for port names. |
Client |
A client to interact with a JACK server. |
ClientOptions |
Option flags for opening a JACK client. |
ClientStatus |
Status flags for JACK clients. File an issue if you can get it to appear. |
CycleTimes |
Internal cycle timing information. |
MidiInPort |
Safetly wrap a |
MidiInSpec |
|
MidiIter |
Iterate through Midi Messages within a |
MidiOutPort |
Safetly wrap a |
MidiOutSpec |
|
PORT_NAME_SIZE |
The maximum string length for port names. |
PORT_TYPE_SIZE |
The maximum string length for jack type names. |
Port |
An endpoint to interact with JACK data streams, for audio, midi, etc... |
PortFlags |
Flags for specifying port options. |
ProcessScope |
|
RawMidi |
Contains 8bit raw midi information along with a timestamp relative to the process cycle. |
Unowned |
|
Enums
JackControl |
Specify an option, either to continue processing, or to stop. |
JackErr |
An error that can occur in JACK. |
Traits
JackClient |
Common JACK client functionality that can be accessed for both inactive and active clients. |
JackHandler |
Specifies callbacks for JACK. |
PortSpec |
Represents the data of a Port within a |
Functions
get_time |
Return JACK's current system time in microseconds, using the JACK clock source. |
set_error_callback |
Set the global JACK error callback. It is recommended to use the log crate. |
set_info_callback |
Set the global JACK info callback. It is recommended to use the log crate. |
Type Definitions
JackFrames | |
JackPortId | |
JackTime | |
UnownedPort |
|