13 :
virtual public component<Device, Controller>
18 static constexpr auto prefix{Device::sysex_prefix()};
19 static constexpr auto p_size{prefix.size()};
20 static constexpr auto p_size_incr{p_size + 1};
21 libremidi::midi_bytes bytes{prefix.cbegin(), prefix.cend()};
22 libremidi::midi_bytes blink_bytes{bytes};
23 libremidi::midi_bytes pulse_bytes{bytes};
27 if (bytes.size() > p_size_incr)
30 bytes.erase(bytes.begin() + p_size, bytes.end());
32 if (blink_bytes.size() > p_size_incr)
35 blink_bytes.erase(blink_bytes.begin() + p_size_incr
38 if (pulse_bytes.size() > p_size_incr)
41 pulse_bytes.erase(pulse_bytes.begin() + p_size_incr
47 bytes.push_back(Device::sysex_sufix());
48 m_output.send_message(bytes);
49 bytes.erase(bytes.begin() + p_size, bytes.end());
54 blink_bytes.push_back(Device::sysex_sufix());
55 m_output.send_message(blink_bytes);
56 blink_bytes.erase(blink_bytes.begin() + p_size_incr
62 pulse_bytes.push_back(Device::sysex_sufix());
63 m_output.send_message(pulse_bytes);
64 pulse_bytes.erase(pulse_bytes.begin() + p_size_incr
72 m_output.close_port();
77 if (blink_bytes.size() == p_size)
78 blink_bytes.push_back(Device::blinking_color());
79 if (pulse_bytes.size() == p_size)
80 pulse_bytes.push_back(Device::pulsing_color());
84 static constexpr auto init_m{Device::init()};
85 bytes.insert(bytes.end(), init_m.cbegin(), init_m.cend());
94 static constexpr auto clear_m{Device::clear()};
95 bytes.insert(bytes.end(), clear_m.cbegin(), clear_m.cend());
101 bytes.push_back(Device::constant_color());
104 grid_t::clear([
this] (
auto id)
106 this->bytese.push_back(
id);
107 this->bytese.push_back(0);
111 buttons_t::paint([
this] (
auto id)
126 bytes.push_back(Device::constant_color());
128 grid_t::paint(p, [
this] (
auto id,
const auto&
color)
135 blink_bytes.push_back(
id);
140 pulse_bytes.push_back(
id);
158 bytes.push_back(Device::constant_color());
160 buttons_t::paint(p, [
this] (
auto id,
const auto&
color)
167 blink_bytes.push_back(
id);
172 pulse_bytes.push_back(
id);
186 libremidi::midi_out m_output;
void set_grid(painter &p) override
Pass a reference to the painter object and display it's content to the grid.
Definition sysex_out.hpp:122
void set_button(const button_painter &p) override
Pass a reference to the button_painter object and display it's content to the device's buttons.
Definition sysex_out.hpp:154
Inherits from all type of hardware components like grid, buttons... Provides the hardware type with t...
Definition component.hpp:14