pubfn open(name: &str, options: JackOpenOptions) -> Result<Client, ()> { let c_name = CString::new(name)
.ok()
.expect("client name must not contain null bytes"); let result = unsafe { jack_client_open(c_name.as_ptr(), options.bits(), ptr::null_mut()) }; if result.is_null() {
Err(())
} else {
Ok(Client { p: result })
}
}
pubfn get_midi_ports(&self, flags: PortFlags) -> PortInfos { let ports_ptr = unsafe {
jack_get_ports( self.p,
ptr::null_mut(),
JACK_DEFAULT_MIDI_TYPE.as_ptr() as *const _,
flags.bits() as _,
)
}; let slice = if ports_ptr.is_null() {
&[]
} else { unsafe { let count = (0isize..)
.find(|i| (*ports_ptr.offset(*i)).is_null())
.unwrap() as usize;
slice::from_raw_parts(ports_ptr, count)
}
};
PortInfos { p: slice }
}
pubfn register_midi_port(&mutself, name: &str, flags: PortFlags) -> Result<MidiPort, ()> { let c_name = CString::new(name)
.ok()
.expect("port name must not contain null bytes"); let result = unsafe {
jack_port_register( self.p,
c_name.as_ptr(),
JACK_DEFAULT_MIDI_TYPE.as_ptr() as *const _,
flags.bits() as _, 0,
)
}; if result.is_null() {
Err(())
} else {
Ok(MidiPort { p: result })
}
}
/// This can not be implemented in Drop, because it needs a reference /// to the client. But it consumes the MidiPort. pubfn unregister_midi_port(&mutself, client: MidiPort) { unsafe { jack_port_unregister(self.p, client.p) };
}
/// The code in the supplied function must be suitable for real-time /// execution. That means that it cannot call functions that might block /// for a long time. This includes all I/O functions (disk, TTY, network), /// malloc, free, printf, pthread_mutex_lock, sleep, wait, poll, select, /// pthread_join, pthread_cond_wait, etc, etc. pubfn set_process_callback(&mutself, callback: ProcessCallback, data: *mut c_void) { unsafe { jack_set_process_callback(self.p, Some(callback), data) };
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.