we don't use ctor / dtor, because this breaks aggregate-ness...
| 54 | // we don't use ctor / dtor, because |
| 55 | // this breaks aggregate-ness... |
| 56 | void init(int argc, t_atom* argv) |
| 57 | { |
| 58 | /// Create ports /// |
| 59 | // Create inlets |
| 60 | input_setup.init(implementation, x_obj); |
| 61 | |
| 62 | // Create outlets |
| 63 | output_setup.init(implementation, x_obj); |
| 64 | |
| 65 | /// Initialize controls |
| 66 | if constexpr(avnd::has_inputs<T>) |
| 67 | { |
| 68 | avnd::init_controls(implementation); |
| 69 | } |
| 70 | |
| 71 | if constexpr(avnd::has_schedule<T>) |
| 72 | { |
| 73 | implementation.effect.schedule.schedule_at = [this] <typename... Args>(int64_t ts, void(* func)(T& self, Args...)) { |
| 74 | t_atom a[1]; |
| 75 | a[0].a_type = A_LONG; |
| 76 | a[0].a_w.w_long = reinterpret_cast<t_atom_long>(func); |
| 77 | static_assert(sizeof(func) == sizeof(t_atom_long)); |
| 78 | schedule_defer(&x_obj, (method) +[] (t_object *x, t_symbol *s, short ac, t_atom *av) { |
| 79 | auto self = reinterpret_cast<message_processor*>(x); |
| 80 | auto f = reinterpret_cast<decltype(func)>(av->a_w.w_long); |
| 81 | f(self->implementation.effect); |
| 82 | }, (long)ts, 0, 1, a); |
| 83 | }; |
| 84 | } |
| 85 | |
| 86 | /// Pass arguments |
| 87 | if constexpr(avnd::can_initialize<T>) |
| 88 | { |
| 89 | init_setup.process(implementation.effect, argc, argv); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | void destroy() { } |
| 94 |
no test coverage detected