31 #ifndef LVTK_LV2_EVENT_HPP
32 #define LVTK_LV2_EVENT_HPP
34 #include <lv2/lv2plug.in/ns/ext/event/event.h>
35 #include <lv2/lv2plug.in/ns/ext/event/event-helpers.h>
37 #warning "this header uses the deprecated lv2 extension event. \
38 please use Atoms instead."
40 #include "lvtk/private/types.hpp"
53 template <
bool Required = true>
56 template <
class Derived>
57 struct I : Extension<Required>
61 I() : m_callback_data(0), m_ref_func(0), m_unref_func(0) { }
67 hmap[LV2_EVENT_URI] = &Mixin::handle_feature;
72 handle_feature(
void* instance,
void* data)
74 Derived* derived =
reinterpret_cast<Derived*
>(instance);
77 LV2_Event_Feature* edata =
78 reinterpret_cast<LV2_Event_Feature*
>(data);
80 mixin->m_callback_data = edata->callback_data;
81 mixin->m_ref_func = edata->lv2_event_ref;
82 mixin->m_unref_func = edata->lv2_event_unref;
90 std::clog<<
" [LV2::EventRef] Validation "
91 <<(this->m_ok ?
"succeeded" :
"failed")<<
"."<<std::endl;
109 return m_ref_func(m_callback_data, event);
118 return m_unref_func(m_callback_data, event);
121 LV2_Event_Callback_Data m_callback_data;
122 uint32_t (*m_ref_func)(LV2_Event_Callback_Data, LV2_Event*);
123 uint32_t (*m_unref_func)(LV2_Event_Callback_Data, LV2_Event*);