2#include <ossia/detail/config.hpp>
4#include <ossia/detail/span.hpp>
6#include <boost/dynamic_bitset.hpp>
10#define DMX_CHANNEL_COUNT 512
17 uint32_t frequency{44};
18 uint16_t start_universe{0};
19 uint16_t universe_count{1};
20 uint16_t channels_per_universe{512};
28 } autocreate{no_auto};
41 explicit dmx_buffer(
int universe_size);
44 int universes() const noexcept {
return dirty.size(); }
45 void set_universe_count(
int universes)
49 data.resize(universes * universe_size + 255 + 16);
50 dirty.resize(universes);
53 tcb::span<uint8_t> write_channels(
int start,
int count)
noexcept
55 int first_universe = start / universe_size;
56 int last_universe = (start + count) / universe_size;
57 assert(first_universe >= 0);
58 assert(first_universe < dirty.size());
59 assert(last_universe >= 0);
60 assert(last_universe < dirty.size());
62 for(
int i = first_universe; i <= last_universe; i++)
64 return {data.data() + start, std::size_t(count)};
67 tcb::span<uint8_t> write_universe(
int u)
noexcept
69 if(data.size() < (u + 1) * universe_size)
72 return {data.data() + u * universe_size, (std::size_t)universe_size};
75 tcb::span<const uint8_t> read_universe(
int u)
const noexcept
77 if(data.size() < (u + 1) * universe_size)
80 return {data.data() + u * universe_size, (std::size_t)universe_size};
83 ossia::pod_vector<uint8_t> data;
84 mutable boost::dynamic_bitset<> dirty;