diff options
Diffstat (limited to 'src/server/ControlBindings.hpp')
-rw-r--r-- | src/server/ControlBindings.hpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index 1c231e22..0e6dbf63 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -19,9 +19,10 @@ #include "BufferRef.hpp" -#include "lv2/atom/forge.h" -#include "raul/Maid.hpp" +#include <lv2/atom/forge.h> +#include <raul/Maid.hpp> +#include <boost/intrusive/options.hpp> #include <boost/intrusive/set.hpp> #include <boost/intrusive/set_hook.hpp> @@ -30,15 +31,9 @@ #include <memory> #include <vector> -namespace raul { class Path; } - -namespace boost { -namespace intrusive { - -template <class Compare> struct compare; - -} // namespace intrusive -} // namespace boost +namespace raul { +class Path; +} // namespace raul namespace ingen { @@ -51,7 +46,8 @@ class Engine; class RunContext; class PortImpl; -class ControlBindings { +class ControlBindings +{ public: enum class Type : uint16_t { NULL_CONTROL, @@ -64,15 +60,20 @@ public: }; struct Key { - Key(Type t=Type::NULL_CONTROL, int16_t n=0) : type(t), num(n) {} - inline bool operator<(const Key& other) const { + Key(Type t, int16_t n) noexcept : type{t}, num{n} {} + Key() noexcept : Key{Type::NULL_CONTROL, 0U} {} + + bool operator<(const Key& other) const { return ((type < other.type) || (type == other.type && num < other.num)); } - inline bool operator==(const Key& other) const { + + bool operator==(const Key& other) const { return type == other.type && num == other.num; } - inline bool operator!() const { return type == Type::NULL_CONTROL; } + + bool operator!() const { return type == Type::NULL_CONTROL; } + Type type; int16_t num; }; @@ -80,9 +81,10 @@ public: /** One binding of a controller to a port. */ struct Binding : public boost::intrusive::set_base_hook<>, public raul::Maid::Disposable { - Binding(Key k=Key(), PortImpl* p=nullptr) : key(k), port(p) {} + Binding(Key k, PortImpl* p) noexcept : key{k}, port{p} {} + Binding() noexcept : Binding{Key{}, nullptr} {} - inline bool operator<(const Binding& rhs) const { return key < rhs.key; } + bool operator<(const Binding& rhs) const { return key < rhs.key; } Key key; PortImpl* port; @@ -129,7 +131,7 @@ private: boost::intrusive::compare<BindingLess>>; static Key - midi_event_key(uint16_t size, const uint8_t* buf, uint16_t& value); + midi_event_key(const uint8_t* buf, uint16_t& value); void set_port_value(RunContext& ctx, PortImpl* port, |