23 #ifndef LVTK_LV2_WORKER_HPP
24 #define LVTK_LV2_WORKER_HPP
28 #include <lv2/lv2plug.in/ns/ext/worker/worker.h>
30 #include "lvtk/private/types.hpp"
48 LV2_Worker_Respond_Function wrfunc,
49 LV2_Worker_Respond_Handle handle)
50 : p_instance(instance),
67 LV2_Handle p_instance;
68 LV2_Worker_Respond_Handle p_handle;
69 LV2_Worker_Respond_Function p_wrfunc;
76 template <
bool Required = true>
79 template <
class Derived>
80 struct I : Extension<Required>
94 Derived* d =
reinterpret_cast<Derived*
>(instance);
96 LV2_Worker_Schedule *ws =
reinterpret_cast<LV2_Worker_Schedule*
>(data);
98 fe->m_work_schedule_handle = ws->handle;
108 std::clog<<
" [Worker] validation "
109 <<(this->m_ok ?
"succeeded" :
"failed")<<
"."<<std::endl;
118 if (!std::strcmp (uri, LV2_WORKER__interface)) {
160 m_work_schedule_handle, size, data);
216 LV2_Worker_Schedule_Handle m_work_schedule_handle;
219 LV2_Worker_Status (*m_schedule_work_func)(LV2_Worker_Schedule_Handle handle,
224 static LV2_Worker_Status _work(LV2_Handle instance,
225 LV2_Worker_Respond_Function respond,
226 LV2_Worker_Respond_Handle handle,
230 Derived* plugin =
reinterpret_cast<Derived*
>(instance);
232 return (LV2_Worker_Status)plugin->work(wrsp, size, data);
236 static LV2_Worker_Status _work_response (LV2_Handle instance,
240 Derived* plugin =
reinterpret_cast<Derived*
>(instance);
241 return (LV2_Worker_Status)plugin->work_response (size, body);
245 static LV2_Worker_Status _end_run (LV2_Handle instance)
247 Derived* plugin =
reinterpret_cast<Derived*
>(instance);
248 return (LV2_Worker_Status)plugin->end_run();