Control Surface pin-t-adl
MIDI Control Surface library for Arduino
InterfaceMIDIInputElements.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <AH/STL/cstdint>
5#include <Settings/NamespaceSettings.hpp>
6
8
10
11namespace Interfaces {
12
15class IValue {
16 public:
19
22 bool getDirty() const { return dirty; }
24 void clearDirty() { dirty = false; }
25
27
28 virtual uint8_t getValue() const = 0;
29
30 protected:
31 bool dirty = true;
32};
33
36class IValue14 {
37 public:
40
43 bool getDirty() const { return dirty; }
45 void clearDirty() { dirty = false; }
46
48
49 virtual uint16_t getValue() const = 0;
50
51 protected:
52 bool dirty = true;
53};
54
55namespace MCU {
56
57class IVPot {
58 public:
61
64 bool getDirty() const { return dirty; }
66 void clearDirty() { dirty = false; }
67
69
70 virtual bool getCenterLed() const = 0;
71 virtual uint8_t getStartOn() const = 0;
72 virtual uint8_t getStartOff() const = 0;
73
74 protected:
75 bool dirty = true;
76};
77
87class IVU {
88 public:
89 IVU(uint8_t max, bool alwaysDirty = false)
90 : max(max), alwaysDirty(alwaysDirty) {}
91
94
97 bool getDirty() const { return dirty; }
99 void clearDirty() { dirty = alwaysDirty; }
100
102
104 virtual uint8_t getValue() = 0;
106 virtual bool getOverload() = 0;
108 virtual float getFloatValue() { return (float)getValue() / getMax(); }
110 uint8_t getMax() const { return max; }
111
112 protected:
113 uint8_t max;
115 bool dirty = true;
116};
117
118} // namespace MCU
119
120} // namespace Interfaces
121
123
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
Abstract interface for MIDI input elements that receive and store a 14-bit value.
virtual uint16_t getValue() const =0
bool getDirty() const
Check if the value was updated since the last time the dirty flag was cleared.
void clearDirty()
Clear the dirty flag.
Abstract interface for MIDI input elements that receive and store a 7-bit value.
virtual uint8_t getValue() const =0
bool getDirty() const
Check if the value was updated since the last time the dirty flag was cleared.
void clearDirty()
Clear the dirty flag.
virtual uint8_t getStartOn() const =0
virtual bool getCenterLed() const =0
bool getDirty() const
Check if the value was updated since the last time the dirty flag was cleared.
virtual uint8_t getStartOff() const =0
void clearDirty()
Clear the dirty flag.
An abstract interface for VU meters.
virtual bool getOverload()=0
Return the overload status.
bool getDirty() const
Check if the value was updated since the last time the dirty flag was cleared.
virtual float getFloatValue()
Get the VU meter value as a floating point number.
uint8_t getMax() const
Get the maximum value that this VU meter can return.
virtual uint8_t getValue()=0
Return the VU meter value as an integer.
IVU(uint8_t max, bool alwaysDirty=false)
void clearDirty()
Clear the dirty flag.
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.
Definition: MinMaxFix.hpp:22