build suil with symbols; pass features correctly

This commit is contained in:
🪞👃🪞 2024-07-24 16:33:44 +03:00
parent cb181b0d86
commit b1d8fc62a9
4 changed files with 57 additions and 26 deletions

View file

@ -10,28 +10,20 @@ pub struct Instance(*mut self::bound::SuilInstance);
impl Host {
pub fn new () -> Self {
Self(unsafe {
let argv = &mut [] as *mut *mut *mut i8;
bound::suil_init(&mut 0, argv, 0);
let mut argv = [];
bound::suil_init(
&mut 0,
&mut argv as *mut *mut *mut i8,
0
);
bound::suil_host_new(
Some(Self::write),
Some(Self::index),
Some(Self::subscribe),
Some(Self::unsubscribe),
Some(write),
Some(index),
None,
None,
)
})
}
unsafe extern "C" fn write (
_: *mut c_void, _: u32, _: u32, _: u32, _: *const c_void
) {}
unsafe extern "C" fn index (
_: *mut c_void, _: *const i8
) -> u32 {0}
unsafe extern "C" fn subscribe (
_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
) -> u32 {0}
unsafe extern "C" fn unsubscribe (
_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
) -> u32 {0}
fn set_touch_func (&self) {
unimplemented!();
}
@ -68,6 +60,33 @@ impl Host {
}
}
unsafe extern "C" fn write (
_: *mut c_void, _: u32, _: u32, _: u32, _: *const c_void
) {
panic!("write")
}
unsafe extern "C" fn index (
_: *mut c_void, _: *const i8
) -> u32 {
panic!("index");
0
}
//unsafe extern "C" fn subscribe (
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
//) -> u32 {
//panic!("subscribe");
//0
//}
//unsafe extern "C" fn unsubscribe (
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
//) -> u32 {
//panic!("unsubscribe");
//0
//}
impl Drop for Host {
fn drop (&mut self) -> () {
unsafe {

View file

@ -2,21 +2,26 @@ use crate::*;
use std::sync::Arc;
#[test]
fn panics () {
fn test_lv2_ui () {
let host = Host::new();
let mut plugin = plugin::LV2Plugin::new("file:///home/user/.lv2/Odin2.lv2").unwrap();
for ui in plugin.plugin.raw().uis().unwrap().iter() {
println!("{:?}", ui.uri());
println!("{:?}", ui.classes());
}
let mut features = [];
std::mem::forget(features);
let instance = Arc::new(host.instance(
&mut plugin,
"",
&mut plugin.instance.raw(),
"http://lv2plug.in/ns/extensions/ui#X11UI",
"https://thewavewarden.com/odin2",
"https://thewavewarden.com/odin2#ParentUI",
"",
"",
"/home/user/.lv2/Odin2.lv2",
"/home/user/.lv2/Odin2.lv2/Odin2.so",
&[],
"/home/user/.lv2/Odin2.lv2/Odin2.so",
&features,
).unwrap());
self::ui::UI::run(&instance).join();
panic!();
}
mod ui {