22struct buttons<Device, Controller>
23 :
virtual base_hardware
24 ,
virtual common<Controller>
25 ,
virtual init<component<Device, class Device::buttons>>
26 ,
virtual clear<component<Device, class Device::buttons>>
27 ,
virtual protocol<component<Device, class Device::buttons>>
31 this->send([&p,
this](
auto& formater)
36 if constexpr(device_##F##_button<Device>) \
37 if (p.get_label() == labels::F && F != b) \
39 formater.set(Device::buttons::F##_id(), b); \
43#define CALL_MACRO(r, data, elem) reseter(elem)
44 FOR_EACH_LABEL(CALL_MACRO)
53 this->on_message_received
54 ([
this](
auto id,
auto value)
55 {
return set(
id, value); });
58 void component_reset()
60 if constexpr(has_clear<typename Device::buttons>)
61 this->clear<
class component<Device, class Device::buttons>>
65 ([
this](
auto& formater)
68 if constexpr(device_##F##_button<Device>) \
72 formater.set(Device::buttons::F##_id(), F); \
75#define CALL_MACRO(r, data, elem) call_func(elem)
76 FOR_EACH_LABEL(CALL_MACRO)
83 using color_cnvrtr = color_converter
84 <
typename color_t<Device, class Device::buttons>::type>;
86 bool set(uint8_t
id, uint8_t midi)
88 btn_prsr.set_midi(midi);
89 return on_button_received(
id);
92 bool set(
auto id,
bool boolean)
94 btn_prsr.set_bool(
boolean);
95 return on_button_received(
id);
98 bool on_button_received(
auto id)
100#define call_ctrlr(F) \
101 if constexpr(F##_button<Device, Controller>) \
102 if (id == Device::buttons::F##_id()) \
104 this->controller->on_##F(btn_prsr); \
105 this->controller->set_##F##_held(btn_prsr); \
109#define CALL_MACRO(r, data, elem) call_ctrlr(elem)
110 FOR_EACH_LABEL(CALL_MACRO)
117#define converters(L) color_cnvrtr L{};
119#define CALL_MACRO(r, data, elem) converters(elem)
120 FOR_EACH_LABEL(CALL_MACRO)
124 button_presser btn_prsr;