Type Definition libpd_sys::t_libpd_listhook
source · [−]pub type t_libpd_listhook = Option<unsafe extern "C" fn(recv: *const c_char, argc: c_int, argv: *mut t_atom)>;Expand description
list receive hook signature, recv is the source receiver name argc is the list length and vector argv contains the list elements which can be accessed using the atom accessor functions, ex: int i; for (i = 0; i < argc; i++) { t_atom *a = &argv[n]; if (libpd_is_float(a)) { float x = libpd_get_float(a); // do something with float x } else if (libpd_is_symbol(a)) { char *s = libpd_get_symbol(a); // do something with c string s } } note: check for both float and symbol types as atom may also be a pointer