pub struct JackPort { /* private fields */ }Expand description
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 port
registration to fail and return ProgrammerError.
Implementations§
Source§impl JackPort
impl JackPort
pub fn as_ptr(&self) -> JackPortPtr
pub unsafe fn from_ptr(ptr: JackPortPtr) -> Self
Sourcepub fn set_short_name(&mut self, name: &str) -> JackResult<()>
pub fn set_short_name(&mut self, name: &str) -> JackResult<()>
Modify a port’s short name. May be called at any time.
If the resulting full name (including the “client_name:” prefix) is longer than jack_port_name_size(), it will be truncated.
Sourcepub fn get_name(&self, short: bool) -> JackResult<Cow<'_, str>>
pub fn get_name(&self, short: bool) -> JackResult<Cow<'_, str>>
Get the name of a port (short or long, determined by the short argument).
Examples found in repository?
19fn run() -> JackResult<()> {
20 let mut conn = JackConnection::connect("simple_client", None)?;
21 let inp = conn.register_port("input", PORT_IS_INPUT)?;
22 let out = conn.register_port("output", PORT_IS_OUTPUT)?;
23 let ports = Ports {
24 inp: inp,
25 out: out
26 };
27 conn.set_handler(ports)?;
28 let mut conn = match conn.activate() {
29 Ok(nc) => nc,
30 Err((_, err)) => return Err(err)
31 };
32 let ports = conn.get_ports(None, None, Some(PORT_IS_INPUT | PORT_IS_PHYSICAL))?;
33 if ports.len() >= 1 {
34 conn.connect_ports(&out, &ports[0])?;
35 println!("Connected output port to {}", ports[0].get_name(false)?);
36 }
37 let ports = conn.get_ports(None, None, Some(PORT_IS_OUTPUT | PORT_IS_PHYSICAL))?;
38 if ports.len() >= 1 {
39 conn.connect_ports(&ports[0], &inp)?;
40 println!("Connected input port to {}", ports[0].get_name(false)?);
41 }
42 thread::sleep(::std::time::Duration::new(60 * 60, 0));
43 Ok(())
44}Sourcepub fn get_type(&self) -> JackResult<Cow<'_, str>>
pub fn get_type(&self) -> JackResult<Cow<'_, str>>
Get the type string of a port.
Sourcepub unsafe fn get_name_raw(&self, short: bool) -> JackResult<*const c_char>
pub unsafe fn get_name_raw(&self, short: bool) -> JackResult<*const c_char>
Get the raw pointer to the name of a port.
§Safety
This function is not intended for external consumption.
Sourcepub fn get_flags(&self) -> JackPortFlags
pub fn get_flags(&self) -> JackPortFlags
Get the JackPortFlags of the port.