mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
convert to workspace, add suil bindings crate
This commit is contained in:
parent
bd6f8ff9bf
commit
dacce119c4
52 changed files with 1994 additions and 116 deletions
5
crates/suil/src/bound.rs
Normal file
5
crates/suil/src/bound.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
72
crates/suil/src/lib.rs
Normal file
72
crates/suil/src/lib.rs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
use std::ffi::CString;
|
||||
|
||||
pub mod bound;
|
||||
|
||||
pub struct Host(*mut self::bound::SuilHost);
|
||||
|
||||
pub struct Instance(*mut self::bound::SuilInstance);
|
||||
|
||||
pub struct Controller(*mut self::bound::SuilController);
|
||||
|
||||
impl Host {
|
||||
fn new () -> Self {
|
||||
//let write = std::ptr::null();
|
||||
//let index = std::ptr::null();
|
||||
//let subscribe = std::ptr::null();
|
||||
//let unsubscribe = std::ptr::null();
|
||||
Self(unsafe {
|
||||
bound::suil_init(&mut 0, std::ptr::null_mut(), 0);
|
||||
bound::suil_host_new(None, None, None, None)
|
||||
})
|
||||
}
|
||||
fn set_touch_func (&self) {
|
||||
unimplemented!();
|
||||
}
|
||||
fn instance (
|
||||
&self,
|
||||
controller: &Controller,
|
||||
container_type_uri: &str,
|
||||
plugin_uri: &str,
|
||||
ui_uri: &str,
|
||||
ui_type_uri: &str,
|
||||
ui_bundle_path: &str,
|
||||
ui_binary_path: &str,
|
||||
features: &[*const bound::LV2_Feature],
|
||||
) -> Result<Instance, Box<dyn std::error::Error>> {
|
||||
let container_type_uri = CString::new(container_type_uri)?;
|
||||
let plugin_uri = CString::new(plugin_uri)?;
|
||||
let ui_uri = CString::new(ui_uri)?;
|
||||
let ui_type_uri = CString::new(ui_type_uri)?;
|
||||
let ui_bundle_path = CString::new(ui_bundle_path)?;
|
||||
let ui_binary_path = CString::new(ui_binary_path)?;
|
||||
Ok(Instance(unsafe {
|
||||
bound::suil_instance_new(
|
||||
self.0,
|
||||
*controller.0,
|
||||
container_type_uri.into_raw(),
|
||||
plugin_uri.into_raw(),
|
||||
ui_uri.into_raw(),
|
||||
ui_type_uri.into_raw(),
|
||||
ui_bundle_path.into_raw(),
|
||||
ui_binary_path.into_raw(),
|
||||
features.as_ptr()
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Host {
|
||||
fn drop (&mut self) -> () {
|
||||
unsafe {
|
||||
bound::suil_host_free(self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Instance {
|
||||
fn drop (&mut self) -> () {
|
||||
unsafe {
|
||||
bound::suil_instance_free(self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue